question

Troy avatar image
0 Likes"
Troy asked Matthew Gillespie commented

How to set location by code in Proccess Flow Create Kinematics?

I tried to set the x location by custom code in create kinematics:

1685088533159.png

here is my code:

1685088635464.png

It just simply return 1, but system console throw an error:

time: 0.000000 exception: FlexScript exception: Invalid down cast. Object is not an instance of the target type. at MODEL:/Tools/ProcessFlow/ProcessFlow/Create Kinematics>variables/xLoc

I don't know how to solve it.

What is the correct way to set the location by code?

FlexSim 22.2.0
process flowkinematics
1685088533159.png (34.4 KiB)
1685088635464.png (36.6 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 Matthew Gillespie commented

This looks like a bug with the header of that field. The kinematics node is passed as param(4), which is a treenode, not an Object.

Change "Object" to "treenode" on line 5.

I'll add a case to the development list to fix this code header.

· 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.

Troy avatar image Troy commented ·
Thanks a lot, solved my problem.
0 Likes 0 ·
Matthew Gillespie avatar image Matthew Gillespie ♦♦ commented ·

@Troy

This issue is fixed in 23.0.9 and 23.1.3 released today.

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.