question

Gabriel illescas Cavazos avatar image
0 Likes"
Gabriel illescas Cavazos asked Regan Blackett edited

how can I change the velocity of crane according to event?

cranes
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

·
Regan Blackett avatar image
0 Likes"
Regan Blackett answered Regan Blackett edited

Crane speeds are stored in a table found in the Crane object's tree structure:


and can be manipulated with writing a little bit of code. For example, if you wanted to change the Gantry speed during something like the Crane's OnLoad event, you could edit the code of the OnLoad trigger to include this line:

Table(getvarnode(current, "cranespeeds"))["Gantry"]["Max_Speed"] = 5;

The above sets the gantry speed to 5 when the code is executed. Note the use of getvarnode() to get a reference to the speeds table so that You can access its cell values using standard table bracket [] notation.

Substitute any of the Row names ("Gantry", "Trolley", "Hoist_Lift", "Hoist_Drop") and column names ("Max_Speed", "Acceleration", "Deceleration") to change the value in any of the table cells.

If the event that changes the speed isn't an event that belongs to the Crane, you would need to substitute the word 'current' in my example code to a valid reference to the Crane gained either through use of the model's "find" method or using a port connection from another object to get to the Crane.


tree.png (13.0 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.

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.