chadley
2007-10-18, 08:08 PM
I found this lisp routine a million years ago and we still use it. Maybe one of you wrote it? Anyway, I need help switching this code from selecting every thing in the drawing to letting the user select only a specific part of the drawing. Any help you can give will be greatly apprecited! I tried to figure it out but I'm too lame so it didn't work, it would only let you select one thing at a time and not use a crossing to select so that would be to tedious for everyone.
(defun c:sketchit-2(/ extDist ss i eName eList startPt endPt lineLength newStartPt newEndPt =20)
;; make sure the geometry calcualator is loaded ...
(setq qa (setvar "qaflags" 0))
(if (not cal)
(arxload "geomcal")
)
;; no do it ...
(defun *error* (msg)
(princ "This is an error")
(if qa
(setvar "qaflags" qa)
)
(setq *error* nil)
)
(setq myss (ssget "x" '((0 . "POLYLINE,LWPOLYLINE"))))
;; If POLYLINES, Expode them
(if myss
(progn
(setvar "qaflags" 1)
(command "explode" myss "")
(setvar "qaflags" 0)
)
)
(setq
extDist (getdist "\nDistance to extend: ")
ss (ssget "x" '((0 . "LINE")))
)
(if ss
(progn
(setq i 0)
(repeat (sslength ss)
(setq
eName (ssname ss i)
eList (entget eName)
startPt (cdr (assoc 10 eList))
endPt (cdr (assoc 11 eList))
lineLength (distance startPt endPt)
)
;; If Existing LINE Endpoints are not same, modify them, else do nothing
(if (not (equal startPt endPt 0.00001))
(progn
(setq newStartPt (cal "pld(endPt,startPt,lineLength + extDist)")
newEndPt (cal "pld(startPt,endPt,lineLength + extDist)")
eList (subst (cons 10 newStartPt) (assoc 10 eList) eList)
eList (subst (cons 11 newEndPt) (assoc 11 eList) eList)
)
(entmod eList)
)
)
(setq i (1+ i))
)
)
)
(setq ss nil)
(princ)
)
Thanks!!
Cynthia
(defun c:sketchit-2(/ extDist ss i eName eList startPt endPt lineLength newStartPt newEndPt =20)
;; make sure the geometry calcualator is loaded ...
(setq qa (setvar "qaflags" 0))
(if (not cal)
(arxload "geomcal")
)
;; no do it ...
(defun *error* (msg)
(princ "This is an error")
(if qa
(setvar "qaflags" qa)
)
(setq *error* nil)
)
(setq myss (ssget "x" '((0 . "POLYLINE,LWPOLYLINE"))))
;; If POLYLINES, Expode them
(if myss
(progn
(setvar "qaflags" 1)
(command "explode" myss "")
(setvar "qaflags" 0)
)
)
(setq
extDist (getdist "\nDistance to extend: ")
ss (ssget "x" '((0 . "LINE")))
)
(if ss
(progn
(setq i 0)
(repeat (sslength ss)
(setq
eName (ssname ss i)
eList (entget eName)
startPt (cdr (assoc 10 eList))
endPt (cdr (assoc 11 eList))
lineLength (distance startPt endPt)
)
;; If Existing LINE Endpoints are not same, modify them, else do nothing
(if (not (equal startPt endPt 0.00001))
(progn
(setq newStartPt (cal "pld(endPt,startPt,lineLength + extDist)")
newEndPt (cal "pld(startPt,endPt,lineLength + extDist)")
eList (subst (cons 10 newStartPt) (assoc 10 eList) eList)
eList (subst (cons 11 newEndPt) (assoc 11 eList) eList)
)
(entmod eList)
)
)
(setq i (1+ i))
)
)
)
(setq ss nil)
(princ)
)
Thanks!!
Cynthia