question

Amy avatar image
0 Likes"
Amy asked Amy commented

3D Object question

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?

FlexSim 21.2.4
3d object
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

·
Arun Kr avatar image
0 Likes"
Arun Kr answered Amy commented

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[i][1];
   NewBed.setLocation(LocationTable[i][2],LocationTable[i][3],LocationTable[i][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.




1713425441653.png (9.2 KiB)
· 1
5 |100000

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

Amy avatar image Amy commented ·
Thank you so much!
0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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