createinstance for user library object

createinstance for user library object

VikSin
Not applicable
579 Views
1 Reply
Message 1 of 2

createinstance for user library object

VikSin
Not applicable

[ FlexSim 23.2.0 ]


Hello, I am trying to run a script that will automatically create an object from my userlibary. I am using an createinstace() command for this. Lib. object is a plane with 3 objects as a subnodes. When i drag and drop this plane_custom_object from the library toolbar, everything workd fine, but when i tried to achieved this with a script, only the plane itself is created, without the other objects.

Script here:

Object object;
for (int i = 1; i <= 3; i++)
{
    object = createinstance(maintree().find("project/userlibrary/test_lib/Plane2"),model());
    object.location.x = 5;
    object.location.y =  -i * (object.size.y + 2);
}

My user library tree:
flx-qst-uselib.pngProblem on picture here:
flx-qst-createinstace.png

How can i modify my script to work properly ?

Thank you for an advice.

Accepted solutions (1)
580 Views
1 Reply
Reply (1)
Message 2 of 2

jason_lightfoot_adsk
Autodesk
Autodesk
Accepted solution

Use createcopy() instead - these are not true library objects that warrant createinsance()

0 Likes