Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Auto Center Lines for Patterned holes 1

Status
Not open for further replies.

CADone

Mechanical
Joined
Jan 17, 2007
Messages
160
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
 
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
 
Thanks a lot. Please accept a star from myside :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top