Create LeaderNote.FormattedText with Document Model properties

By Augusto Goncalves

I would like to set the FormattedText of the LeaderNote to something like:

"<Property Document=’model’ PropertySet=’Design Tracking Properties’ Property=’Part Number’ FormatID='{32853F0F-3444-11D1-9E93-0060B03C1CA6}’ PropertyID=’5′>PART NUMBER</Property>"

Is there a way to do this? Yes, the code below show a sample.

Sub CreateLN()

  If m_inventorApplication.Documents.Count = 0 Then Exit Sub

 

  If m_inventorApplication.ActiveDocument.DocumentType _

    <> DocumentTypeEnum.kDrawingDocumentObject Then Exit Sub

 

  Dim oDoc As DrawingDocument

  oDoc = m_inventorApplication.ActiveDocument

  Dim s As String

  s = "<Property Document=’model’ " _

    & "PropertySet=’Design Tracking Properties’ " _

    & "Property=’Part Number’ " _

    & "FormatID='{32853F0F-3444-11D1-9E93-0060B03C1CA6}’ " _

    & "PropertyID=’5′>PART NUMBER</Property>"

 

  ‘ Create a DrawingView on this Sheet and 

  ‘ the first DrawingCurve is line curve.

  Dim oGI As GeometryIntent

  oGI = oDoc.ActiveSheet.CreateGeometryIntent( _

    oDoc.ActiveSheet.DrawingViews(1). _

    DrawingCurves.Item(1), _

    PointIntentEnum.kStartPointIntent)

  Dim oObjCol As ObjectCollection

  oObjCol = m_inventorApplication.TransientObjects. _

    CreateObjectCollection

  oObjCol.Add(oGI)

 

  Dim oLN As LeaderNote

  oLN = oDoc.ActiveSheet.DrawingNotes. _

    LeaderNotes.Add(oObjCol, s)

End Sub


Comments

Leave a Reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading