Problems augmenting thread/hole callouts with ThreadInfo object

Problems augmenting thread/hole callouts with ThreadInfo object

Anonymous
Not applicable
183 Views
0 Replies
Message 1 of 1

Problems augmenting thread/hole callouts with ThreadInfo object

Anonymous
Not applicable

Hello,

 

I'm trying to augment thread/hole callouts programatically and I've run up against a couple issues. Running the "test" script in the attached .dwg should add the major diameter to each callout where applicable.

 

One of the issues involves hole callouts without threading. This may simply be my inexperience with VBA and trying to test for the existence of members in objects.

 

The second issue is a little stranger. The top left-most callout should have a ThreadInfo object associated with it, but apparently does not.

 

Here is the content of the script attached in the local iLogic rules:

 

Public Sub Main()
  Dim invDWG As Document
  Dim invHoleThreadNote As Object
  Dim threadInfo As ThreadInfo

  invDWG = ThisApplication.ActiveDocument

  For i = 1 To invDWG.ActiveSheet.DrawingNotes.HoleThreadNotes.Count
    Do

      invHoleThreadNote = invDWG.ActiveSheet.DrawingNotes.HoleThreadNotes(i)
      On Error GoTo ThreadInfoAbsent
      Select Case invHoleThreadNote.Edge.Type
      Case = "117473792" ' axial/DrawingCurve obj
        threadInfo = invHoleThreadNote.Edge.ModelGeometry.ThreadInfos(1)
      Case = "117474048" ' profile/'Edge' obj
        threadInfo = invHoleThreadNote.Edge.Geometry.ModelGeometry.ThreadInfos(1)
      Case Else
        ThreadInfoAbsent :
        Resume Here
        Here :
        Exit Do
      End Select
      invHoleThreadNote.Text.FormattedText = invHoleThreadNote.Text.FormattedText & vbCrLf & threadInfo.MinorDiameterMax

    Loop While False
  Next i
End Sub

 

Any help would be much appreciated.

 

Thanks

0 Likes
184 Views
0 Replies
Replies (0)