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

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

guiroehe
Collaborator Collaborator
204 Views
4 Replies
Message 1 of 5

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

guiroehe
Collaborator
Collaborator

[ FlexSim 25.0.0 ]

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.

0 Likes
Accepted solutions (1)
205 Views
4 Replies
Replies (4)
Message 2 of 5

SebastianCanasV
Collaborator
Collaborator
Accepted solution

@Gui Vaccaro ,

Object.create("VisualTool");
0 Likes
Message 3 of 5

guiroehe
Collaborator
Collaborator
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
Message 4 of 5

SebastianCanasV
Collaborator
Collaborator

@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
Message 5 of 5

guiroehe
Collaborator
Collaborator
Thank you, @Sebastián Cañas​!