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.
For (var i = .. Sketch and Plane and Circular pattern
Fda
Member Posts: 42 ✭✭
How could you create a with a "for (var i = ...." a Sketch in each plane.
And how Extrude each Sketch.
jhljlñkjñl
jhljlñkjñl
var sketch2 = newSketch(context, id + "sketch2", { "sketchPlane" : qCreatedBy(makeId("Top"), EntityType.FACE) }); for (var i = 0; i < 5; i += 1) { var miPlane is string = "plane" ~ i; var Circle is string = "Circle" ~ i; skCircle(sketch2, miPlane, { "center" : vector(i, 0) * inch, "radius" : 1 * inch }); opPlane(context, id + miPlane, { "plane" : plane(vector(0, 0, i) * inch, vector(0, 0, 1)), "width" : 6 * inch, "height" : 6 * inch }); } // Create sketch entities here skSolve(sketch2);
Tagged:
0
Comments
@billy2 did something like this a while ago: https://forum.onshape.com/discussion/2568/showing-whats-in-a-query
IR for AS/NZS 1100
opPattern documentation:
https://cad.onshape.com/FsDoc/library.html#opPattern-Context-Id-map
Just typing this up directly on the forum, so there may be some slight typos, but the general idea is:
const lineToRotateAround = line(WORLD_ORIGIN, Z_DIRECTION); const angleIncrement = (360 * degree) / definition.count; var transforms = []; var instanceNames = []; for (var i = 1; i < definition.count; i += 1) // Iterate from 1 -> (definition.count - 1) because we have already created the base (0) instance { const currAngle = i * angleIncrement; const currTransform = rotationAround(lineToRotateAround, i * angleIncrement); // Append the currTransform to the transforms list transforms = append(transforms, currTransform); // instance names don't matter, they just need to be unique strings instanceNames = append(instanceNames, toString(i)); } const patternId = id + "pattern"; opPattern(context, patternId, { "entities" : qCreatedBy(originExtrudeId, EntityType.BODY), "transforms" : transforms, "instanceNames" : instanceNames }); const booleanId = id + "boolean"; opBoolean(context, booleanId, { "tools" : qUnion([qCreatedBy(originalExtrudeId, EntityType.BODY), qCreatedBy(patternId, EntityType.BODY)]), "operationType" : BooleanOperationType.UNION });
Hope this helps. Feel free to comment back with questions.
it's wrong?
You should use
var <b>originExtrudeId</b> = id + "extrude1";
where you had
var originExtrudeId = qCreatedBy(id + "extrude1", EntityType.FACE);// originExtrudeId ???????
and leave the rest of the code the same.
IR for AS/NZS 1100
The reason it is saying "variable originalExtrudeId not found" is because you are trying to use the variable "originalExtrudeId", and earlier you declared it as "var originExtrudeId = ...". These two names aren't the same.
Otherwise, @MBartlett21 is correct:
That is exactly what I didn't notice.
I thought that his feature was failing because it would have been
qCreatedBy(qCreatedBy(id + "extrude", EntityType.FACE), EntityType.BODY)
IR for AS/NZS 1100