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.
ARRAY VARIABLES
shawn_crocker
Member, OS Professional Posts: 865 PRO
I'm having a hard time creating an array that has a dimensional size defined by another variable
var partCount = size(evaluateQuery(context, definition.sheetMetalParts)); var flatSizes = [partCount];When I try to store things into flatSizes, [0] dimension takes a value but when the code loops back to store something in [1], I get a "Array index 1 out of bounds.". It feels like I not defining the array size properly.
flatSizes[i] = getExtents(boundingBox, 3, inch);
That is how I'm trying to store the map values. I'v been searching and am not finding clear answers on this one. 0
Best Answer
-
Alex_Kempen Member Posts: 248 EDUYou're currently making an array containing the variable partCount. Accordingly, flatSizes always contains a single element, so it always has a size of 1. To make flatSizes properly, use makeArray instead.CS Student at UT DallasAlex.Kempen@utdallas.eduCheck out my FeatureScripts here:1
Answers