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.
tableArray() vs table()
EvanReese
Member, Mentor Posts: 2,798 PRO
I'm working on a feature that produces a table, but would like subsequent instances of that feature to add additional tables instead of overwriting the last one. Cutlist has the behavior I want. I see that it uses tableArray() and creates multiples in one go by iterating over the composite bodies made by the Cutlist feature and getting the table from each which was stored as an attribute by Cutlist. That defineTable() returns a TableArray, but I'm getting the error that "Return value should be Table, was TableArray" even though the documentation says it should be able to return either. Any ideas or examples I can look at?
Best Answer
-
Caden_Armstrong
Member Posts: 384 PRO
I'm looking for a public sample (I have some private ones I can share directly with you) for the forum knowledge base…
But have you defined the correct return type?export const bendTable = defineTable(function(context is Context, definition is map) returns TableArray
if you copy pasted a single table feature that has "returns Table", that might be your problem.
www.smartbenchsoftware.com --- Renaissance --- fs.place
Experts in Onshape Automation - Custom Features and Integrated Applications1
Answers
I'm looking for a public sample (I have some private ones I can share directly with you) for the forum knowledge base…
But have you defined the correct return type?
export const bendTable = defineTable(function(context is Context, definition is map) returns TableArray
if you copy pasted a single table feature that has "returns Table", that might be your problem.
Experts in Onshape Automation - Custom Features and Integrated Applications
That was 100% it, thanks Caden! If I hadn't been trying to do it with my last brain fumes of the day I suppose I could have realized that's exactly what the error message is telling me 🤦♂️
The Onsherpa | Reach peak Onshape productivity
www.theonsherpa.com