Jump to content


Selection of Blocks with specific heights with lisp

selection blocks

  • You cannot reply to this topic
No replies to this topic

#1 Ray Genbowgen

    Newbie

  • Members
  • Pip
  • 2 posts

Posted 06 February 2018 - 10:08 AM

Hi,

I am trying to write a lisp that automaticly selects all blocks with a z-value of 0 , except some predefined ones, and deletes those.

I know that can be accomplished with quick select, but I need to perform that search on every file I work with, so a lisp would speed up that process enormously.

Now I can't get the lisp to select the blocks according to their z-value.
I am assuming that nanocad has a different option to refer to the coordinates than autocad.

autocad would use 10 to look for coordinates like that:
(0 . "INSERT") (-4 . "*,*,=") (10 0.0 0.0 0.0)

Here is the lisp that I have got so far:


;lisp to delete all blocks with 0 z-value, except specified blocks
(defun C:xx ()
(setq cmde (getvar "CMDECHO"))
(setvar "CMDECHO" 0)
(setq picks (getvar "pickadd"))
(setvar "pickadd" 1)

(setq sel (ssget "x" '(
(0 . "INSERT")
(-4 . "*,*,=") (10 0.0 0.0 0.0) ;selection of blocks with 0 z-value not working
(-4 . "<not") ;exclusion works fine
(-4 . "<or")
(2 . "01")
(2 . "06")
(2 . "DL")
(-4 . "or>")
(-4 . "not>")

)))

(if(/= sel nil)
(command "erase" sel "")
(prompt "Selection leer.")
);if

(setvar "CMDECHO" cmde)
(setvar "pickadd" picks)
(prompt "Finished.")
(princ)
)


Thank you for your advice.

Ray





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users