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:

treenode object = dropuserlibraryobject(node("..>object", c));
Object newobject = object.as(Object);
double mousex = cursorinfo(c,2,1,1); //find mouse x
double mousey = cursorinfo(c,2,2,1); //find mouse y
newobject.location.x = mousex;
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:

treenode ontoObject = param(1);
double x = param(2);
double y = param(3);
double z = param(4);
treenode view = param(5);

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.