Jump to content

Recommended Posts

Posted

Hi I am try to create a script that will remove all of type of dynamic block. I can do this manual using quick select and filtering by name.

But I cannot do this with the ssx command that I use in my scripts

 

So I guess I have 2 questions:

  1. can you used quickselect in script?
  2. how does quickselect determine these blocks by name?

  • 2 weeks later...
Posted

You can use the QSELECT command in a script but it spits up a dialog box.

 

For some reason that command does not have a -QSELECT alternative to suppress it to the command line. It is therefore very dificult to automate a script for it.

 

Someone on this forum previously suggested to me that I try using FILTER but I have not had time yet to verify if it will work.

Posted

Hi YZ

I have found a solution for my problem but sadly no way to automate QSELECT or FILTER.

To delete all of a praticual dynamic block i used a mixture of lisp and script.

 

Lisp DDSS (dynamic block selection set)

;SORCED [url]http://forums.augi.com/archive/index.php/t-31578.html[/url]
;17/11/2011
;posted by irneb ;at 2007-12-07, 01:11 PM ;on [url]http://forums.augi.com/archive/index.php/t-31578.html[/url]
;modified RCondon 17/11/2011

(defun c:DBSS (/ name ss namelist n en ed eo sslist)
;; Ask user for block's effective name
(if (not (setq name (getstring "Enter the block's effective name: ")))
(quit)
) ;_ end of if
;; Search through blocks for anonymous referring to this effective name
(setq namelist (list name) ;Initialize names list with normal block's name
ss (ssget "x" '((0 . "INSERT") (2 . "`**"))) ;Get all anonymous blocks in drawing
n 0 ;Initialize counter
) ;_ end of setq
;; Step through selection set
(while (< n (sslength ss))
;; Get nth entity in selection set + it's data
(setq en (ssname ss n)
ed (entget en)
) ;_ end of setq
;; Check if it isn't an unchanged dynamic block & that it hasn't been added to the list already
(if (and
(/= name (cdr (assoc 2 ed)))
(not (member (strcat "`" (cdr (assoc 2 ed))) namelist))
) ;_ end of and
(progn
;; Get the entity's object handle
(setq eo (vlax-ename->vla-object en))
;; Check if effective name is the same
(if (= name (vlax-get-property eo 'EffectiveName))
;; Add the anonymous block's name with reverse appostrophe prefix
(setq namelist (cons (strcat "`" (cdr (assoc 2 ed))) namelist))
) ;_ end of if
) ;_ end of progn
) ;_ end of if
(setq n (1+ n))
) ;_ end of while
;; Clear selection set & clear memory
(setq ss nil)
(gc)
;; Construct the selection filter list in reverse order
(setq sslist '((-4 . "<OR") (0 . "INSERT"))
n 0
) ;_ end of setq
;; Step through the list of names
(while (< n (length namelist))
;; Add the name to the filter list
(setq sslist (cons (vl-list* 2 (nth n namelist)) sslist))
(setq n (1+ n))
) ;_ end of while
;; End the filter list's OR section
(setq sslist (cons '(-4 . "OR>") sslist))
;; Reverse the list to get it in the correct order
(setq sslist (reverse sslist))
) ;_ end of defun

Script needed to run lisp

(load "DBSS.lsp")
DBSS
TAG_PAV
_.erase P 

  • 1 year later...
Posted

I Have recently upgraded to 2012 and this lisp is not working

It is selecting all blocks and not filtering but the name.

 

Can anyone help me modify

  • 4 weeks later...
Posted

This might go better in the lisp forum now that you are using lisp rather than a script.

Posted
This might go better in the lisp forum now that you are using lisp rather than a script.

is there a way to move this Thread or do i need to post a new one

Posted

I am not certain how to move it. I usually see the moderators doing that on our behalf. But if you don't hear from one then I'd say copy and paste into a new thread on that forum.

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...