Message 1 of 8

Not applicable
12-31-2017
02:45 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi everyone,
I have this lisp: by entering a distance and picking a line it creates Xline in the specified distance and parallel to the selected line.
and I want it to work also if I pick a line in a block, can someone help with that?
(defun c:demo ( / offsetlobject otype ent odist ppt parm pts) (command "_UCS" "_World" "") (if (and (setq odist (getdist "\nEnter offset distance")) (setq offsetlobject (entsel "\nSelect object to offset")) (member (setq otype (cdr (assoc 0 (setq ent (entget (Car offsetlobject)))))) '("LWPOLYLINE" "LINE")) ) (progn (setq ppt (vlax-curve-getclosestpointto (Setq e (car offsetlobject)) (cadr offsetlobject)) parm (vlax-curve-getParamAtPoint e ppt)) (setq pts (if (eq otype "LINE") (mapcar '(lambda (dxf) (cdr (assoc dxf ent))) '(10 11)) (mapcar '(lambda (v) (vlax-curve-getPointAtParam e v)) (list (fix parm) (1+ (fix parm)))) ) ) (command "_Xline" "_non" (Car pts) "_non" (cadr pts) "") (command "_.offset" "_Erase" "_Yes" odist ppt pause "") (command "_UCS" "_V") ) ) )
Thanks.
Solved! Go to Solution.