Cancel
Showing results for 
Search instead for 
Did you mean: 

Test if a dimension connect to male\female thread

Creator
Creator

Hello,

I'm trying to find if a dimension in a draft in connected to a male of female thread.

I have a "draft standard" macro that scans all the dimensions in a draft and change the round off and colors according to the internal standard in the site.

I wish to use this macro to add "-2A" to a male thread text and "-2B" to a female (add to the "4-40 UNC" text that gets from the "%TS"), but I could not find how to get from the dimension object to the information of it's source feature in the part file.

Can this be done using API?
attached a small portion of my code that scans the dimensions.

Thanks,
    Zohar

 

Option Explicit On

Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim objApp As SolidEdgeFramework.Application
        Dim objDocD As SolidEdgeDraft.DraftDocument
        Dim ObjActiveSheet As SolidEdgeDraft.Sheet
        Dim dima As SolidEdgeFrameworkSupport.Dimension

        On Error Resume Next 'connect to SE
        objApp = GetObject(, "SolidEdge.Application")
        If Err.Number Then
            Err.Clear()
            MsgBox("Solid Edge in not open" & vbNewLine & "Macro aborting.")
            End
        End If
        On Error Resume Next 'against no active doc
        If objApp.ActiveDocumentType <> SolidEdgeFramework.DocumentTypeConstants.igDraftDocument Then
            MsgBox("current sheet must be a draft view." & vbNewLine & "Macro Aborting.")
            End
        Else
            objDocD = objApp.ActiveDocument
        End If
        On Error GoTo 0
        ObjActiveSheet = objDocD.ActiveSheet

        For Each dima In ObjActiveSheet.Dimensions

            'test if this is an angular dimension
            If dima.PrefixString = "%TS" Then
                MsgBox("how can I connect to the model and find if this a male or female thread")
                ' i wish to add "-2A" to a male thread or "-2B" to a feamale
            End If
        Next
        End
    End Sub
End Class

 

 

1 REPLY

Re: Test if a dimension connect to male\female thread

Gears Honored Contributor Gears Honored Contributor
Gears Honored Contributor

Very few or almost no methods exist that map graphics members from the model into the Draft Document.