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.

Use Hole Callout on holes created in FS

CAD_SSPCAD_SSP Member Posts: 45 PRO
Is there any way to create holes in FS such that they can utilise the Hole Callout feature in a drawing?

Best Answers


  • Jake_RosenfeldJake_Rosenfeld Moderator, Onshape Employees, Developers Posts: 1,558
    edited January 2018

    The 'hole()' function in FS is the code that is tied to the button on your Part Studio toolbar. So, if you make your holes by calling 'hole(context, id, { ... })', they will show up with the desired callouts.

    Unfortunately, the documentation for hole is a bit lacking (I've logged a bug for us to improve it), so you'll have to determine the inputs by looking at the precondition of the function itself:

    Happy to answer any questions or provide an example if this is confusing.

    Edit: Just looking at hole myself is a little daunting.  If you can give me an example of the type of hole you'd like to create, I can give you the corresponding call to 'hole()'
    Jake Rosenfeld - Modeling Team
  • CAD_SSPCAD_SSP Member Posts: 45 PRO
    @Jake_Rosenfeld, thanks for your quick reply, I am going to have to ask you for an example, just a very basic blind hole would be ideal and I can work out the rest.
  • CAD_SSPCAD_SSP Member Posts: 45 PRO
    I am getting a "Precondition failed (isLength(definition.holeDiameter, HOLE_DIAMETER_BOUNDS))" error, how do I need to enter the diameter?

    My code so far:
    hole(context,id + "1",{
    "Style" : HoleStyle.SIMPLE,
    "Termination" : HoleEndStyle.BLIND,
    "Diameter" : 2 * millimeter,
    "Sketch points to place holes" : HSHBot1
  • owen_sparksowen_sparks Member, Developers Posts: 2,660 PRO
    If it's blind won't you need a depth parameter in there somewhere?

    Business Systems and Configuration Controller
    HWM-Water Ltd
  • CAD_SSPCAD_SSP Member Posts: 45 PRO
    @owen_sparks Yes I will but I cant get past the diameter error at the moment  :/
  • konstantin_shiriazdanovkonstantin_shiriazdanov Member Posts: 993 ✭✭✭✭✭
    you could use one of the public Point pattern FS's  with "feature pattern" option in combination with builtin hole feature, it would requare to define only one hole per each body and then poppulate it

  • CAD_SSPCAD_SSP Member Posts: 45 PRO
    edited January 2018
    @Jake_Rosenfeld thanks for your example - helps considerably.

    One question, can you define the location other than creating a sketch?

    I have a coordinate that I was originally using to create a cylinder that I then subtracted from the body, is it possible to utilise that?

    Been experimenting with opPoint() but cant quite get my head around it.
    HSHBot1 is a system coordinate and I discovered I can get a vector I can use to create a point by dividing by its units (and then create the point by multiplying the whole vector by the units).

    So far I have:
    var locid = id + "loc";
    opPoint(context, locid, {"point" : vector(HSHBot1/meter)*meter}); //this successfully creates the point, tested by making it an origin and it appears)
    //the failure is on the next line!
    hole(context, id + "hole", {
        "locations" : qCreatedBy(locid, EntityType.VERTEX),    "style" : HoleStyle.SIMPLE,    "endStyle" : HoleEndStyle.BLIND,    "holeDiameter" : 2 * millimeter,    "holeDepth" : 12 * millimeter,    "scope" : tenon
    The failure I get is:

    Anyone got any ideas?
  • NeilCookeNeilCooke Moderator, Onshape Employees Posts: 3,019
    I would guess that it’s looking for a sketch vertex not a point?
  • CAD_SSPCAD_SSP Member Posts: 45 PRO
    edited January 2018
    Thanks All,
    The simple answer to my second question then is No, you cannot define the location without creating a sketch.

    @Jake_Rosenfeld your second answer is a brilliant workaround, I had created the hols successfully by creating a sketch but may adopt your suggestion of creating a function as it neatens it up nicely - thanks for posting it.

    I actually wanted a flat bottom hole as I and creating geometry for a router so I created a cylinder and uses opBoolean(BooleanOperationType.UNION) to fill the chamfer at the bottom of the hole.
Sign In or Register to comment.