Is there a way, using VBA, to identify the geometry (arc, circle, hole, etc) that a CenterMark is attached to? If that's possible, I'd then want to be able to get properties of that geometry, such as diameter/radius.
Thank you
How to identify the "parent" of a Centermark?
How to identify the "parent" of a Centermark?
Meh, I'll post it here too for posterity.
Sub main()
Dim swApp As SldWorks.SldWorks
Dim swDwg As SldWorks.DrawingDoc
Dim swAnnot As SldWorks.Annotation
Dim swView As SldWorks.View
Dim swEnt As SldWorks.Entity
Set swApp = Application.SldWorks
Set swDwg = swApp.ActiveDoc
Set swView = swDwg.GetFirstView
Set swView = swView.GetNextView
Set swAnnot = swView.GetFirstAnnotation3
While Not swAnnot Is Nothing
If swAnnot.GetType = swCenterMarkSym Then
Set swEnt = swAnnot.GetAttachedEntities3(0)
swEnt.Select4 True, Nothing
End If
Set swAnnot = swAnnot.GetNext3
Wend
End Sub
Go to full postSub main()
Dim swApp As SldWorks.SldWorks
Dim swDwg As SldWorks.DrawingDoc
Dim swAnnot As SldWorks.Annotation
Dim swView As SldWorks.View
Dim swEnt As SldWorks.Entity
Set swApp = Application.SldWorks
Set swDwg = swApp.ActiveDoc
Set swView = swDwg.GetFirstView
Set swView = swView.GetNextView
Set swAnnot = swView.GetFirstAnnotation3
While Not swAnnot Is Nothing
If swAnnot.GetType = swCenterMarkSym Then
Set swEnt = swAnnot.GetAttachedEntities3(0)
swEnt.Select4 True, Nothing
End If
Set swAnnot = swAnnot.GetNext3
Wend
End Sub
Re: How to identify the "parent" of a Centermark?
Meh, I'll post it here too for posterity.
Sub main()
Dim swApp As SldWorks.SldWorks
Dim swDwg As SldWorks.DrawingDoc
Dim swAnnot As SldWorks.Annotation
Dim swView As SldWorks.View
Dim swEnt As SldWorks.Entity
Set swApp = Application.SldWorks
Set swDwg = swApp.ActiveDoc
Set swView = swDwg.GetFirstView
Set swView = swView.GetNextView
Set swAnnot = swView.GetFirstAnnotation3
While Not swAnnot Is Nothing
If swAnnot.GetType = swCenterMarkSym Then
Set swEnt = swAnnot.GetAttachedEntities3(0)
swEnt.Select4 True, Nothing
End If
Set swAnnot = swAnnot.GetNext3
Wend
End Sub
Sub main()
Dim swApp As SldWorks.SldWorks
Dim swDwg As SldWorks.DrawingDoc
Dim swAnnot As SldWorks.Annotation
Dim swView As SldWorks.View
Dim swEnt As SldWorks.Entity
Set swApp = Application.SldWorks
Set swDwg = swApp.ActiveDoc
Set swView = swDwg.GetFirstView
Set swView = swView.GetNextView
Set swAnnot = swView.GetFirstAnnotation3
While Not swAnnot Is Nothing
If swAnnot.GetType = swCenterMarkSym Then
Set swEnt = swAnnot.GetAttachedEntities3(0)
swEnt.Select4 True, Nothing
End If
Set swAnnot = swAnnot.GetNext3
Wend
End Sub