• Industries
  • Products
  • Buy
  • Services & Support
  • Communities
  • Discussion Groups

    AutoCAD Civil 3D

    Reply
    Active Member
    RyanElam
    Posts: 8
    Registered: ‎07-12-2010

    Can not purge blocks

    332 Views, 13 Replies
    11-14-2012 08:51 AM

    I have a file with 403 blocks in it that can not be deleted, purged, or seen.  I've attempted to WBLOCK the linework out, copy and paste the linework out, exploding every object in the file, changing everything to bylayer and layer 0, purgeing and -purgeing, but the blocks are still there along with a number of linestyles associated with the hidden blocks.  Is there any way to get rid of these blocks?  I have a file attached with nothing else in it except the blocks I cannot purge.  They are also not associated with any styles.  Any help would be greatly appreciated.

     

    Thanks,

    Ryan

     

    Ryan

    Civil 3D 2013
    Please use plain text.
    *Expert Elite*
    Posts: 1,580
    Registered: ‎05-21-2008

    Re: Can not purge blocks

    11-14-2012 08:58 AM in reply to: RyanElam

    What happens if you use QuickSelect to select all instances of one of the blocks, and delete.  Can it then be purged?  Not something you want to do 403 times, but as a test.

     

    You could try a couple of searches for a deep purge or super purge lisp routine.  There might be something out there to help you.

    __________________________________________________________
    Win 7 Pro, 32 bit; Intel Core i5 @ 2.80GHz; 4GB RAM—Civil 3D 2008 & 2011
    __________________________________________________________
    Credit where credit is due! Give kudos or accept as solution whenever you can.
    Please use plain text.
    Active Member
    RyanElam
    Posts: 8
    Registered: ‎07-12-2010

    Re: Can not purge blocks

    11-14-2012 09:01 AM in reply to: troma

    Quick select is not available.  The file doesn't appear to have any objects in it.  The blocks only show up under the items that you cannot purge.

    Ryan

    Civil 3D 2013
    Please use plain text.
    Contributor
    Posts: 12
    Registered: ‎10-23-2012

    Re: Can not purge blocks

    11-14-2012 10:33 AM in reply to: RyanElam

    This would work, but it's dangerous.  It deletes every block definition from your drawing.  It doesn't check to see if the block is in use or anything, it just deletes all block definitions.  So it would completely hose most drawings.

     

    (setq acad (vlax-get-acad-object))
    (setq doc (vla-get-activedocument acad))
    (setq blocks (vla-get-blocks doc))
    
    (while     (> (vla-get-count blocks) 2); blocks 0 and 1 are modelspace and paperspace
        (setq b1 (vla-item blocks 2))
    
    ;; This is where you'd put filters to weed out blocks you want to keep
    
        (vlax-invoke-method b1 'delete)
    )
    
    (vlax-release-object blocks)
    (vlax-release-object doc)
    (vlax-release-object acad)

     Hope this helps!

    John

    -John J. Rauch, P.E.
    Please use plain text.
    Active Member
    RyanElam
    Posts: 8
    Registered: ‎07-12-2010

    Re: Can not purge blocks

    11-14-2012 11:00 AM in reply to: jrauch

    Would I just type the code in the command line?  I don't have that much coding experience.

    Ryan

    Civil 3D 2013
    Please use plain text.
    *Expert Elite*
    Posts: 1,580
    Registered: ‎05-21-2008

    Re: Can not purge blocks

    11-14-2012 11:04 AM in reply to: RyanElam

    I think copy/paste in commandline will work.

     

     

    If you want to save it as a routine, you can put the text in notepad, save it with the file extention .lsp

    Then you need to type appload in autocad, browse to the .lsp file and load it.

    But I think there may be more lines required in the code for it to work that way.

    __________________________________________________________
    Win 7 Pro, 32 bit; Intel Core i5 @ 2.80GHz; 4GB RAM—Civil 3D 2008 & 2011
    __________________________________________________________
    Credit where credit is due! Give kudos or accept as solution whenever you can.
    Please use plain text.
    Contributor
    Posts: 12
    Registered: ‎10-23-2012

    Re: Can not purge blocks

    11-14-2012 11:08 AM in reply to: RyanElam

    You can copy and paste it in at the command line (do it all in one shot, not line-by-line). 

     

    But this is like a last resort thing.  I would recommend you try to find out what these things are and how they were created.  If purge doesn't want to delete them, there's probably a reason.  Though I did look through the drawing and couldn't find anything. 

     

    If you're just looking for a blank slate, try creating a drawing with acad.dwt. 

     

    Running this routine could potentially do more harm than good, which is why I didn't write it into a function.  I hesitate using it once, let alone setting it up to be used repeatedly.

    -John J. Rauch, P.E.
    Please use plain text.
    Active Member
    RyanElam
    Posts: 8
    Registered: ‎07-12-2010

    Re: Can not purge blocks

    11-14-2012 11:51 AM in reply to: jrauch

    I ran it and it gives me an automation error. Object is referenced.  Thanks for the help though.

    Ryan

    Civil 3D 2013
    Please use plain text.
    Contributor
    Posts: 12
    Registered: ‎10-23-2012

    Re: Can not purge blocks

    11-14-2012 11:56 AM in reply to: RyanElam

    You know what - when I ran that successfully, it was after I had exported your drawing to AutoCAD.  Export to AutoCAD removes all Civil3D objects from a drawing.

     

    Why are you doing this anyway?

    -John J. Rauch, P.E.
    Please use plain text.
    *Expert Elite*
    Posts: 3,052
    Registered: ‎07-22-2003

    Re: Can not purge blocks

    11-14-2012 11:56 AM in reply to: RyanElam

    Ryan, in the same vein as what John mentioned, try this bit of lisp: (I did test it on your drawing without error)

     

    (vl-load-com)

    (vlax-for blk (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object)))
    (if (= (vla-get-islayout blk) :vlax-false)
    (vla-delete blk)
    )
    )

     

    This makes sure to not include the Modelspace or any Paperspace objects. From the looks of the drawing, I think that an Xref containing anonymous Groups was Inserted/Bound to the drawing and something triggered them as being unpurgable, although I'm not sure what that could have been.

     

    Oh, and I ran it from the C3D as AutoCAD icon, not inside C3D.

    Jeff_M, also a frequent Swamper
    Please use plain text.