Message 1 of 19
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am trying to display the Tags and Values of an inserted AutoCAD block in an Inventor 2013 dwg. I am using .Net studio10.
I can list the properties of the block object but cannot get the "GetPromptTextValues" method to work. Problem is at the bottom of the code listed below.
Thanks,
Dave
' Connect to a running instance of Inventor. Dim invApp As Inventor.Application ' Check to see if a drawing is active invApp = System.Runtime.InteropServices.Marshal.GetActiveObject("Inventor.Application") If invApp.ActiveDocument.DocumentType <> Inventor.DocumentTypeEnum.kDrawingDocumentObject Then MsgBox("Need to have a drawing document active") Return End If ' Create ref to active drawing document Dim oDrawingDoc As Inventor.DrawingDocument oDrawingDoc = invApp.ActiveDocument ' Create ref to AutoCADBlocks collection in the active sheet Dim cAcadBlocks As Inventor.AutoCADBlocks cAcadBlocks = oDrawingDoc.ActiveSheet.AutoCADBlocks ' Get the name of the block Dim AcadBlockName As String AcadBlockName = cAcadBlocks.Item(1).Name Debug.Print(cAcadBlocks.Item(1).Name) ' Create ref to the AutoCAD block object in the active sheet Dim oAcadBlock As Inventor.AutoCADBlock oAcadBlock = cAcadBlocks.Item(AcadBlockName) ' check to see if block object code is working (it does) Debug.Print(oAcadBlock.Scale) Debug.Print(oAcadBlock.LineWeight) Debug.Print(oAcadBlock.Name) 'XXXXXXXXXXXXXXXXXXXX FAILS BELOW XXXXXXXXXXXXXXXXXXXXX ' Try and display block tags and values Dim sTags(10) As String Dim sAttr(10) As String oAcadBlock.GetPromptTextValues(sTags, sAttr) ' display attribute tag and value For i = 0 To 10 MsgBox(sTags(i) & " = " & sAttr(i)) Next
Solved! Go to Solution.