Hi @cwellborn4YTEL. That is a good question. Unfortunately, as far as I know, there is no simple or easy way to do that. I responded to a similar forum post once or twice before about a similar request, and do not recall where that was, or I would provide a link to the old discussion(s) here. Anyways, I kept a test part & drawing for that task, which seemed to be working OK for me. I will post the iLogic code for that task below. However, this is only for that specific situation where the model is a sheet metal part, and those features were created by real punch tool features. This does not include the 'AutomatedCenterlineSettings' stuff. It is pretty intense, so it may add a few more Centermarks than may be needed / wanted. It can be further developed / refined though, as needed.
Sub Main
Dim oDDoc As DrawingDocument = TryCast(ThisDoc.Document, Inventor.DrawingDocument)
If oDDoc Is Nothing Then Return
Dim oSheet As Inventor.Sheet = oDDoc.ActiveSheet
Dim oViews As DrawingViews = oSheet.DrawingViews
If oViews.Count = 0 Then Return
Dim oAllPunchCenterMarksCreated As New List(Of Inventor.Centermark)
Dim oTrans As Transaction = ThisApplication.TransactionManager.StartTransaction(oDDoc, "PunchCenterPoints")
For Each oView As DrawingView In oViews
Dim oListOfCentermarksCreated As New List(Of Inventor.Centermark)
Try
oListOfCentermarksCreated = AddCentermarksToPunchToolHoles(oView)
Catch
Logger.Error("AddCentermarksToPunchToolHoles Function encountered an Error.")
oTrans.Abort
End Try
If oListOfCentermarksCreated.Count > 0 Then
oAllPunchCenterMarksCreated.AddRange(oListOfCentermarksCreated)
End If
Next
oTrans.End
Dim oHLS As HighlightSet = oDDoc.CreateHighlightSet
If oAllPunchCenterMarksCreated.Count > 0 Then
For Each oCM In oAllPunchCenterMarksCreated
oHLS.AddItem(oCM)
Next 'oCM
End If
MsgBox("Review all Centermarks created for PunchToolFeatures.", vbInformation, "iLogic")
oHLS.Clear
End Sub
Function AddCentermarksToPunchToolHoles(oDView As DrawingView) As List(Of Inventor.Centermark)
If oDView.ReferencedDocumentDescriptor.ReferencedDocumentType <> DocumentTypeEnum.kPartDocumentObject Then
Return Nothing
End If
Dim oPDoc As PartDocument = oDView.ReferencedDocumentDescriptor.ReferencedDocument
If Not TypeOf oPDoc.ComponentDefinition Is SheetMetalComponentDefinition Then Return Nothing
Dim oSMDef As SheetMetalComponentDefinition = oPDoc.ComponentDefinition
Dim oSMFeats As SheetMetalFeatures = oSMDef.Features
Dim oPunchToolFeats As PunchToolFeatures = oSMFeats.PunchToolFeatures
If oPunchToolFeats.Count = 0 Then Return Nothing
Dim oSheet As Inventor.Sheet = oDView.Parent
Dim oCMs As Inventor.Centermarks = oSheet.Centermarks
Dim oList As New List(Of Inventor.Centermark)
For Each oPunch As PunchToolFeature In oPunchToolFeats
Dim oCurves As DrawingCurvesEnumerator
Try : oCurves = oDView.DrawingCurves(oPunch) : Catch : End Try
If oCurves Is Nothing OrElse oCurves.Count = 0 Then Continue For
For Each oDCurve As DrawingCurve In oCurves
Dim oIntent As GeometryIntent = oSheet.CreateGeometryIntent(oDCurve)
Dim oCM As Centermark = Nothing
Try
oCM = oCMs.Add(oIntent, True, True)
Catch
Continue For 'skip to next oDCurve
End Try
If oList.Count = 0 Then
oList.Add(oCM) 'if first Centermark, add it to the List
Else 'if other Centermarks exist, make sure they are not in same position, if so, delete it
Dim bFound As Boolean = False
For Each oCMk In oList
Try : If oCMk.Position.IsEqualTo(oCM.Position, 0.001) Then bFound = True
Catch : End Try
Try : If bFound Then : oCM.Delete : End If : Catch : End Try
Next 'oCMk
Try : If Not bFound Then : oList.Add(oCM) : End If : Catch : End Try
End If
Next 'oDCurve
Next 'oPunch
Return oList
End Function
If this solved your problem, or answered your question, please click ACCEPT SOLUTION .
Or, if this helped you, please click (LIKE or KUDOS) 👍.
Wesley Crihfield

(Not an Autodesk Employee)