streng Posted May 9, 2010 Share Posted May 9, 2010 Am trying to set attributes to a block prior to insertion but cannot figure out how to set attributes. Have worked with .getattributes but am unsure how to set them. Hope someone can help. Private Sub CommandButton4_Click() Dim Array1 As Variant Dim varInsertionPoint As Variant Unload Me With ThisDrawing.Utility varInsertionPoint = .GetPoint(, vbCr & "Pick The Insertion Point: ") End With 'Need to assign the following prior to inserting block Array1(0).TextString = TextBox1.Value Array1(0).color = ComboBox2.Value Array1(0).Layer = ComboBox1.Value Array1(1).TextString = TextBox2.Value Array1(1).Layer = ComboBox1.Value Array1(2).TextString = TextBox3.Value Array1(2).Layer = ComboBox1.Value ThisDrawing.ModelSpace.InsertBlock varInsertionPoint, "SRD20", 1, 1, 1, 0 End Sub Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted May 9, 2010 Share Posted May 9, 2010 My VBA is lacking, but maybe something like: Dim Insertion As Variant Dim BlockObj As AcadBlockReference Dim Attribs As Variant Dim K As Integer Set BlockObj = ThisDrawing.ModelSpace.InsertBlock(Insertion, "block", 1, 1, 1, 0) Attribs = BlockObj.GetAttributes For K = LBound(Attribs) to UBound(Attribs) Attribs(K).TextString = "Lee Mac" Next K Quote Link to comment Share on other sites More sharing options...
streng Posted May 9, 2010 Author Share Posted May 9, 2010 Thanks for your quick response, just what I needed Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted May 9, 2010 Share Posted May 9, 2010 You're welcome Streng, happy to help 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.