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.
Use Hole Callout on holes created in FS
CAD_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?
Tagged:
0
Best Answers
-
Jake_Rosenfeld Moderator, Onshape Employees, Developers Posts: 1,646Sorry it took a while, here's an example:
https://cad.onshape.com/documents/c300662082441b82ff935a60/w/26b91c0fbdd5b5ce3b456b54/e/d7f9fdda3c7022ec2c08eb15
The problem in your initial code is that your definition parameters aren't named correctly, the name you're looking for is the "definition.<thisName>" not the name in the annotation (so "holeDiameter" rather than "Diameter" and "locations" rather than "Sketch points to place holes").
Jake Rosenfeld - Modeling Team5 -
Jake_Rosenfeld Moderator, Onshape Employees, Developers Posts: 1,646@keith_marsh
That error seems out of place for the code you're providing (happy to take a deeper look if you post a link to your project), but you won't have much luck using opPoint as input to hole().
hole() figures out the direction to drill holes by using evOwnerSketchPlane(), so the input points must be sketch points or the whole thing will fail.
I think the best way to get around this is to wrap the code in my example into some kind of helper function like:function createHolePoint(context is Context, id is Id, point is Vector, drillDirection is Vector) returns Query { var sketch = newSketchOnPlane(context, id + "sketch", { "plane" : plane(point, -drillDirection) }); skPoint(..., vector(0, 0) * inch); // since the plane's origin is at your desired point, you can just sketch one point at the sketch's origin. skSolve(sketch); return qCreatedBy(id + "sketch", EntityType.VERTEX); }
Then you can call that function in the same way you would call opPoint, but also specify the drill direction, then qUnion() all of the holePoints you create as the locations for hole().Jake Rosenfeld - Modeling Team5
Answers
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()'
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>
O.S.
HWM-Water Ltd
https://cad.onshape.com/documents/c300662082441b82ff935a60/w/26b91c0fbdd5b5ce3b456b54/e/d7f9fdda3c7022ec2c08eb15
The problem in your initial code is that your definition parameters aren't named correctly, the name you're looking for is the "definition.<thisName>" not the name in the annotation (so "holeDiameter" rather than "Diameter" and "locations" rather than "Sketch points to place holes").
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:
Anyone got any ideas?
That error seems out of place for the code you're providing (happy to take a deeper look if you post a link to your project), but you won't have much luck using opPoint as input to hole().
hole() figures out the direction to drill holes by using evOwnerSketchPlane(), so the input points must be sketch points or the whole thing will fail.
I think the best way to get around this is to wrap the code in my example into some kind of helper function like:
Then you can call that function in the same way you would call opPoint, but also specify the drill direction, then qUnion() all of the holePoints you create as the locations for hole().
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.