Idea

James Rodgers1 avatar image
4 Likes"
James Rodgers1 suggested James Rodgers1 edited

Option to physically separate copies where "Delete and Copy" is used in a parameter table

Currently when the "delete and copy" option is used for objects whose quantity is in a parameters table, the copies are on top of each other in the 3D space. I would suggest that there be an option to space them out using X, Y and maybe Z offsets based on the position of the original. The total offset is the copy number times the entered offset value. I modified the code as if there were X, Y and Z offsets available in the edit window. There is likely a more elegant way of doing this maybe with Vec3 :

treenode reference = param(1);
Variant newValue = param(2);
Variant oldValue = param(3);
Variant X_offset = param(4);
Variant Y_offset = param(5);
Variant Z_offset = param(6);
int isReset = param(7);

{ // ************* PickOption Start ************* //
/***popup:ParamSetNodeValue*/
/**Delete and Copy Out Objects*/
if (/***tag:condition*//**/isReset/**/) {
   Array objects = reference.as(Object).outObjects.toArray();

   if (objects.length == 0) {
      mpt("Error setting parameter " + c.up.up.name + " - Not enough objects in object set"); mpr();
   } else {
      for (int i = 2; i <= objects.length; i++) {
         objects[i].destroy();
      }

      treenode firstObj = objects[1];
      double firstX = firstObj.as(Object).location.x;
      double firstY = firstObj.as(Object).location.y;
      double firstZ = firstObj.as(Object).location.z;
      int total = Math.max(1, newValue);
      for (int i = 2; i <= total; i++) {
         treenode newObj = createcopy(firstObj, firstObj.up);
         newObj.name = firstObj.name + "_" + i;
         applicationcommand("recreateObjectConnections", newObj, firstObj);
         newObj.as(Object).location.x = firstX + X_offset*(i-1);
         newObj.as(Object).location.y = firstY + Y_offset*(i-1);
         newObj.as(Object).location.z = firstZ + Z_offset*(i-1);
      }
   }
}

} // ******* PickOption End ******* //


copies
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

No Comments

·

Write a Comment

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Your Opinion Counts

Share your great idea, or help out by voting for other people's ideas.

Related Ideas