question

George C2 avatar image
0 Likes"
George C2 asked George C2 commented

Code: How do I create a 3D Processor with Operator visuals?

My goal is to create a 3D Processor within FlexSim custom code with the 3D visuals of an operator.

My Current Code is as following:

 treenode newPerson;
 newPerson = createinstance(node("fixedresources/Processor", library()),model());
 setobjectshapeindex(newPerson,16);
 setobjecttextureindex(newPerson,5);

[The #16 and #5 come from "View" -> "Media Files" -> "Shapes" and "Images" index values];

The issues I am having are:

1. When the code is run, the operator processor looks massively large compared to an actual operator [See Figure 1]

2. After hitting the "Reset" button, the processor resets to what it originally looks like [See Figure 2]

*Note: Ideally, I would prefer not to create a custom library to solve this solution, but if you can provide code to access it from a saved filepath then I can accept that as a Plan B.

FlexSim 19.1.0
operatorprocessorcodevisual
figure-1.jpg (29.8 KiB)
figure-2.jpg (31.4 KiB)
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

·
Phil BoBo avatar image
0 Likes"
Phil BoBo answered George C2 commented

Rather than storing the object in a user library, you could just store it in a node in the Tools folder in your model tree. Then reference it there and call createcopy().

Just make the base object the way you want and copy/paste it into the tree.

processor-man.fsm

You can make a processor look like an operator by either:

1. (If you don't need animations) set its 3D shape to C:\Program Files\FlexSim 2019 Update 1\fs3d\Operator\OperatorMale_Standing\OperatorMaleStanding.fbx

2. (If you want its animations) on the General tab, by Visuals/Animations, press the Load button and select C:\Program Files\FlexSim 2019 Update 1\fs3d\Operator\OperatorMale_LowRes\OperatorMale.t


processor-man.png (190.3 KiB)
processor-man.fsm (24.8 KiB)
· 3
5 |100000

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

George C2 avatar image George C2 commented ·

@phil.bobo

1. How do you insert ProcessorMan into the "MyObjects" folder? How do you create such a folder into that "Tools" folder? Sorry, I am new to this area of FlexSim.

2. Is it possible to directly use FlexSim code within a process flow to create such a thing?

0 Likes 0 ·
Phil BoBo avatar image Phil BoBo ♦♦ George C2 commented ·

To add a node in the tree, right-click the parent node and select Node > Insert Into:

Use Edit > Copy and Edit > Paste to copy a node from one place in the tree to another:

Click the node and type in the edit field to change a node's name:

See Tree Properties (docs.flexsim.com)

I don't understand your second question. Yes, you can do anything in FlexSim using code. The whole point of my example was to show you how you can set up the object normally using the UI so that the code for copying it is simply one createcopy() call instead of a hundred other commands that modify the various things about the object individually.

0 Likes 0 ·
1.png (20.1 KiB)
2.png (22.7 KiB)
3.png (17.3 KiB)
4.png (18.6 KiB)
5.png (8.9 KiB)
George C2 avatar image George C2 Phil BoBo ♦♦ commented ·
@phil.bobo

Hi Phil,

Thanks for the help! I got it working now.

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.