An alternative solution is to draw that as multiline after define an apropriate style.

Registered forum members do not see this ad.
Hi all,
as i shown in the drawings, i have centerlines and winglines,
now what i want is from centerline i want to draw winglines at different distances
(i.e.10m,25m,45m it could be any distance means not ON proper interval)
and corridor at the end
Is there any lisp that could solve my prob.
Thankx a lot in advance
An alternative solution is to draw that as multiline after define an apropriate style.
Regards,
Mircea
AutoCAD's happy user equation: FILEDIA + PICKADD² + PICKFIRST = 3
Try this piece of code .
Code:(defun c:Test (/ *error* d e s k) (vl-load-com) ;;; Tharwat 09. Oct. 2012 ;;; (defun *error* (x) (princ "\n*Cancel*") ) (if (and (not (tblsearch "LAYER" "SURVEY LIMIT")) (not (tblsearch "LAYER" "SURVEY LINES")) ) (progn (alert " One or two layers [SURVEY LIMIT , SURVEY LINES] are not found in the drawing") (exit) ) ) (if (and (setq s (ssget "_+.:S:L" '((0 . "LINE")))) (progn (initget "WINGLINES CORRIDOR") (setq k (cond ((getkword "\n Choose one [Winglines/Corridor] <Winglines> :" ) ) ("Winglines") ) ) ) ) (while (setq d (getdist "\n Specify offset distance :")) (progn (foreach x (list d (- d)) (vla-offset (vlax-ename->vla-object (ssname s 0)) x ) (vla-put-layer (vlax-ename->vla-object (entlast)) (if (eq k "Winglines") "SURVEY LIMIT" "SURVEY LINES" ) ) ) ) ) ) (princ) )
Last edited by Tharwat; 9th Oct 2012 at 10:30 am. Reason: name of layers added to alert function
- When aim is being settled in my mind , I have to reach it and get it in hand whatever it costs and wherever it is and will never give up . Tharwat said

OMG......Thanx a lot tharwat
that is working beautifully...........but still need little correction
when i m trying to draw corridor, the line which is drawn must have corridor line properties (i.e. Layer-Survey limit, Color-Blue, Line type-dashed)
but corridor it draws has wingline properties (i.e. Layer-Survey lines, Color-magenta, Line type-conti.)
other than this it is working fabulously.....This what i was looking for
- When aim is being settled in my mind , I have to reach it and get it in hand whatever it costs and wherever it is and will never give up . Tharwat said

i tried that...
i entered C after that prompt but still magenta line is appearing
can u tell why it is happening?
i have modified this routine, which is as follow
but still same error is comingCode:(defun c:Test (/ *error* d e s k) (vl-load-com) ;;; Tharwat 09. Oct. 2012 ;;; (defun *error* (x) (princ "\n*Cancel*") ) (if (and (not (tblsearch "LAYER" "SURVEY LIMIT")) (not (tblsearch "LAYER" "SURVEY LINES")) ) (command "layer" "m" "Survey Limit" "lt" "dashed" "" "c" "5" "" "") (command "layer" "m" "Survey Lines" "lt" "continuous" "" "c" "6" "" "") ) (if (and (setq s (ssget "_+.:S:L" '((0 . "LINE")))) (progn (initget "WINGLINES CORRIDOR") (setq k (cond ((getkword "\n Choose one [Winglines/Corridor] <Winglines> :" ) ) ("Winglines") ) ) ) ) (while (setq d (getdist "\n Specify offset distance :")) (progn (foreach x (list d (- d)) (vla-offset (vlax-ename->vla-object (ssname s 0)) x ) (vla-put-layer (vlax-ename->vla-object (entlast)) (if (eq k "Winglines") "SURVEY LIMIT" "SURVEY LINES" ) ) ) ) ) ) (princ) )
Code:(defun c:Test (/ *error* d e s k) (vl-load-com) ;;; Tharwat 09. Oct. 2012 ;;; (defun *error* (x) (princ "\n*Cancel*") ) (setvar 'cmdecho 0) (defun Lyr (/ x) (initget "WINGLINES CORRIDOR") (setq x (cond ((getkword "\n Choose one [Winglines/Corridor] <Winglines> :" ) ) ("Winglines") ) ) x ) (foreach lyr '(("SURVEY LIMIT" "5" "DASHED") ("SURVEY LINES" "6" "CONTINUOUS")) (if (not (tblsearch "LAYER" (car lyr))) (command "_Layer" "_N" (car lyr) "_Color" (cadr lyr) (car lyr) "_Ltype" (last lyr) (car lyr) "" ))) (if (and (setq s (ssget "_+.:S:L" '((0 . "LINE")))) (setq k (lyr)) ) (while (progn (initget "L") (setq d (getdist "\n Specify offset distance/L To change layer :"))) (cond ((eq d "L")(setq k (lyr))) ((eq (Type d) 'Real) (foreach x (list d (- d)) (vla-offset (vlax-ename->vla-object (ssname s 0)) x ) (vla-put-layer (vlax-ename->vla-object (entlast)) (if (eq k "Winglines") "SURVEY LIMIT" "SURVEY LINES" ) ) ) ) ) ) ) (princ) )

it working perfectly now for me without any error
@pBe and Tharwat.....you guys are real genius.... thankx a lot for your interest and help..... your work is really appreciated.
I want one more help from u (Sorry for making u to work again)
In winglines segment, i want the prompt of Specify Distance [Same/Different]
1. at same distance i want to specify distance once and then it should draw line at proper interval of that distance.
(e.g. If i specified distance 2 then
1st offset will be @- 2,
2nd offset will be @- 4,
3rd offset will be @- 6.
Just like Offset command (after selecting object it ask Specify through point or [Exit/Multiple/Undo] <Exit>:
When we give Multiple command it draws line at proper interval of that specified distance)
2.For different distance it should work how it is working now.
i.Select object
ii. specify distance
iii. offsetting the line
Registered forum members do not see this ad.
That sounds like fun. But its tharwats' code really
Cheers
Bookmarks