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.
multiple select
papawo
Member, Developers Posts: 206 PRO
Im trying to select a point then create a circle and loop again.
where can i insert the sketchId so i can have a diff Id everytime it loop.
for (var i = 0; i < numberOfPoints; i += 1)
where can i insert the sketchId so i can have a diff Id everytime it loop.
for (var i = 0; i < numberOfPoints; i += 1)
if (definition.TypesOfHoles ==TypesOfHoles.TRANSOMHOLE )
{
sketchId = sketchId + i;
skCircle(skTransomHole, "circle1" , {
"center" : vector(0, 0) * inch,
"radius" : .25 * inch
});
skSolve(skTransomHole);
println(sketchId);
0
Comments
FS string concatenation uses the "~" operator, so you should instead use e.g.:
You can insert a unique sketch id as the "id" parameter in the call to skCircle, e.g.:
Also, you should call skSolve only once, at the end of the sketch feature, after all entities have been added to the sketch.
i added a println( "circle1"~i);; and it shows me diff Id
To get the circles positioned correctly, you'll need to calculate the position of each circle as a 2D vector on the sketch plane, and pass that vector as the "center" argument of skCircle.
Here's an example that takes in sketch points and draws circles around them on their sketch planes:
https://cad.onshape.com/documents/75e57c1e19ec6d534fb18b97/w/24279c587ff21cf8bd9ae49b/e/a32b15596565802fe644c917