question

Gui Vaccaro avatar image
0 Likes"
Gui Vaccaro asked Sebastián Cañas commented

If createinstance() is deprecated, how to create a plane via code?

Hello,
the documentation states createinstance() is deprecated and Object.create() should be used instead. However, a plane is a library/VisualTool, so not recognized as Object. What is the current recommended method to create a plane via code?
Thank you.

FlexSim 25.0.0
best practicesanswers cleanup
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

Sebastián Cañas avatar image
0 Likes"
Sebastián Cañas answered Sebastián Cañas commented

@Gui Vaccaro ,

Object.create("VisualTool");
· 2
5 |100000

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

Gui Vaccaro avatar image Gui Vaccaro commented ·
Thank you, @Sebastián Cañas ! However, this brings me to another question. If a Visual Tool is a generic visual object, how to distinguish among the possibilities? (Text, Billboard, Plane, USD Stage, ...). Relying on shape numbers is a weak modeling approach, as those lists might change from version to version. It is the same that happens with frame and shape references for people or flowItems. I was looking for a more robust approach. Would you have any suggestions, please? Thank you!
0 Likes 0 ·
Sebastián Cañas avatar image Sebastián Cañas Gui Vaccaro commented ·

@Gui Vaccaro , after creating a Visual Tool you could set the property Visual Display of it to create any of the shapes that's available. For example using this code:

Object vt = Object.create("VisualTool");
vt.setProperty("VisualDisplay", "Text");

However, then you should set size, color or any other property in order to fit your needs using the methods for Object Class.

As far as I checked, objects like USD Stage or Walls are not part of the VisualTool, you should check the proper class to use Object.create().

I think that could be the approach I'd suggest with what's available right now.

0 Likes 0 ·