make centermark in thread holes with Ilogic

make centermark in thread holes with Ilogic

gma
Advocate Advocate
607 Views
4 Replies
Message 1 of 5

make centermark in thread holes with Ilogic

gma
Advocate
Advocate

Is it possible to make a rule with ilogic, so you can put a center marker in all threaded holes on the idw drawing. 

And there schall not bee any center mark in regular holes.

0 Likes
Accepted solutions (3)
608 Views
4 Replies
Replies (4)
Message 2 of 5

dalton98
Collaborator
Collaborator
Accepted solution

The threaded holes have a second circle on the outside of the hole. Then you should be able to check if the edge type of the circle is threaded.

Dim oDrawingDoc As DrawingDocument = ThisApplication.ActiveDocument
Dim oSheet As Sheet = oDrawingDoc.ActiveSheet
Dim oView As DrawingView = oSheet.DrawingViews.Item(1)

Dim oCurve As DrawingCurve
For Each oCurve In oView.DrawingCurves
	If oCurve.EdgeType = DrawingEdgeTypeEnum.kThreadEdge
		Dim intent1 As GeometryIntent
		intent1 = oSheet.CreateGeometryIntent(oCurve)
		oSheet.Centermarks.Add(intent1)
	End If
Next

 

Message 3 of 5

Curtis_Waguespack
Consultant
Consultant
Accepted solution

Hi @gma 

 

If you need to run this over all views in the sheet, note that projected views with hidden lines might result in the top edge of the hole being picked up and a center mark applied, which would typically not be what we want. Something like this example will allow those linear thread curves to be skipped.

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

 

 

Dim oDrawingDoc As DrawingDocument = ThisApplication.ActiveDocument
Dim oSheet As Sheet = oDrawingDoc.ActiveSheet
Dim oView As DrawingView

For Each oView In oSheet.DrawingViews

	Dim oCurve As DrawingCurve
	For Each oCurve In oView.DrawingCurves
		If Not oCurve.EdgeType = DrawingEdgeTypeEnum.kThreadEdge Then Continue For

		If oCurve.ProjectedCurveType = Curve2dTypeEnum.kCircleCurve2d Or _
			oCurve.ProjectedCurveType = Curve2dTypeEnum.kCircularArcCurve2d Then
			
			Dim intent1 As GeometryIntent
			intent1 = oSheet.CreateGeometryIntent(oCurve)
			oSheet.Centermarks.Add(intent1)
		End If
	Next
Next

 

EESignature

0 Likes
Message 4 of 5

gma
Advocate
Advocate

Thanks It works, but not on a flat pattern...

it is also possible to make it work on flat pattern?

0 Likes
Message 5 of 5

gma
Advocate
Advocate
Accepted solution

Everything is working and also on flatpatterns.

Thank you

0 Likes