- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Community,
I have an Inventor 2019 drawing from which I am extracting a Parts List and a drawing note to an Excel spreadsheet using iLogic.
The parts list extraction works well. (a Community solution)
I have challenges with the drawing note due to existence and lack of formatting.
Here is the note as it appears in the drawing:
Once I extract the GeneralNote from the drawing, I can access the properties, FormattedText and Text.
Here are their values:
FormattedText = "<StyleOverride Font='Tahoma' Bold='True'>B = TO BE BURNED W = WATERJET</StyleOverride><Br/><StyleOverride Font='Tahoma'> </StyleOverride><Br/><StyleOverride Font='Tahoma' Bold='True' Underline='True'>NOTES:</StyleOverride><Br/><Numbering Format='1'><StyleOverride Font='Tahoma'>ALL DIMENSIONS ARE IN INCHES</StyleOverride></Numbering><Numbering Format='1'><StyleOverride Font='Tahoma'>DIMENSION TOLERANCE ±0.03</StyleOverride></Numbering><Numbering Format='1'><StyleOverride Font='Tahoma'>BREAK ALL SHARP EDGES</StyleOverride></Numbering>"
Text = "B = TO BE BURNED W = WATERJETNOTES:1." & vbTab & "ALL DIMENSIONS ARE IN INCHES2." & vbTab & "DIMENSION TOLERANCE ±0.033." & vbTab & "BREAK ALL SHARP EDGES"
The FormattedText property string appears to contain XML formatting as denoted by the open/close angle brackets.
The Text property does not contain line breaks, which seems unusual, so I can't use that property to get the note.
Therefore, I am parsing the FormattedText string searching for the <Br/> code. This gets split into a string array.
Next I will have to search for the <Numbering Format='1'> code to convert these to 1., 2., 3., etc.
I have a portion of the code below along with some extra lines for debugging.
Sub ParseNote(oNote As String) break ' oNote = oNote.ToString Dim OffsetIndex As Integer = 1 Dim oDelimBrcktOpn As String = "<" Dim oDelimBrcktCls As String = ">" While Strings.InStr(OffsetIndex, oNote, oDelimBrcktOpn) Dim oPosBrcktOpn As Integer = Strings.InStr(OffsetIndex, oNote, oDelimBrcktOpn) Dim oPosBrcktCls As Integer = Strings.InStr(oPosBrcktOpn + 1, oNote, oDelimBrcktCls) Try If (oPosBrcktOpn > 0) And (oPosBrcktCls > 0) Then ' MsgBox(Strings.Mid(oNote, oPosBrcktOpn, (oPosBrcktCls - oPosBrcktOpn) + 1)) ' MsgBox("Before:" & vbLf & oNote) Dim oTemp4 As String = Strings.Mid(oNote, oPosBrcktOpn, ((oPosBrcktCls - oPosBrcktOpn) + 1)) If oTemp4 <> "<Br/>" Then dim oTemp5 as string = Strings.Mid(oNote, oPosBrcktOpn, ((oPosBrcktCls - oPosBrcktOpn) + 1)) = "^" End If ' MsgBox("After:" & vbLf & oNote) ' Dim StringPart As String = Mid(MyString, InStr(MyString, " "), InStr(MyString, ",") - InStr(MyString, " ")) End If Catch end try OffsetIndex = Math.Max(oPosBrcktOpn, OffsetIndex + 1) End While Dim oDelimBr As String = "<Br/>" oDrawNotes = Strings.Split(oNote, oDelimBr) End Sub
Is this the best method to parse and format a general note from an Inventor drawing?
Could there be an XML-processing tool or method available for iLogic (VB)?
Thank you for your time and attention. I look forward to your replies.
Kind regards,
Jerry
P.S. - I will be attending a FIRST Robotics Regional event on Friday, so any replies from me may be delayed.
CAD Administrator
Using AutoCAD & Inventor 2025
Autodesk Certified Instructor
Autodesk Inventor 2020 Certified Professional
Autodesk AutoCAD 2017 Certified Professional
Solved! Go to Solution.