See the top rated post in this thread. Click here

Results 1 to 7 of 7

Thread: How can I purge a block definition without using purge command ?

  1. #1
    AUGI Addict kennet.sjoberg's Avatar
    Join Date
    2002-05
    Posts
    1,707
    Login to Give a bone
    0

    Default How can I purge a block definition without using purge command ?

    Like this, but i does not work
    Code:
    (setq EntName (tblobjname "BLOCK" "MyTemporaryBlock" ) )
    (entdel EntName )

    : ) Happy Computing !

    kennet

  2. #2
    AUGI Addict
    Join Date
    2005-08
    Posts
    1,043
    Login to Give a bone
    1

    Default Re: How can I purge a block definition without using purge command ?

    Maybe make sure that there is no inserts of the block name, and then try to delete it from the block collection. It maybe nested though.

    Code:
    (defun DeleteBlockDef (BlkName)
    
    (if (ssget "x" (list (cons 2 BlkName)))
     (prompt "\n There are still inserts of this block.")
     (if
      (vl-catch-all-error-p
       (vl-catch-all-apply
        '(lambda ()
         (vla-Delete
          (vla-Item
           (vla-get-Blocks
            (vla-get-ActiveDocument
             (vlax-get-Acad-Object)
            )
           )
           BlkName
          )
         )
        )
       )
      )
      (prompt "\n Block definition could not be deleted.")
      (prompt "\n Block definition was deleted.")
     )
    )
    (princ)
    )

  3. #3
    AUGI Addict kennet.sjoberg's Avatar
    Join Date
    2002-05
    Posts
    1,707
    Login to Give a bone
    0

    Default Re: How can I purge a block definition without using purge command ?

    No, there is no inserts or nested block, just a blockdefinition, so the . . .
    Code:
    (vla-Delete (vla-Item (vla-get-Blocks (vla-get-ActiveDocument (vlax-get-Acad-Object )) ) BlkName ))
    . . .did the trick.

    Thank you very much Tim and

    : ) Happy Computing !

    kennet

  4. #4
    AUGI Addict kennet.sjoberg's Avatar
    Join Date
    2002-05
    Posts
    1,707
    Login to Give a bone
    0

    Default Re: How can I purge a block definition without using purge command ?

    BTW
    I have problem with the (vla-get-WhatCanISelectHere
    for example UCS or equals, is there any information in the help document to find it ?

    : ) Happy Computing !

    kennet

  5. #5
    100 Club intergrupocr's Avatar
    Join Date
    2006-02
    Posts
    116
    Login to Give a bone
    0

    Default Re: How can I purge a block definition without using purge command ?

    It depends of the object, you can try to dump the object to see all the properties that you can (vla-get)


    (vlax-dump-object object T)

  6. #6
    AUGI Addict
    Join Date
    2005-08
    Posts
    1,043
    Login to Give a bone
    0

    Default Re: How can I purge a block definition without using purge command ?

    You're welcome Kennet. As intergrupocr mentioned, you can do that per object you have. You can look through the help files also, that is where I learned most of the ActiveX controls. Once you're in the help files, get to the Developers Guide. Then you will want to look at the ActiveX and VBA Reference. In there you will have a couple other book type things to select from. If you select the object one, then you will get a list of all the objects, and then when you select on one of them, it will go specific to that one object, and it will show all the properties/methods/events for that object. The only problem is getting the right syntax in lisp. One example is
    (vlax-invoke BlkObj 'GetAttributes)
    Will return a list of all the blocks attributes as objects
    (vla-GetAttributres BlkObj)
    Will return a variant of all the blocks attributes as objects. These come with experience.

  7. #7
    AUGI Addict kennet.sjoberg's Avatar
    Join Date
    2002-05
    Posts
    1,707
    Login to Give a bone
    0

    Default Re: How can I purge a block definition without using purge command ?

    Quote Originally Posted by T.Willey
    You're welcome Kennet. . .
    Tank you Tim and intergrupocr, this is still a jungle for me and I have to play a lot more to have the experience.

    : ) Happy Computing !

    kennet

Similar Threads

  1. Purge + Audit &/or Recover + Purge
    By Wish List System in forum AutoCAD Wish List
    Replies: 3
    Last Post: 2013-06-20, 08:18 PM
  2. Purge + Audit &/or Recover + Purge
    By Wish List System in forum AutoCAD Wish List
    Replies: 0
    Last Post: 2013-06-19, 07:12 PM
  3. Block the Purge Command?
    By cliff collins in forum Revit - API
    Replies: 3
    Last Post: 2010-10-13, 03:17 PM
  4. Purge: The existing purge command misses some stuff that could be purged from a file.
    By revit.wishlist1942 in forum Revit Architecture - Wish List
    Replies: 1
    Last Post: 2010-03-12, 12:28 PM
  5. Purge a layer without purge command
    By cadconcepts in forum AutoLISP
    Replies: 6
    Last Post: 2007-09-24, 06:11 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
  •