ANDREWPCX Posted February 26, 2010 Posted February 26, 2010 I want to edit the insertion point of multiple block references. I've been trying to edit them using this code: Private Sub FINDMARQBOOKINLAYOUTS() Dim OBJLAYOUT As AcadLayout Dim AOBJ As AcadEntity Dim MARK As AcadBlockReference Dim INSSTR As String Dim ATTDATE As String Dim LAYOUTNAME As String Dim INSPOINT(0 To 2) As Variant ThisDrawing.SetVariable "REGENMODE", 0 INSPOINT(0) = -0.125 INSPOINT(1) = -0.125 INSPOINT(2) = 0 For Each OBJLAYOUT In ThisDrawing.Layouts If OBJLAYOUT.Name = "Model" Then Else ThisDrawing.ActiveLayout = OBJLAYOUT LAYOUTNAME = OBJLAYOUT.Name 'COUNT1 = COUNT1 + 1 ' THIS IS JUST FOR VERIFICATION 'START BLOCK ITERATION For Each AOBJ In ThisDrawing.ActiveLayout.Block If TypeOf AOBJ Is AcadBlockReference Then If AOBJ.Name = "MARQ-BOOK" Then Set MARK = AOBJ MARK.InsertionPoint(0) = INSPOINT(0) MARK.InsertionPoint(1) = INSPOINT(1) MARK.InsertionPoint(2) = INSPOINT(2) INSSTR = INSSTR & "(" & MARK.InsertionPoint(1) & "," & MARK.InsertionPoint(1) & "," & MARK.InsertionPoint(2) & ")" End If End If Next AOBJ End If Next OBJLAYOUT ThisDrawing.SetVariable "REGENMODE", 1 MsgBox INSSTR Unload Me End Sub This macro iterates the Layouts, finds an specific block reference and then my attempt is to change its insertion point property, but i haven't been able to do it. I know i'm missing something, but can't find what. I'd appreciate some help on this. Quote
ANDREWPCX Posted February 26, 2010 Author Posted February 26, 2010 please someone answer my question Quote
SEANT Posted February 26, 2010 Posted February 26, 2010 I modified you’re a routine a bit, for testing purposes. See if this works any better. Sub FINDMARQBOOKINLAYOUTS() Dim OBJLAYOUT As AcadLayout Dim AOBJ As AcadEntity Dim MARK As AcadBlockReference Dim INSSTR As String Dim ATTDATE As String Dim LAYOUTNAME As String Dim INSPOINT(0 To 2) As Double 'Dim as double array ThisDrawing.SetVariable "REGENMODE", 0 INSPOINT(0) = -0.125 INSPOINT(1) = -0.125 INSPOINT(2) = 0 For Each OBJLAYOUT In ThisDrawing.Layouts If OBJLAYOUT.Name <> "Model" Then ThisDrawing.ActiveLayout = OBJLAYOUT LAYOUTNAME = OBJLAYOUT.Name 'COUNT1 = COUNT1 + 1 ' THIS IS JUST FOR VERIFICATION 'START BLOCK ITERATION For Each AOBJ In ThisDrawing.ActiveLayout.Block If TypeOf AOBJ Is AcadBlockReference Then If AOBJ.Name = "MARQ-BOOK" Then Set MARK = AOBJ MARK.InsertionPoint = INSPOINT 'reset insertion point INSSTR = INSSTR & "(" & MARK.InsertionPoint(1) & "," & MARK.InsertionPoint(1) & "," & MARK.InsertionPoint(2) & ")" End If End If Next AOBJ End If Next OBJLAYOUT ThisDrawing.SetVariable "REGENMODE", 1 MsgBox INSSTR End Sub Quote
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.