Results 1 to 2 of 2

Thread: Order blocks for editing

  1. #1
    100 Club
    Join Date
    2007-07
    Posts
    104
    Login to Give a bone
    0

    Default Order the blocks before editing

    The Case, I have 2 kinds of blocks in a drawing:
    - 1 for revising the the drawing,
    - 1 for design information. The block with the designinformation also has the drawingframe attached to it.
    The design infoblock contains 1 attribute that needs to be updated when a revision is added in the "revision block". Sometimes a series of these "block couples" are added in modelspace, and they could even be in paperspace. To me this is all very messy and inefficient. But I am not at liberty to change these conditions.

    So the question is, how do I go about updating the designblock when a new revision is added in the revisionblock (by VBA)?
    - I've noticed that VBA program seems to select the blocks in a random order, so I can't ignore the selection order and suppose all will go well automatically.
    - As the above suggests, reading the insertionpoints into a collection doesn't give me the right order of the blocks either. Ordering the "insertionpoints" in the collection seems a bit difficult too. I got this so far, but I got discouraged and stopped (Maybe someone knows how to order these coords? Then that gives me the right blockorder too) :
    Code:
    Public Sub GetInsPnts()
    
    Dim BlkRef As AcadBlockReference
    Dim Layt As AcadLayout
    Dim Entities As AcadEntity
    Dim RevIns As String
    Dim OntIns As String
    Dim RevColl As New Collection
    Dim OntColl As New Collection
    
    For Each Layt In ThisDrawing.Layouts
    For Each Entities In Layt.Block
        If TypeOf Entities Is AcadBlockReference Then
        Set BlkRef = Entities
            If BlkRef.Name Like "Block R*" Then
                RevIns = Round(BlkRef.InsertionPoint(0)) & "," & Round(BlkRef.InsertionPoint(1))
                RevColl.Add (RevIns)
                ' perhaps find objects near insertionpoint?
                
            End If
            If BlkRef.Name Like "Block D*" Then
                OntIns = Round(BlkRef.InsertionPoint(0)) & "," & Round(BlkRef.InsertionPoint(1))
                OntColl.Add (OntIns)
            End If
        End If
    Next Entities
    Next Layt
    
    End Sub
    - I found a lisp routine called VLAX, it looks for the closest point of a polyline to a block. I'm not sure it would work for block to block distances, so I didn't look much further. It seemd more difficult then necessary.

    My question is wether anyone has any good ideas on how to approach this efficiently, or wether anyone knows with wich of the above ideas I could best continue. Any help would be great!
    Last edited by darfnuggi; 2010-06-17 at 05:53 PM.

  2. #2
    All AUGI, all the time
    Join Date
    2003-10
    Posts
    706
    Login to Give a bone
    0

    Default Re: Order blocks for editing

    If these blocks are specifically named you could just search the entire drawing document for the block name (in both model and paper space) at the end of the revision block "Revision" and then update the info as needed. If the revision block can be updated manually (double click to revise attributes) you could add a command reactor that would recognize the block attribute edit command and then search for the "specific block names" in that code.

    just a thought

Similar Threads

  1. 2015: Attribute Order in Blocks
    By Iceberg in forum AutoCAD General
    Replies: 8
    Last Post: 2014-09-30, 05:06 PM
  2. 2010: Redefining Blocks is changing Xref draw order
    By feargt in forum Dynamic Blocks - Technical
    Replies: 2
    Last Post: 2011-10-13, 03:16 PM
  3. Changing the editing order of attributes
    By cwjean76 in forum AutoCAD General
    Replies: 8
    Last Post: 2008-03-07, 06:31 PM
  4. Wipeouts and Draw Order in Dynamic Blocks
    By derek.96018 in forum AutoCAD General
    Replies: 4
    Last Post: 2008-01-22, 12:38 AM
  5. Draw order in blocks
    By norrin in forum VBA/COM Interop
    Replies: 12
    Last Post: 2006-09-18, 07:17 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •