Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.

First time visiting? Here are some places to start:
  1. Looking for a certain topic? Check out the categories filter or use Search (upper right).
  2. Need support? Ask a question to our Community Support category.
  3. Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
  4. 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.

holes to points in circular pattern

björn_britzbjörn_britz Member Posts: 14 EDU
i want to do holes. i created points in a circular pattern as the center for the holes.
no i have difficulties defining the locations and the scope in fs for the holes.

                    const anzahl = dimensions.Rotation;
                    for (var i = 0; i < anzahl; i += 1)
                    {
                        const t= rotationAround(rotationAxis, (2*PI* radian) * (i/anzahl) );
                        const point3d = t * patternPoint;
                        const point2d = vector(point3d[0],point3d[1]);
                        skPoint(PointSketch, "point" ~i, {
                                "position" : point2d
                        });
                       
 /*                       hole(context,"hole"~i, {
                       
                        "style" : HoleStyle.SIMPLE,
                        "endStyle" : HoleEndStyle.BLIND,
                        "holeDiameter": 2*millimeter,
                        "holeDepth":3*millimeter,
                        "locations": XX,
                        "scope": XX
                        });
*/
                    }


heres the file:  the problem starts in line 247


Comments

  • mahirmahir Member, Developers Posts: 1,307 ✭✭✭✭✭
    edited August 2018
    You need to solve the sketch before the hole feature, not after. For locations, try querying using qCreatedBy(id + "pointSketch", EntityType.VERTEX). For scope, you need to enter a query for the body/bodies you want the hole to go through.
  • björn_britzbjörn_britz Member Posts: 14 EDU
    Oh right, thanks! I changed the solving thing.

    For locations, I tried your suggestion and for scope i tried  qSketchRegion(id + "sketch")  -- that's the sketch on which all the bodies, i want the holes to go through, are.

    It throws the error:
    throw INVALID_INPUT and throw HOLE_CUT_FAIL
  • mahirmahir Member, Developers Posts: 1,307 ✭✭✭✭✭
    edited August 2018
    No, by body I mean a solid body. "Scope" is short for "boolean merge scope". The hole feature wants to know which solid body it should remove material from. So the query needs to look something like qCreatedBy(nameOfFeatureThatCreatedBody, EntityType.BODY && BodyType.SOLID).
  • Jake_RosenfeldJake_Rosenfeld Moderator, Onshape Employees, Developers Posts: 1,646
    The syntax for what @mahir mentions is

    qBodyType(qCreatedBy(<someId>, EntityType.BODY), BodyType.SOLID)

    Jake Rosenfeld - Modeling Team
  • björn_britzbjörn_britz Member Posts: 14 EDU
    Alright! Now I got it!
    Thanks a lot!
  • mahirmahir Member, Developers Posts: 1,307 ✭✭✭✭✭
    The syntax for what @mahir mentions is

    qBodyType(qCreatedBy(<someId>, EntityType.BODY), BodyType.SOLID)

    Jake, I'm curious. Why is that preferred to "EntityType.BODY && BodyType.SOLID"? It's what the hole feature uses internally for it's scope query.
  • Jake_RosenfeldJake_Rosenfeld Moderator, Onshape Employees, Developers Posts: 1,646
    edited August 2018
    @mahir

    As described in the FS documentation:

    Under the "Queries" section of https://cad.onshape.com/FsDoc/uispec.html

    The `&&` operator in the body of a feature can only take booleans as its left and right hand side.  "EntityType.BODY && BodyType.SOLID" would just be a syntax error because neither of those are booleans.  The &&, ||, and ! operators are special cased for Query Parameter filters, but there is no special case within the code itself, and queries must be composed using the provided query functions.
    Jake Rosenfeld - Modeling Team
  • mahirmahir Member, Developers Posts: 1,307 ✭✭✭✭✭
    @Jake_Rosenfeld, gotcha. Thanks. Short version = "cuz" ;)
Sign In or Register to comment.