TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: TJAM51 on March 16, 2005, 03:16:43 PM

Title: Another hatch lisp
Post by: TJAM51 on March 16, 2005, 03:16:43 PM
The routine below only allows a single pick of lines.....I need some assistance in where it will do a crossing as well as a single pick....

Thanks


(defun c:h (/ sSet *error*)
(defun *error* (msg)
(setvar "cmdecho" 1)
); end *error*
(setvar "cmdecho" 0)
(princ "*** Select objects for Hatch & press [Enter] ")
(terpri)
(command "hatch" "" "" "")
(while (= 1 (getvar "cmdactive"))
(command pause)
); end while
(command "")
(princ)
)
Title: Another hatch lisp
Post by: TJAM51 on March 16, 2005, 10:16:56 PM
I could use some help on this....

thanks
Title: Another hatch lisp
Post by: CAB on March 17, 2005, 12:15:26 AM
This will get you started.
Code: [Select]
(defun c:h (/ ss)
  (setvar "cmdecho" 0)
  (prompt "\n*** Select objects for Hatch & press [Enter] ")
  (if (and (setq ss (ssget))
           (> (sslength ss) 0))
    (command "hatch" "" "" "" ss "")
  )
  (princ)
)
Title: Another hatch lisp
Post by: TJAM51 on March 18, 2005, 07:58:09 AM
When I load the routine I receive the following error message.....



error: malformed list on input
Title: Another hatch lisp
Post by: MP on March 18, 2005, 08:07:41 AM
Just missing a closing parenthesis after the local declarations, try this --

Code: [Select]
(defun c:h (/ ss)
    (setvar "cmdecho" 0)
    (prompt "\n*** Select objects for Hatch & press [Enter] ")
    (if (and
            (setq ss (ssget))
            (> (sslength ss) 0)
        )
        (command "hatch" "" "" "" ss "")
    )
    (princ)
)
Title: Another hatch lisp
Post by: CAB on March 18, 2005, 08:10:14 AM
Thanks MP, I added it to my post too. :)
Title: Another hatch lisp
Post by: MP on March 18, 2005, 08:11:28 AM
My pleasure. :)