Page 1 of 1

Need to determine the value of DIM with attached GTOL

Posted: Mon May 06, 2024 4:01 pm
by loeb
Given a selected GTOL frame, I need to determine the value of the DIM that the GTOL is attached to. It's easy enough to get the properties of a GTOL frame, and I can determine if it's attached to something, but getting the dimension itself is eluding me.

Thanks,

Re: Need to determine the value of DIM with attached GTOL

Posted: Mon May 06, 2024 5:37 pm
by josh

Code: Select all

Dim swApp As SldWorks.SldWorks
Dim swDoc As SldWorks.ModelDoc2
Dim swAnn As SldWorks.Annotation
Dim vEnts As Variant
Dim swDisp As SldWorks.DisplayDimension
Dim swGtol As SldWorks.Gtol
Sub main()
    Set swApp = Application.SldWorks
    Set swDoc = swApp.ActiveDoc
    Set swGtol = swDoc.SelectionManager.GetSelectedObject6(1, -1)
    Set swAnn = swGtol.GetAnnotation
    vEnts = swAnn.GetAttachedEntities3
    Set swDisp = vEnts(0)
    Debug.Print swDisp.GetDimension2(0).Value
End Sub