Draw a circle tangent to 3 pre-selected lines or edges

Hi everyone ,

let's set the context....

I  have several parts in some assemblies, that have some hexagonal holes...   When detailing my assemblies or parts, i want to first put a centermark to my hex. holes.

What i can do is, sketch a temporary circle that is tangent to 3 opposite edges of my hex. hole ( thus auto centering a circle ) then put a centermark to this circle, then turn this circle to dotted line to make it seem like disapear without deleting it ( deleting it would make my centermark 'floating' ).

But that process is rather time consuming... ( imagine, on a single drawing, i can have up to 50 of those hex. holes ...)

My thought was,  would it be possible to pre-select 3 opposing edges of a hex. hole ( i mean manually selecting, before executing a macro ), then have a macro ( in VBA ) to draw a circle tangent to these 3 lines ( or edges ),  then put a centermark to that newly sketched circle, then put that circle into dotted line to ' make disapear '

Thus seriously reducing the process of centermarking hex. holes 

First, does it make sense ?

and Secundo, does anyone have a hint to how achieve this ?

( just remember, it has to be done into a view , in a drawing files ... )

Thanks in advance to all the API gurus around here ...

SolidworksApi macros
Answers 4
MS
MS 2014-03-27 Best Answer

You could use a sketched circle in the drawing view, leave it standard line type, and sketch pattern it with the same spacing as your model.  If you wanted to keep associativety you could use the dimensions from the model as inputs to the sketch pattern using linking.

Then you can use a window select, possibly with a selection filter on, and add center marks to all the circles at once.

And then you can place all the circles you don't want to see on layers and hide that layer.

--Matt

GH
GH 2014-03-28

How were the hexagonal holes created? If you used the polygon sketch entity then it already has a circle in it. Just show the sketch and select the circle for the centermarks. Then hide the sketch.

ML
ML 2014-03-28

... Many of the hex. holes are repetitions of an original ...

thus , i cannot rely on showing the sketch to place a centermark ...

PO
PO 2014-03-28

Using a macro, you should be able to select one edge on each hex hole and then run it.  For each hole, the macro could grab the closed loop and add a circle tangent to the first three edges in the loop.  Then add the center mark, hide the circle, and move on to the next hole.

Unfortunately, I do not have time to try and write a macro that would do this right now.