Be sure to read the Forum Rules and Guidelines before start using the Forum.
10/01/2019 at 18:06 #11450
I know that for properties on a component there’s the “CalculatedValue” property to get the actual value.
Is there a way to do the same for the MinValue/MaxValue of a joint?
I can only get the string from there.
Thanks in advance for any help!
You need to login in order to like this post: click here11/01/2019 at 12:02 #11459
I am also wondering, why the property returns a string.
What’s wrong with casting the string to float?Python1minValue = float(myJointNode.Dof.MinValue)
You need to login in order to like this post: click here11/01/2019 at 12:56 #11479
Max and min limits are string expressions to allow dependencies to properties such as other joint values. And the properties in python API are MinLimit and MaxLimit and not MinValue and MaxValue. If the expression is simple numeric literal such as “360” you can cast it to float. With complex expression there is a way to solve those by creating a temporary expression property and solving the expression with it.
Below there is an example which solves and prints link max limits for ABB IRB1200_5-90 robot, which has both simple and complex limit expressions:Python123456789101112131415161718192021222324252627from vcScript import *app = getApplication()comp = app.findComponent('IRB1200_5-90')links =[comp]prop = Nonewhile links:link = links.pop(0)print link.Nameif link.Dof:max_limit = 0try:max_limit = float(link.Dof.MaxLimit)print ' MaxLimit:%.3f' % max_limitexcept:if not prop:prop = comp.createProperty(VC_EXPRESSION, 'TempExpression')prop.Value = link.Dof.MaxLimitmax_limit = prop.CalculatedValueprint ' MaxLimit:%.3f' % max_limitelse:print ' No Dof.'links.extend(link.Children)if prop:comp.deleteProperty(prop)
You need to login in order to like this post: click here11/01/2019 at 13:06 #11481
To correct myself, the properties for vcDof are MinLimit and MaxLimit but for vcJoint they are MinValue and MaxValue.
You need to login in order to like this post: click here11/01/2019 at 16:57 #11491
Thanks for your reply but since I reference a property in this expression I cannot simply cast it to float.
Thanks for the fast help!
This seems to be the best way currently, didn’t think about that solution.
Maybe it would be a cool feature if you had some kind of method called “evalExpression” on the vcComponent instance to evaluate an expression.
Anyways thanks for the solution I appreciate that! 🙂
You need to login in order to like this post: click here
You must be logged in to reply to this topic.