Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.

First time visiting? Here are some places to start:
  1. Looking for a certain topic? Check out the categories filter or use Search (upper right).
  2. Need support? Ask a question to our Community Support category.
  3. Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
  4. 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.

Options

How to make beam feature drive part numbers?

Eleanor_CoffinEleanor_Coffin Member Posts: 43 ✭✭
I've been using the beam feature regularly and would really like the ability to have it set the component's part number as well as name. (To the exact same thing -- nothing fancy.) I know I can do it with a mix of variables and a Part Number FS, but I'm regularly working with 8+ beams per part studio, all of whose lengths are driven by a combination of config variables/config lists, and it's a really lengthy process.

I'm really not familiar with feature scripts so am looking for some guidance on how to do this. Thanks!

Best Answer

  • Options
    Alex_KempenAlex_Kempen Member Posts: 244 EDU
    Answer ✓
    The easiest solution is probably to make a personal copy of the Beam FeatureScript, figure out wherever it's setting the part name (control + f setProperty, look for PropertyType.NAME), and add a duplicate setProperty call right after, this time with the property type set to PropertyType.PART_NUMBER.

    It's actually quite difficult to do it after the beams have been created since reading off part names (and other part properties) with FeatureScript requires some finagling, and most methods to do so don't update automatically, meaning if you change the name, you'll have to manually update the feature. That's why simply making a modified version of the Beam FS is probably the most straightforward solution. 
    CS Student at UT Dallas
    Alex.Kempen@utdallas.edu
    Check out my FeatureScripts here:



Answers

  • Options
    Alex_KempenAlex_Kempen Member Posts: 244 EDU
    Answer ✓
    The easiest solution is probably to make a personal copy of the Beam FeatureScript, figure out wherever it's setting the part name (control + f setProperty, look for PropertyType.NAME), and add a duplicate setProperty call right after, this time with the property type set to PropertyType.PART_NUMBER.

    It's actually quite difficult to do it after the beams have been created since reading off part names (and other part properties) with FeatureScript requires some finagling, and most methods to do so don't update automatically, meaning if you change the name, you'll have to manually update the feature. That's why simply making a modified version of the Beam FS is probably the most straightforward solution. 
    CS Student at UT Dallas
    Alex.Kempen@utdallas.edu
    Check out my FeatureScripts here:



  • Options
    Eleanor_CoffinEleanor_Coffin Member Posts: 43 ✭✭
    Editing that FeatureScript worked like a charm! I appreciate the specific instructions on what lines to change, thank you @Alex_Kempen

Sign In or Register to comment.