Inserting Counter Bore & Depth symbols in Hole Note

Inserting Counter Bore & Depth symbols in Hole Note

shunmuga_maheswaran
Participant Participant
489 Views
9 Replies
Message 1 of 10

Inserting Counter Bore & Depth symbols in Hole Note

shunmuga_maheswaran
Participant
Participant

I am looking out for a way to include AIGDT symbols for CounterBore & Hole Depth within HoleNotes.Formatted Text.. I need the dimension to be shown as shown in image 1. I used StyleOverride command as suggested from various reference. But I could get only as shown in image 2. Below is my code. Can someone help me please.

 

 

 

Dim BottomHoleLoc = View2.SheetPoint(0.4, .05)
Dim BottomHoleIntent = oSheet.CreateGeometryIntent(BottomHoleEdge, BottomHoleEdge.EndPoint)
Dim BottomHoleNote = HoleNotes.Add("Bottom Hole Note", BottomHoleLoc, BottomHoleIntent)
BottomHoleNote.NativeEntity.FormattedQuantityNote = "<QTY>X"
BottomHoleNote.NativeEntity.FormattedHoleThreadNote = "<<QTYNOTE> <StyleOverride Font='AIGDT'>x</StyleOverride> <CBDIA> <StyleOverride Font='AIGDT'>v</StyleOverride><CBDPT>" & vbCrLf & "Ø<HDIA> THRU"

 

0 Likes
490 Views
9 Replies
Replies (9)
Message 2 of 10

WCrihfield
Mentor
Mentor

Usually the best suggestion in complex drawing note formatting scenarios is to first do it manually, then reverse engineer it by accessing that existing manually created note, and inspecting its FormattedText, and maybe even copying its contents into the appropriate portion of your code.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 3 of 10

lauri_barnhart
Autodesk
Autodesk

@shunmuga_maheswaran - Welcome! Thanks for your question.

 

Did the post by @WCrihfield help you and answer your question?

 

If this helps, feel free to accept it as the solution.

 

This helps other users benefit from the shared solution.

 

If you still require support, please post an update so we can assist you further.

 

Regards,

 


Lauri | Community Manager
0 Likes
Message 4 of 10

shunmuga_maheswaran
Participant
Participant

Well, it doesn't work that way. These symbols will convert themselves into 'v' 'x' or 'n' when we copy paste. These are AIGDT font, but unfortunately we can't call for Styleoverride within the Hole callout

0 Likes
Message 5 of 10

WCrihfield
Mentor
Mentor

Hi @shunmuga_maheswaran.  If you are not able to create the hole note manually, then edit its text manually using the Format Text dialog to get it the way you want, then reverse engineer it by inspecting its HoleThreadNote.FormattedQuantityNote and HoleThreadNote.FormattedHoleThreadNote values afterwards by code, then I also have one other suggestion you could try.  You could either modify your current DimensionStyle, or create an alternate DimensionStyle, and change its settings for that specific hole note scenario to meet your needs, then simply apply that DimensionStyle to the HoleThreadNote when or after you create it by code (HoleThreadNote.Style).  

DimensionStyle.GetHoleThreadNoteOptionValue 

DimensionStyle.SetHoleThreadNoteOptionValue 

WCrihfield_0-1779189671530.png

 

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 6 of 10

shunmuga_maheswaran
Participant
Participant

For the first option, it doesn't copy as the way it shows. It copies like this.

"<QTYNOTE> v Ø<CBDIA> x <CBDPT>"

 That is the problem

 

Secondly, changing the dimension style is the best option I agree. I can set a new dimension style for that one hole so that doesn't affect other holes. I have some restriction to move away from company set standards and if someone wants to copy this code and work on his Inventor, this may fail. That is the reason I am looking for an inherent option within ilogic itself.

 

Currently, I am doing the manual work after running the code.

0 Likes
Message 7 of 10

WCrihfield
Mentor
Mentor

I just did a little local testing by creating a counter bored thru hole with no threads in a part, then making a view of it in a drawing, then attaching a HoleThreadNote to it.  Then I created myself a quickie little iLogic rule to check its formatted text property values.  The iLogic rule I used is below:

Dim oPickedObj = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kDrawingDefaultFilter, "Pick HoleThreadNote")
Dim oHTN As Inventor.HoleThreadNote = TryCast(oPickedObj, Inventor.HoleThreadNote)
If oHTN Is Nothing Then Return
Logger.Info("HoleThreadNote.FormattedQuantityNote:" & vbCrLf & _
oHTN.FormattedQuantityNote)
Logger.Info("HoleThreadNote.FormattedHoleThreadNote:" & vbCrLf & _
oHTN.FormattedHoleThreadNote)

Oddly enough, even though it is technically a type of DrawingNote, which is also 'derived' from a DiameterGeneralDimension, setting the SelectionFilterEnum to either kDrawingNoteFilter or kDrawingDimensionFilter would not work, so I had to use the kDrawingDefaultFilter variation to be able to select it.  Before any modifications, my note looked like this:

WCrihfield_0-1779193095130.png

WCrihfield_1-1779193362128.png

 

The value of its FormattedQuantityNote was the following:

(x<Quantity/>)

Then the value of its FormattedHoleThreadNote was the following:

<StyleOverride Font='AIGDT' FontSize='0.254'>n</StyleOverride><StyleOverride FontSize='0.254'><HoleProperty HolePropertyID='kHoleDiameterHoleProperty' Precision='4' AlternatePrecision='4' SetTolerances='False'></HoleProperty> </StyleOverride><StyleOverride Font='AIGDT' FontSize='0.254'>x</StyleOverride><StyleOverride FontSize='0.254'> <HoleProperty HolePropertyID='kHoleDepthHoleProperty' Precision='2' AlternatePrecision='2' SetTolerances='False'></HoleProperty></StyleOverride><Br/><StyleOverride Font='AIGDT' FontSize='0.254'>v</StyleOverride><StyleOverride FontSize='0.254'> </StyleOverride><StyleOverride Font='AIGDT' FontSize='0.254'>n</StyleOverride><StyleOverride FontSize='0.254'><HoleProperty HolePropertyID='kCBoreDiameterHoleProperty' Precision='2' AlternatePrecision='2' UpperTolerance='0.000000' LowerTolerance='0.000000' ToleranceType='kSymmetricTolerance' TolerancePrecision='2' ToleranceAlternatePrecision='2'></HoleProperty> </StyleOverride><StyleOverride Font='AIGDT' FontSize='0.254'>x</StyleOverride><StyleOverride FontSize='0.254'> <HoleProperty HolePropertyID='kCBoreDepthHoleProperty' Precision='2' AlternatePrecision='2' SetTolerances='False'></HoleProperty></StyleOverride>

 

So, there was a massive amount of 'formatting' being applied, which also included lots of mentions of that specific 'Font' AIGDT using the 'StyleOverrides'.  So, we should just be able to shuffle those derived data items around within the 'Edit Hole Note' dialog, so they are where we want them and click OK, then inspect the 'actual' resulting formatted text through though that FormattedHoleThreadNote property's value again.  This is the reason most folks do not want to invest too much time in attempting to manually edit the contents of FormattedText type property values.  They can get pretty overwhelming to look at and try to figure out if you are not familiar with XML tags or how it all works together.  Two different levels of 'formatting' nonsense to sift through.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 8 of 10

lauri_barnhart
Autodesk
Autodesk

Hello @shunmuga_maheswaran, we appreciate you posting your question.

 

Did the last post by WCrihfield help you and answer your question?

 

If this helps, feel free to accept it as the solution.

 

This helps other users benefit from the shared solution.

 

If the issue persists, let us know with an update so we can assist further.

 

Regards,

 


Lauri | Community Manager
0 Likes
Message 9 of 10

shunmuga_maheswaran
Participant
Participant

Well, this does not solve the problem either. If I break any of the format which is not needed, this breaks. Also I am looking for a simple straight forward solution, not this much long cumbersome one. 

0 Likes
Message 10 of 10

WCrihfield
Mentor
Mentor

Hi @shunmuga_maheswaran.  We all want the solutions to our Inventor automation/customization challenges to be simple and easy, but unfortunately sometimes no simple or easy solution exists, or at least no one seems to know of one.  That is often the case when attempting to modify 'formatted text' in drawing annotations.  The manual dialogs for editing them often have tons of controls and settings built into them for helping us edit that type of stuff, but attempting to do the same things by code can be incredibly complex, and require way more code that it seems like it should.  If you only wanted to insert a couple special characters in a customized hole note once in a while, we could use the 'Edit Hole Note' dialog and the 'Insert Symbol' control, as seen in the screen captured image below.  However, if trying to do that entirely by code, we first need to retrieve the existing value of the 'FormattedHoleThreadNote' property, then edit that very long, complex looking String value by inserting something similar to the following:

"<StyleOverride Font='AIGDT' FontSize='0.254'>n</StyleOverride>"

...in the correct location(s), to insert the diameter symbol.  The 'Font' portion of that is obviously important, but the 'FontSize' spec is usually filled in based on the current/active DimensionStyle for that specific scenario of a HoleThreadNote, unless modified directly within the 'Edit Hole Note' dialog.  Some of those placeholder entities within the overall note, even though they may look very short & simple within the 'Edit Hole Note' dialog, there will be far longer and much more complex String within that one property behind the scenes for it, because things like precision, tolerance type, and tolerance precision, and alternate precisions are also being dictated within some of them.  This is why often the quickest way to get the exact String value you want to use within an iLogic rule is to do the edits manually, within the dialog, then get the value of that FormattedHoleThreadNote property afterwards, and copy it into the iLogic rule that is supposed to help repeat that step next time.  But just like in the 'Styles Editor' dialog when editing those styles for HoleThreadNotes, there is a long scrolling list of possible scenarios to choose from, and each would likely require a different custom formatted text String.

What I often do in situations like that, depending on the scope of the issue and/or how often it is required, is to create one or more alternate DimensionStyles (I have a list of them), where each DimensionStyle has different settings, for different situations.  Then whenever needed, either switch to one of the alternate styles before placing a new dimension annotation, or select one or more existing drawing annotations, then choose the alternate style on the Annotate tab's 'Format' panel, to switch them to that style later.

Even if I created a similar looking part, and created a similar looking HoleThreadNote, then captured its formatted text to post here, it would still not be accurate enough for you to use directly, because I may be using different Fonts, FontSizes, Units, Precision, Tolerances, Tolerance Precision, Alternate Precision/Tolerance settings, and so on.

WCrihfield_0-1780315448509.png

In the example code I posted in Message 7, you could replace the 'Logger' stuff with an 'InputBox' instead.  Within the 'inputs' of the InputBox is a parameter named 'DefaultResponse'.  You can fill that in with the current value of that 'FormattedHoleThreadNote' property, so that its text will be showing within the selectable & editable TextBox area of that dialog when it shows.  Unfortunately, that dialog only allows a single line of text, so it will be really long.  It will let you edit its value, either directly within that dialog, or you could select & copy its value into a new/empty Notepad, then edit it, then copy & paste the edited value back into that InputBox.  That InputBox can be used to set the value of a String type variable in a rule.  Then that String type variable could be set as the new value of that property.    Just throwing some ideas out there trying to help.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes