Huibert Posted November 18, 2008 Share Posted November 18, 2008 I am writing a code for the insertion of a large number of dynamic blocks (up to 1000). Each of these blocks can have different dynamic block properties and attributes. My code works with an Excel file and a database where all the information is stored. The drawing can be changed and redrawn by changing the excel file. But I want, that if the drawing is changed in AUTOCad that the excelfile can be updated aswell. All dynamic blocks are an insertion of the dynamicblock "Poer". But i don't know how to search for this name as AutoCad creates new names for inserted dynamicblocks *U6 to *U1000. Question: How can I identify a blockreference if it is the insertion of dynamic block Poer? Friend Sub attributeextraction() Dim Poer As AcadBlockReference Dim Ent As AcadEntity Dim Layout As AcadLayout Dim Naam As String Dim Blockproperties() As AcadDynamicBlockReferenceProperty Dim Attributen() As AcadAttributeReference For Each Layout In ThisDrawing.Layouts If Layout.Name = "Model" Then For Each Ent In Layout.block If TypeOf Ent Is AcadBlockReference Then 'PROBLEM: I need to check if the Ent is the dynamic block "Poer" Set Poer = Ent For j = LBound(Attributen) To UBound(Attributen) Naam = Attributen(j).TagString 'code to be inserted Next j Blockproperties = Poer.GetDynamicBlockProperties Attributen = Poer.GetAttributes For j = LBound(Blockproperties) To UBound(Blockproperties) Naam = Blockproperties(j).PropertyName 'code to be inserted Next j End If Next End If Next End Sub In The properties list in AutoCad it states under misc>name "POER" but if I ask in the code Poer.name it gives *Uxx Quote Link to comment Share on other sites More sharing options...
Huibert Posted November 18, 2008 Author Share Posted November 18, 2008 the correct code (without the name check): Friend Sub attributeextraction() Dim Poer As AcadBlockReference Dim Ent As AcadEntity Dim Layout As AcadLayout Dim Naam As String Dim Blockproperties() As AcadDynamicBlockReferenceProperty Dim Attributen() As AcadAttributeReference For Each Layout In ThisDrawing.Layouts If Layout.Name = "Model" Then For Each Ent In Layout.block If TypeOf Ent Is AcadBlockReference Then 'PROBLEM: I need to check if the Ent is the dynamic block "Poer" Set Poer = Ent MsgBox Poer.Name Blockproperties = Poer.GetDynamicBlockProperties Attributen = Poer.GetAttributes For j = LBound(Blockproperties) To UBound(Blockproperties) Naam = Blockproperties(j).PropertyName 'code to be inserted Next j For j = LBound(Attributen) To UBound(Attributen) Naam = Attributen(j).TagString 'code to be inserted Next j End If Next End If Next End Sub Quote Link to comment Share on other sites More sharing options...
SEANT Posted November 18, 2008 Share Posted November 18, 2008 Try: MsgBox Poer.EffectiveName Quote Link to comment Share on other sites More sharing options...
Huibert Posted November 18, 2008 Author Share Posted November 18, 2008 That was exactly what I was looking for!! Thank you //Close thread Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.