question

Adam C avatar image
0 Likes"
Adam C asked Matthew Gillespie answered

Drop User Library Object to Cursor Release Position

I have a user library object (a group of contained objects) that is always created at the same coordinates, probably the x,y,z of the template that got added to the library. I have tried the following code in the dropscript to grab cursorinfo and change coordinates:

  1. treenode object = dropuserlibraryobject(node("..>object", c));
  2. Object newobject = object.as(Object);
  3. double mousex = cursorinfo(c,2,1,1); //find mouse x
  4. double mousey = cursorinfo(c,2,2,1); //find mouse y
  5. newobject.location.x = mousex;
  6. newobject.location.y = mousey;

This puts the object in a different location, but a long way off from where the cursor was. I have tried 1, 2, and 6 as the type of operation to similar results. Should I be using something other than c in the dropscript, or maybe delete spatial data from the object?

FlexSim 17.1.6
locationuser librarycursor
5 |100000

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

1 Answer

Matthew Gillespie avatar image
1 Like"
Matthew Gillespie answered

The coordinates you're looking for are already passed into the dropscript function. You should just pass these parameters straight into the dropuserlibraryobject function like this:

  1. treenode ontoObject = param(1);
  2. double x = param(2);
  3. double y = param(3);
  4. double z = param(4);
  5. treenode view = param(5);
  6.  
  7. dropuserlibraryobject(node("..>object", c), ontoObject, x, y, z, view);
5 |100000

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