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.
New Custom Feature: Rename Beams
SethF
Member Posts: 130 PRO
This is mostly just recycled code from the beams feature. In our case, it's really nice to have the beams named accurately, including the length, which obviously changes with move faces or what have you. So the idea is that you put this feature after all of your manipulation to the beams, it remeasures the length, and sets a new name.
https://cad.onshape.com/documents/6d2b1edc58ecf1f27385a36d/v/8a838befd9737ddf11bfe069/e/26552c6e3aabd627ba52bf99
Here's an example:
1) Make some beams
2) Mess up their lengths
3) Rename them:
As you can see in the example, you have the option for a second unit in case you would like to show the length in both inches and mm, for example. As you can also see in the example, it has the short coming of not being able to change your naming options for individual Beam features. Initially I had made my own copy of the Beams feature, added some new attributes for me to use, and then grabbed those in rename. That way I could add to the name that was already selected (minus the incorrect length). But I didn't want to have to add in code every time the Beam feature is updated. So for now, using this feature, if you want the Standard listed for one beam, you get the Standard listed for ALL the beams..
I'm a programming nooob. So. Sorry if the code is ugly.
https://cad.onshape.com/documents/6d2b1edc58ecf1f27385a36d/v/8a838befd9737ddf11bfe069/e/26552c6e3aabd627ba52bf99
Here's an example:
1) Make some beams
2) Mess up their lengths
3) Rename them:
As you can see in the example, you have the option for a second unit in case you would like to show the length in both inches and mm, for example. As you can also see in the example, it has the short coming of not being able to change your naming options for individual Beam features. Initially I had made my own copy of the Beams feature, added some new attributes for me to use, and then grabbed those in rename. That way I could add to the name that was already selected (minus the incorrect length). But I didn't want to have to add in code every time the Beam feature is updated. So for now, using this feature, if you want the Standard listed for one beam, you get the Standard listed for ALL the beams..
I'm a programming nooob. So. Sorry if the code is ugly.
4
Comments
Welcome to featurescripting!
Something that would have helped me a lot when I started are some simple JavaScript tutorials. If you don't already know JS, learning some basics will really help you with FeatureScript.
Learn more about the Gospel of Christ ( Here )
CADSharp - We make custom features and integrated Onshape apps! cadsharp.com/featurescripts 💎
chadstoltzfus@premiercb.com
That is a neat trick. Now I can use Part Name!
Did you know about this trick @Evan_Reese?
Learn more about the Gospel of Christ ( Here )
CADSharp - We make custom features and integrated Onshape apps! cadsharp.com/featurescripts 💎
chadstoltzfus@premiercb.com