Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.
First time visiting? Here are some places to start:- Looking for a certain topic? Check out the categories filter or use Search (upper right).
- Need support? Ask a question to our Community Support category.
- Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
- Be respectful, on topic and if you see a problem, Flag it.
If you would like to contact our Community Manager personally, feel free to send a private message or an email.
Changing name of part to it's length using Beam FeatureScript
marco_teixeira
Member Posts: 1 ✭
I tend to use the Beam FeatureScript alot in my projects, and thanks to the new BOM update its way easier to indicate parts in drawings.
So instead of having the parts being generated with the name "Part 1" etc. I want to have the name of the profile and the length in the name.
I have done the profile name part sucessfully however i cant get the length.
Here's what i have done:
var partName is string = definition.profile.size;
So instead of having the parts being generated with the name "Part 1" etc. I want to have the name of the profile and the length in the name.
I have done the profile name part sucessfully however i cant get the length.
Here's what i have done:
var partName is string = definition.profile.size;
partName ~= "x";
partName ~= /*total lengh of part*/
setProperty(context, {
"entities" : qCreatedBy(id, EntityType.BODY),
"propertyType" : PropertyType.NAME,
"value" : partName
});
I got to the point of out putting some length values but they were pretty much all sketch lines summed up and the length comes in the form of ValueWithUnits and i only want the "Values" contained in it.
i used this line to do the above: evLength(context, {entities : definition.edges});
I want each individual line selected to have its length.
Does anyone have a solution for this?
Thank you
I got to the point of out putting some length values but they were pretty much all sketch lines summed up and the length comes in the form of ValueWithUnits and i only want the "Values" contained in it.
i used this line to do the above: evLength(context, {entities : definition.edges});
I want each individual line selected to have its length.
Does anyone have a solution for this?
Thank you
Tagged:
0
Comments
In the most likely case, evLength is the correct solution. For the "entities" there, you will want to pass in an individual edge, i.e. one element of the array returned by
evaluateQuery(context, definition.edges)
Similarly, you'll want the "entities" of the setProperty call to point to a single beam. As for how that should be accomplished, it will depend on the layout of your current feature code – you want to make sure the right length gets attached to the right beam!
Let us know if you have further questions.