This works fine after the property is created. It shows mm/min and the value is calculated correct,
But after I save the layout and open it again the property show mm/s instead of mm/min and the value is re-calculated.
It looks like the issue is inputting 1/60 directly on the setUnitMagnitude. For any reason when I first copy pasted your code and cleaned it up a bit (forum text may not be pure text), I always got mm/s as the default magnitude. I think if you store 1/60 as a seperate variable first, and then input it in the setUnitMagnitude it would work. This little snippet also seems to work
Thanks for the answer.
Did you save the layout, cleared the 3D window and re-opened the layout and checked if the unit is the same?
The issue is not to calculate the factor: 1./60. or 0.0166666667 or add it to a parameter, all works fine. The issue is that the unit is not the same after I re-open the layout. Maybe the setUnitMagnitude must be used every time a layout is opened?
I did exactly that, I created a new component, saved the whole layout (with include components), cleared and reopened. The feed rate is still shown as mm/min.
Attached is an example similar to what I try to do.
A robot with one position statement. When you press start it will add a real property to the statement and change unit.
But after you save and reload the unit goes back to mm/s
I can’t replicate this but I also modified it a bit.
I created the property, saved the layout, cleared the layout (ctrl + N) and then dropped the just saved layout into the 3d window and it still shows as mm/min
What version of VC are you using, I am using 4.6 so that might be the issue.
You are correct, I see it now. In order to get mm/min back you have to run the program (again) so it will rewrite the values of that statement. Not quite sure if that’s a bug because the vcmx file should save the robot program as well. I guess one workaround would be to use “OnAppInitialized” event where we would loop through all the statements of a robot and then check if it has “Feed Rate” property. If the statement has one, set its magnitude to 1/60.