Message 1 of 6
Changing Hole Thread Precision works but not all the time Ilogic
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
here is the code I have so far:
'make selected dim reference existing data to string for hole callout call each one out to set it in memory
'and Then the only one that you wont Set Is precision.
Dim odim As DrawingDimension
Line1 :
'odim = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kDrawingDimensionFilter, "Select Dimension")
odim = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kAllEntitiesFilter, "Select Dimension")
'MsgBox(TypeName(odim))
If odim Is Nothing Then
Exit Sub
Else
odim.Precision = 3
'odim.TolerancePrecision = 0
If TypeOf odim Is HoleThreadNote = True Then
Dim oHNote As HoleThreadNote = odim
'MsgBox(oHNote.FormattedHoleThreadNote, , "")
'a = InputBox("","FormattedHoleThreadNote", oHNote.FormattedHoleThreadNote)
a = oHNote.FormattedHoleThreadNote
'oHNote.FormattedHoleThreadNote = "<HoleProperty HolePropertyID='kHoleDiameterHoleProperty' Precision='3' AlternatePrecision='3'</HoleProperty>"
Dim TXT2Find As String = "Precision='2'"
Dim NewTXT As String = "Precision='3'"
'odim.OverrideModelValue = 0
If a Like NewTXT Then
MsgBox("nothing changed")
Exit Sub
Else
a = Replace(a, TXT2Find, NewTXT)
End If
'If TXT2Find = "Precision='2'" Then
'a.Replace = "Precision='3'"
'End If
'MsgBox(a)
oHNote.FormattedHoleThreadNote = a
End If
End If
GoTo Line1
If anyone can help me figure out what is wrong that would be amazing.
I know this question has been asked here for ages without a solution. Here I present to you a solution which could be better but at least it shows a method on how to do it. I just don't have the time to figure out all the bugs.
cleaned up code
Dim odim As DrawingDimension
Line1 :
odim = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kAllEntitiesFilter, "Select Dimension")
If odim Is Nothing Then
Exit Sub
Else
odim.Precision = 3
If TypeOf odim Is HoleThreadNote = True Then
Dim oHNote As HoleThreadNote = odim
a = oHNote.FormattedHoleThreadNote
Dim TXT2Find As String = "Precision='2'"
Dim NewTXT As String = "Precision='3'"
'odim.OverrideModelValue = 0
If a Like NewTXT Then
MsgBox("nothing changed")
Exit Sub
Else
a = Replace(a, TXT2Find, NewTXT)
End If
oHNote.FormattedHoleThreadNote = a
End If
End If
GoTo Line1
-Max