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.

Single Part studio Custom Table Examples

Sam_SchlageckSam_Schlageck Member Posts: 18 PRO
I'm trying to write a custom table featurescript for a single part studio with a composite part. It is essentially a cut list but I am trying to use variables in the part studio to drive the length for the different cut parts instead of frame tool elements. I'm also trying to write some logic that will change the description of certain line items in the cut list based on certain conditions in the part studio. 

Are there any examples of how to set up a custom table without grabbing properties from multiple parts in a part studio? Most of the tables I've seen use instances of different parts in a part studio to set up the different rows on a table.

Comments

  • MichaelPascoeMichaelPascoe Member Posts: 1,953 PRO

    You do not need parts in the part studio to make a custom table. If you do want part data, you can store it in parts via attributes, then retrieve them. Or you can store data in variables then get those variables.

    Here is an example of how to create a custom table using FeatureScript, see Table - Custom Feature. Note this table feature combines a table with a custom feature so that it appears when you use the feature rather than always available in your custom tables drop down. It also takes advantage of the Frame table since that is the only parametric way to get custom tables to drawings at this time.


    Learn more about the Gospel of Christ  ( Here )

    CADSharp  -  We make custom features and integrated Onshape apps!   cadsharp.com/featurescripts 💎
  • Sam_SchlageckSam_Schlageck Member Posts: 18 PRO
    So is your table custom feature creating a table array based off of user inputs and then converting that table array to a cut list using some of the frame tool features?
  • MichaelPascoeMichaelPascoe Member Posts: 1,953 PRO

    Yes, from user inputs or from a CSV. The user inputs can also be variable values.

    It creates both a standard custom table as well as a cut list table, the cut list table is optional for users who need to get their table into a drawing.


    Learn more about the Gospel of Christ  ( Here )

    CADSharp  -  We make custom features and integrated Onshape apps!   cadsharp.com/featurescripts 💎
  • Sam_SchlageckSam_Schlageck Member Posts: 18 PRO
    So I managed to put together a map of arrays to contain the different variables/text I need to display in my table



    The println function displays the following map



    I'm still getting an error when I try to make the table. 


    Here's the code for the table


    I noticed that other featurescripts create maps for tables with no quotations around the variables/text to display in the table. Is this where I'm getting hung up?

    I've been able to look at some other featurescripts which has been helpful. I still have much to learn...
  • MichaelPascoeMichaelPascoe Member Posts: 1,953 PRO
    edited March 6

    One error could be that size() only works for arrays not strings. It's hard to tell without access to the feature. Please share a link so we can help you better.


    Learn more about the Gospel of Christ  ( Here )

    CADSharp  -  We make custom features and integrated Onshape apps!   cadsharp.com/featurescripts 💎
Sign In or Register to comment.