3D Object question

3D Object question

amyhyolee
Not applicable
81 Views
2 Replies
Message 1 of 3

3D Object question

amyhyolee
Not applicable

[ FlexSim 21.2.4 ]

Do I have to manually drag and use 100 beds(3D objects) in FlexSim, or can I create 100 beds through code or other methods?

0 Likes
Accepted solutions (1)
82 Views
2 Replies
Replies (2)
Message 2 of 3

arunTTT2P
Advocate
Advocate
Accepted solution

First drag-drop a bed in the model. Then use the treenode.copy() method to create 100 beds. If you save the locations of the bed in the global table you can set their locations to the defined locations in the table using object.setLocation() method.

1713425441653.png

Here's a sample code

Object Bed = Model.find("Bed1"); // Manually Created Bed 
int NumBeds = 100;
string TableName = "GloablTable";
Table LocationTable = Table(TableName);
for(int i=1;i<=NumBeds;i++)
{
   Object NewBed = Bed.copy(); // Creating new bed
   NewBed.name =LocationTable[1];
   NewBed.setLocation(LocationTable[2],LocationTable[3],LocationTable[4])//setting locations
}

Creating directly from the library using code is not loading the 3d shape of the bed - can be a bug. That's the reason first manually drag-drop a bed and then use the code abovementioned code in the scrip console to create the objects.

The SQL query method using INSERT INTO also not loading the 3dshape of the bed after creation.



0 Likes
Message 3 of 3

amyhyolee
Not applicable
Thank you so much!
0 Likes