editing attribute set of an imported AutoCAD Block

editing attribute set of an imported AutoCAD Block

mostafamahmoudseddek94
Advocate Advocate
406 Views
2 Replies
Message 1 of 3

editing attribute set of an imported AutoCAD Block

mostafamahmoudseddek94
Advocate
Advocate

Hi

I imported the company Title Block to my Drawing file inside Inventor. It is an AutoCAD title Block that contains Attributes to be filled as shown. I can easily fill those attributes in inventor just by clicking the right click and select " Edit Attribute Set" command. There are tons of Drawings to fill their title block.

mostafamahmoudseddek94_0-1626074753372.png

 

I want to add these values automatically by inventor API. Unfortunately. When I tried to do it by my self, my code shows me that it counted 0 Attribute set for this block .

Sub TitleBlockAttributes()
' Set a reference to the drawing document.
' This assumes a drawing document is active.
    
    Dim oDrawDoc As DrawingDocument
    Set oDrawDoc = ThisApplication.ActiveDocument
       
' ' Set a reference to the drawing Sheet NO.1

    Dim oSheet As Sheet
    Set oSheet = oDrawDoc.Sheets.Item(1)
' Obtain a reference to the desired AutoCAD block definition.

    Dim oBlockDef As AutoCADBlockDefinition
    Set oBlockDef = oDrawDoc.AutoCADBlockDefinitions.Item("REDECAM-TITOLO-TAVOLA")
    MsgBox (oBlockDef.AttributeSets.Count)

End Sub
0 Likes
407 Views
2 Replies
Replies (2)
Message 2 of 3

wgraham
Advocate
Advocate

Inventor typically uses AttributeSets/Attributes to store custom data via the API and likely doesn't correlate to the concept of block attributes in ACAD.  Taking a quick peak at the API documentation, try using GetPromptTags method to view the prompts and values.  Don't be surprised if the values can be read but not modified via the API.  Generally speaking, I would recommend converting the ACAD title block to an Inventor title block that allows mapping to iProperties and gives quite a bit more flexibility for editing via the API.

0 Likes
Message 3 of 3

mostafamahmoudseddek94
Advocate
Advocate

Hi, Thanks for your informative, helpful comment. How to convert my AutoCAD block to Inventor one.

0 Likes