Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

Auto Center Lines for Patterned holes 1

Status
Not open for further replies.

CADone

Mechanical
Jan 17, 2007
160
0
0
Hi,
I have a round part with 3 holes. These 3 holes are patterned (Pattern1). This Pattenr1 is patterned (Pattern2)

I now have this part with several holes due to above pattern.

On the drawing, I need these holes to be center marked (centerline) automatically.

I tried, but it wouldnt. Is there a way?

Thx
C1
 
Replies continue below

Recommended for you

It is a strange behavior. I don't see any other way then putting center marks manually.

Hovewer, I have written a little macro which can help you. It automatically founds all circular edges on the selected face from Drawing View and inserts center marks.

So you should preselect the face where the holes are and run the following macro:

- - - - - - - - - - - - - - - - -
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swDraw As SldWorks.DrawingDoc
Dim swSelMgr As SldWorks.SelectionMgr
Dim swFace As SldWorks.Face2

Sub main()

Set swApp = Application.SldWorks

Set swModel = swApp.ActiveDoc

Set swDraw = swModel

Set swSelMgr = swModel.SelectionManager

Set swFace = swSelMgr.GetSelectedObject6(2, -1)

Dim vEdges As Variant
Dim swEdge As SldWorks.Edge
Dim swCurve As SldWorks.Curve
Dim swEnt As SldWorks.Entity
Dim i As Integer

vEdges = swFace.GetEdges

For i = 0 To UBound(vEdges)
Set swEdge = vEdges(i)
Set swCurve = swEdge.GetCurve()
If swCurve.IsCircle Then
Set swEnt = swEdge
swEnt.Select4 False, Nothing
swDraw.InsertCenterMark3 swCenterMarkStyle_e.swCenterMark_Single, True, True
End If
Next

End Sub
- - - - - - - - - - - - - - - - -

Hope this help.

Artem Taturevich
CSWP
 
Status
Not open for further replies.
Back
Top