Drawing HoleThreadNote Formatted Text Bug Precision and Tolerance when not set.

Drawing HoleThreadNote Formatted Text Bug Precision and Tolerance when not set.

g.georgiades
Advocate Advocate
380 Views
7 Replies
Message 1 of 8

Drawing HoleThreadNote Formatted Text Bug Precision and Tolerance when not set.

g.georgiades
Advocate
Advocate

I have found myself delving into processing HoleTheadNotes. However it is proving quite frustrating due to an inherit bug in the way the API is returning the FormattedHoleThreadNote text. (And the way inventor processes xml, but that is anothe story)

 

There have been a few posts over the years about a bug where accessing the HoleThreadNote.FormattedHoleThreadNote has some weird precision and tolerance data even if this data is unset.

 

Here are a few posts talking about it - there is even an old bug filed in one these.

https://forums.autodesk.com/t5/inventor-programming-ilogic/problem-with-appending-anything-to-drawin...

https://forums.autodesk.com/t5/inventor-programming-ilogic/it-bugs-or-still-need-user-define-quot-fo...

https://forums.autodesk.com/t5/inventor-programming-ilogic/hole-style-find-settings-in-saved-drawing...

https://forums.autodesk.com/t5/inventor-programming-ilogic/modify-holethreadnotes/m-p/6474972

https://forums.autodesk.com/t5/inventor-programming-ilogic/what-s-the-holethreadnote-text-format/m-p...

https://forums.autodesk.com/t5/inventor-programming-ilogic/adding-quantitynote-to-holethreadnote-in-...

 

 

For testing, I have code that simply sets hole formatted text to itself... The expected behavior is that nothing happens. But in specific situations, the precisions and tolerances change on it.

 

For my use (Inventor 2025.2.1) I have narrowed down the issue to only counter bores and counter sinks - the type of hole does not matter (blind, thru, threaded, etc.) Simply the prescence of the <CBDIA> or <CSDIA> parameters in the note GUI will cause this issue even if the underlying hole does not have the feature(s).

 

I think this bug has been partially fixed a few times since in some of the above posts, it was happening for more parameters than just the two I've mentioned?

 

 

For counterbores or countersinks I expect the formatted text to say this

<HoleProperty HolePropertyID='kCBoreDiameterHoleProperty'
				  SetTolerances='False'/>

but this is incorrectly returned instead

<HoleProperty HolePropertyID='kCBoreDiameterHoleProperty'
	              Precision='2'
	              AlternatePrecision='2'
	              UpperTolerance='0.000000'
	              LowerTolerance='0.000000'
	              ToleranceType='kSymmetricTolerance'
	              TolerancePrecision='2'
	              ToleranceAlternatePrecision='3'/>

Essentially the when reading the hole property, the api believes Use Global Precision is unchecked, and the feature tolerance is checked even though they are not.

 

If I programamtically set the FormattedHoleThreadText to

<HoleProperty HolePropertyID='kCSinkDiameterHoleProperty'
	              SetTolerances='False'/>

It correctly sets the precision with no tolerance, but accessing the formatted text again returns the incorrect attributes like before.

 

From what i can tell, if the user has manually input a tolerance, or unchecked use global precision, it does not override the user's values. It is only an issue when either is unset.

 

There seems to be a disconnect between how the API is reading the hole note and how it actually is.

 

The way the holethreadnote determines whether Use Global Precision is checked or not is determined if any of the HoleProperties have custom precision, then they all will be set when re-setting the formatted text via API. This is why the precision changes for all values when setting the Formatted Text to itself.

 

I have attached a sample part and drawing with an ilogic sample that takes the selected Hole Note and sets its value to itself. Holes with <CBDIA> and <CSDIA> change. Other holes do not change from what I can tell.

 

What does this mean for me today?

I have been writing methods to take any formatted note and convert it to a single line while retaining symbols, spacing, etc. Just accessing the note.Text for a note puts everything on a single line, but it does not add spaces, and it does not handle the AIGDT font. I have been successful in converting general notes, dimension text, view labels, and feature control frame text. But for hole notes, because of this bug, its going to be a lot harder... I think I will have to set the hole note formatted text to one parameter at a time and check the note.Text values and swap them into the formatted text or something...

 

@MjDeck

 

 

0 Likes
381 Views
7 Replies
Replies (7)
Message 2 of 8

C_Haines_ENG
Collaborator
Collaborator

I call it: Good Enough

 

Sub Main

	Dim sel As SelectSet = Thisdoc.Document.SelectSet

	If sel.Count = 0 OrElse typeof sel.Item(1) IsNot HoleThreadNote
		MsgBox("Please select a HoleThreadNote and only a HoleThreadNote!")
		Exit Sub
	End If

	Dim note As HoleThreadNote = ThisDoc.Document.SelectSet.Item(1)
	Dim noteText = note.FormattedHoleThreadNote

	System.Windows.Forms.Clipboard.SetText(note.FormattedHoleThreadNote)

	If note.FormattedHoleThreadNote.Contains("CBoreDiameter")

		noteText = "<StyleOverride Font='RomanD' FontSize='0.254'><HoleProperty HolePropertyID='kCBoreDiameterHoleProperty' Precision='3' AlternatePrecision='3' SetTolerances='False'></HoleProperty></StyleOverride>"

	Else

		noteText = "<StyleOverride Font='RomanD' FontSize='0.254'><HoleProperty HolePropertyID='kHoleDiameterHoleProperty' Precision='3' AlternatePrecision='3' SetTolerances='False'></HoleProperty></StyleOverride>"

	End If

	note.FormattedHoleThreadNote = noteText

End Sub

.

Truly is just a formatting nightmare, it looks like if you declare it as a "StyleOverride" then it doesn't try to shoe in its stupid tolerances. Hope this works. 

0 Likes
Message 3 of 8

g.georgiades
Advocate
Advocate

Thank you for poking at this.. I have a feeling it will be more complicated than what you suggest, but I appreciate anyone trying to help decode Inventors weird xml handling.

 

I did not see any difference whether the hole note has a style override at the start - are you using Inventor 2025?

 

By having

Precision='3' AlternatePrecision='3'

hard coded in the xml attributes, it behaves as if "Use Global Tolerance" is unchecked whther it is or not.

 

I will have to check for the precense of these attributes in all of the hole parameters to see whether the checkbox is actually checked or not. Then I can check each parameter individually and either read or ignore the attributes based on the global determination.

 

It will be the same boat for checking if the tolerance checkbox is checked - I will just check if both tolerance bounds are zero, then assume the box is supposed to be unchecked.

 

I could probably only look at c'bore or c'sink, but I may check all parameters because I have had issues with older drawings behaving strangely in the past.

0 Likes
Message 4 of 8

C_Haines_ENG
Collaborator
Collaborator

I was testing this on Inventor 2025, and everything worked fine for me. It resulted in the hole size by itself to 3 decimal precision.

 

Maybe upload some screenshots of before and after?

0 Likes
Message 5 of 8

g.georgiades
Advocate
Advocate

So I have no issues with setting the hole formatted text and getting the expected result - the issue is with reading the hole formatted text and getting a result that is not exepected

 

If I set the formatted text to

		noteText = "<StyleOverride Font='RomanD' FontSize='0.254'><HoleProperty HolePropertyID='kCBoreDiameterHoleProperty' Precision='3' AlternatePrecision='3' SetTolerances='False'></HoleProperty></StyleOverride>"

 

Then if I read it back it gives

<StyleOverride Font='RomanD' FontSize='0.254'><HoleProperty HolePropertyID='kCBoreDiameterHoleProperty' Precision='3' AlternatePrecision='3' UpperTolerance='0.000000' LowerTolerance='0.000000' ToleranceType='kSymmetricTolerance' TolerancePrecision='2' ToleranceAlternatePrecision='3'></HoleProperty></StyleOverride>

 

The inventor api added tolerance parameters even though it should not have.

 

 

Since I intend on reading any arbirary hole note - I will have to check and handle when it reads tolerances that are "fake".

0 Likes
Message 6 of 8

C_Haines_ENG
Collaborator
Collaborator

Yes its truly awful, I was scratching my head over it for quite a while. The issue I was having was that the hole notes would just add tolerances or round the number entirely. 

 

Clearly inventor has some background processes managing the formatted text. Maybe consider adding a new default style for hole notes and then use iLogic to switch between them?

0 Likes
Message 7 of 8

MjDeck
Autodesk
Autodesk

Thanks @g.georgiades for reporting this. The tolerance data shouldn't be there. I created internal issue INVGEN-82814. We should be able to fix it soon.


Mike Deck
Software Developer
Autodesk, Inc.

0 Likes
Message 8 of 8

g.georgiades
Advocate
Advocate

Hi @MjDeck 

 

I have finally got back around to this, and have found some other bugs when accessing hole thread notes. (Inv 2025.2.1)

 

The first one is GUI related - When the style is fraction, and the precision is 1/128. The gui does not display the correct value. But it looks like the displayed note is correct?

 

ggeorgiades_0-1754053273985.png ggeorgiades_2-1754053922791.png

 

 

The other bugs are when looking at the formatted text of a hole note only in a HoleTableCell, the returned xml is completely wrong compared to my original post. It adds the Precision attribute to all values regardless if use global precision is checked, it does not show tolerances, and for the hole property tags only, it replaces the apostrophes with the encoded version &apos;.

 

For that same hole above, the text value and xml is shown below.

It looks like the text sees the tolerances, but reading the xml has lost everything.

I was able to work around the bugs from my initial post for normal hole notes, but the precision attribute incorrectly added to all values and loosing all tolerance data completely kills my ability to process hole table holes... I can at least swap ` for ±, but deviation and limit tolerances are completely lost since they show up as \Z#;

Text Value: n1 1/4`1/2 x 15/16\Z0;v n\Z1; x 5/16`0

<StyleOverride Font='AIGDT' FontSize='0.254'>n</StyleOverride>
<StyleOverride Font='RomanD' FontSize='0.254'>
	<HoleProperty HolePropertyID=&apos;77581&apos; Precision=&apos;2&apos;></HoleProperty>
</StyleOverride>
<StyleOverride Font='AIGDT' FontSize='0.254'>x</StyleOverride>
<StyleOverride Font='RomanD' FontSize='0.254'>
	<HoleProperty HolePropertyID=&apos;77580&apos; Precision=&apos;2&apos;></HoleProperty>
</StyleOverride>
<Br/>
<StyleOverride Font='AIGDT' FontSize='0.254'>v</StyleOverride>
<StyleOverride Font='RomanD' FontSize='0.254'> </StyleOverride>
<StyleOverride Font='AIGDT' FontSize='0.254'>n</StyleOverride>
<StyleOverride Font='RomanD' FontSize='0.254'>
	<HoleProperty HolePropertyID=&apos;77570&apos; Precision=&apos;2&apos;></HoleProperty>
</StyleOverride>
<StyleOverride Font='AIGDT' FontSize='0.254'>x</StyleOverride>
<StyleOverride Font='RomanD' FontSize='0.254'>
	<HoleProperty HolePropertyID=&apos;77569&apos; Precision=&apos;2&apos;></HoleProperty>
</StyleOverride>

 

Also setting the cell formatted text to does not seem to affect the precision or tolerances displayed.

 

 

It took a while to be able to reliably decode arbiratry hole notes into these, so to be stopped at holetables is a bit saddening...

They are somewhat sparse where I am at, so its not the end of the world...

Ø1.25 +.0625|-.0013 [32 +1.588|-.034] ↧ .95±.01 [24±.152] TO FLAT BOTTOM ⌴ Ø 2.82 - 2.63 [71.526 - 66.751] ↧ .30±.000 [8±.000]
Ø15/16±0 [24±.254] ↧ 15/16 +17/128|+1/128 [24 +3.302|+.198] TO FLAT BOTTOM ⌴ Ø 3 13/64 - -2 1/2 [81.305 - -63.475] ↧ 5/16 +1|-1/2 [8 +27.940|-10.160]

 

0 Likes