danthecadman Posted December 4, 2013 Posted December 4, 2013 Hi Guys, I've got a job where I'm offsetting heaps of lines and I need to change the colour of the line I offset from the colour it was, and I have to keep repeating this over and over. Is there a LISP routine out there that can offset at a specific distances, change the colour of the offset line and then repeat? I can't seem to find one out there that does this specifically, and my programming abilities are minimal. Quote
BIGAL Posted December 5, 2013 Posted December 5, 2013 You need to find a offseting routine first then to change colour you need to do a simple "chprop last" this example will change to 1 colour if you want a rainbow look at 2nd version ; offset code .......... ; offsets a line (command "chprop" "L" '' "C" 140 "") ; code again ;2nd version (setq x 10) ; code ............... ; offsets a line (command "chprop" "L" '' "C" x "") (setq x (+ x 10)) ; code again........... Quote
pBe Posted December 5, 2013 Posted December 5, 2013 Is there a LISP routine out there that can offset at a specific distances, change the colour of the offset line and then repeat? Im not clear on that one, repeat? offsetting an object with the same distance without selecting another object? Is there a LISP routine out there that can offset at a specific distances, Prompt for distance? or a specific color for a specific distance? It is as easy as what Bigal's suggested, but you need to be more clear on the parameters. Quote
satishrajdev Posted December 5, 2013 Posted December 5, 2013 TRY THIS :- Dont forget to change color code as per your requirement.... (DEFUN C:TEST (/ A B C) (VL-LOAD-COM) (WHILE (SETQ A (CAR (ENTSEL "\nSelect Line to Offset :"))) (INITGET 1) (SETQ B (GETDIST "\nSpecify Offset Distance :")) (SETQ C (GETPOINT "\nSpecify Point on Side to Offset :")) (VLA-OFFSET (VLAX-ENAME->VLA-OBJECT A) (POINTSIDE A C) ) (VLA-PUT-COLOR (VLAX-ENAME->VLA-OBJECT (ENTLAST)) [b][color=red]1[/color][/b]) [color=red][b] ;<- SPECIFY COLOR CODE HERE[/b][/color] ) (PRINC) ) (DEFUN POINTSIDE (OBJ PNT / P1 PA P2) (SETQ P1 (VLAX-CURVE-GETCLOSESTPOINTTO OBJ (TRANS PNT 1 0)) PA (VLAX-CURVE-GETPARAMATPOINT OBJ P1) ) (IF (EQUAL '(0.0 0.0 0.0) (VLAX-CURVE-GETSECONDDERIV OBJ PA) 1e-8 ) (SETQ P1 (VLAX-CURVE-GETPOINTATPARAM OBJ (FIX PA)) P2 (VLAX-CURVE-GETPOINTATPARAM OBJ (1+ (FIX PA))) ) (SETQ P2 (MAPCAR '+ P1 (VLAX-CURVE-GETFIRSTDERIV OBJ PA))) ) (IF (MINUSP (SIN (- (ANGLE P1 PNT) (ANGLE P2 PNT)))) (SETQ B (- B)) (SETQ B (+ B)) ) ) Quote
pBe Posted December 5, 2013 Posted December 5, 2013 I guess some forum members cant wait for confirmation Try this: (defun c:ocl ( / ob pt) (if (setq color (acad_colordlg (if color color 7 ) nil )) (progn (setq dist (cond ((getdist (strcat "\nEnter Distance [Enter to accept: <" (rtos (setq dist (abs (getvar 'Offsetdist))) 2 2) ">: " ) ) ) (dist) )) (command "_.Offset" dist) (while (> (getvar "CMDACTIVE") 0) (if (and (setq ob (car (entsel "\nSelect object to offset"))) (setq pt (getpoint "\nSelect object to offset")) ) (progn (command ob pt) (vla-put-color (vlax-ename->vla-object (entlast)) color) ) (command "") ) ) ) ) (princ) ) Quote
MSasu Posted December 5, 2013 Posted December 5, 2013 Danthecadman, if the colors and offsets were constant, wouldn’t a multi-line (commands MLSTYLE and MLINE) suit better? Quote
pBe Posted December 5, 2013 Posted December 5, 2013 Danthecadman, if the colors and offsets were constant, wouldn’t a multi-line (commands MLSTYLE and MLINE) suit better Maybe you're right MSasu, Guess satishrajdev and myself both jump the gun then! Quote
BIGAL Posted December 6, 2013 Posted December 6, 2013 Just throwing it out there pick only the obj but you know then which side is the offset side without a extra pick point for direction, yes it can be done. An intelligent offset routine. Sorry to hijack post. Quote
pBe Posted December 6, 2013 Posted December 6, 2013 ....Sorry to hijack post.... No worries Bigal,the way i see it, it was us who hijack the post Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.