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 ✭✭
Is there any way to create holes in FS such that they can utilise the Hole Callout feature in a drawing?

Best Answers

Answers

  • Jake_RosenfeldJake_Rosenfeld Moderator, Onshape Employees, Developers Posts: 1,646
    edited January 2018
    @keith_marsh

    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:
    https://cad.onshape.com/documents/12312312345abcabcabcdeff/w/a855e4161c814f2e9ab3698a/e/75b72139bd104b1bbf74528e

    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 ✭✭
    @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 ✭✭
    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:
    <div>hole(context,id + "1",{ <span style="background-color: transparent; color: inherit; font-size: inherit; font-family: Flama, sans-serif;">"Style" : HoleStyle.SIMPLE, </span><span style="background-color: transparent; color: inherit; font-size: inherit; font-family: Flama, sans-serif;">"Termination" : HoleEndStyle.BLIND, </span><span style="background-color: transparent; color: inherit; font-size: inherit; font-family: Flama, sans-serif;">"Diameter" : 2 * millimeter, </span><span style="background-color: transparent; color: inherit; font-size: inherit; font-family: Flama, sans-serif;">"Sketch points to place holes" : HSHBot1 </span><span style="background-color: transparent; color: inherit; font-size: inherit; font-family: Flama, sans-serif;">});</span></div>
  • owen_sparksowen_sparks Member, Developers Posts: 2,660 PRO
    If it's blind won't you need a depth parameter in there somewhere?

    O.S.
    Business Systems and Configuration Controller
    HWM-Water Ltd
  • CAD_SSPCAD_SSP Member Posts: 45 ✭✭
    @owen_sparks Yes I will but I cant get past the diameter error at the moment  :/
  • konstantin_shiriazdanovkonstantin_shiriazdanov Member Posts: 1,221 ✭✭✭✭✭
    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 ✭✭
    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:
    <div>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),</div><div>    "style" : HoleStyle.SIMPLE,</div><div>    "endStyle" : HoleEndStyle.BLIND,</div><div>    "holeDiameter" : 2 * millimeter,</div><div>    "holeDepth" : 12 * millimeter,</div><div>    "scope" : tenon
    });
    </div>
    The failure I get is:


    Anyone got any ideas?
  • NeilCookeNeilCooke Moderator, Onshape Employees Posts: 5,689
    I would guess that it’s looking for a sketch vertex not a point?
    Senior Director, Technical Services, EMEAI
  • CAD_SSPCAD_SSP Member Posts: 45 ✭✭
    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.