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.
How to find the id of several bodies in "Query" with several mouse Picks
Fda
Member Posts: 42 ✭✭
I am trying to pass the body id to rename solids with a string + i (1,2,3 ...... etc)
annotation { "Feature Type Name" : "Name my_Part" } export const myFeature = defineFeature(function(context is Context, id is Id, definition is map) precondition { // Define the parameters of the feature type annotation { "Name" : "Nome", "Default" : "Part_" } definition.Name_Part is string; annotation { "Name" : "My Query", "Filter" : EntityType.BODY, "MaxNumberOfPicks" : 20 } definition.parts is Query; } { // Define the function's action var myString = definition.Name_Part; var parts is array = evaluateQuery(context, definition.parts); //println(parts[1]); for (var i = 0; i < size(definition.Name_Part); i += 1) { //println(someString~i); setProperty(context, { "entities" : definition.parts, "propertyType" : PropertyType.NAME, "value" : myString ~ i }); } });
Tagged:
0
Best Answer
-
konstantin_shiriazdanov Member Posts: 1,221 ✭✭✭✭✭ups, sorry. this works
for (var i = 0; i < size(parts); i += 1)<br> {<br><br> //println(someString~i);<br> setProperty(context, {<br> "entities" : parts[i],<br> "propertyType" : PropertyType.NAME,<br> "value" : myString ~ i<br> });<br><br><br> }
5
Answers
for (var i = 0; i < size(parts); i += 1)<br> {<br><br> //println(someString~i);<br> setProperty(context, {<br> "entities" : parts[i],<br> "propertyType" : PropertyType.NAME,<br> "value" : myString ~ i<br> });<br><br><br> }