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.
Custon Feature to concatenate custom property and part name
Lewis_Maina_Muthoni
Member, csevp Posts: 10 ✭✭
Can someone please guide me OR share materials to help me achieve the following:
I have a custom property called BCP Part Number, I want to automatically transfer this number and concatenate it with the Part Name as per the below image. Such that the final part name is a combination of BCP Part Number + Part Name.
I have a custom property called BCP Part Number, I want to automatically transfer this number and concatenate it with the Part Name as per the below image. Such that the final part name is a combination of BCP Part Number + Part Name.
Tagged:
0
Answers
Why would you want to have the part number in the part name? If you need that for naming the exported files than you can use the export rules in the Onshape preferences. There you can create strings of concatenated properties.
This is possible, but with some big caveats that might make it not worth it to you.
Caveat 1: Custom features can edit part properties only if they haven't already been set by a user. That means if you've named it by typing a name, the feature won't work. To make it work you have to hit the blue "Reset all" button in the properties menu, but that unfortunately will clear everything that was there, including the part number. This isn't a big deal if you know ahead of time and work with that in mind, but this is an issue if you have a project with a lot of parts to fix.
Caveat 2: Custom features can't read a part's properties. That means you can't make a feature that reads the PN and adds it to the name. The feature would need to set the PN, and set the Name, to even know what they are and be able to concatenate them. This means you can't take advantage of Onshape's auto part numbering.
That's why it might be hard to implement retroactively on a project, but if you plan for this workflow ahead of time on the next one, you could create a custom feature for your org that helps you fill out properties and forces some naming conventions like putting the PN in the name. Here's an example of how simple the code can be.