Guest kruuger Posted September 13, 2010 Share Posted September 13, 2010 Thanks Kruuger,>> why this doesn't work with RAY object? Because the Ray object doesn't have an Offset method Here is another version of the above, more akin to the normal offset command: aa, thx for explanation Lee. kruuger Quote Link to comment Share on other sites More sharing options...
Kerry Brown Posted September 13, 2010 Share Posted September 13, 2010 I've averted from 'dynamic' programs - too much hassle for minimal practicality... (I've finally seen the light) - I suppose that's what you get from actually working in a DO for a period... I thought that would click in Drawing, like math, is an exact science for most of us. ... though dynamic stuff is a good learning medium. Quote Link to comment Share on other sites More sharing options...
ksavoie Posted August 24, 2012 Share Posted August 24, 2012 Hi, I'm not very proficient in LISP. I altered the code below to make 3" Conduit. Is there anyway to put the new offset lines in a new layer called CONDUIT? THX, Kevin (defun c:CONDUIT3 ( / *error* of undo doc ss flg ) (vl-load-com) (defun *error* ( msg ) (and undo (vla-EndUndomark doc)) (or (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*") (princ (strcat "\n** Error: " msg " **"))) (princ) ) (if (and (ssget '((0 . "ARC,CIRCLE,ELLIPSE,*LINE"))) (setq of 1.75)) ;*****SET RADIUS HERE******EG. 3"C RAD IS 1.75 (progn (initget "Yes No") (setq flg (eq "Yes" (getkword "\nDelete Original? [Yes/No] <No> : "))) (setq undo (not (vla-StartUndomark (setq doc (vla-get-ActiveDocument (vlax-get-acad-object) ) ) ) ) ) (vlax-for obj (setq ss (vla-get-ActiveSelectionSet doc)) (mapcar (function (lambda ( o ) (vl-catch-all-apply (function vla-offset) (list obj o) ) ) ) (list of (- of)) ) (and flg (vla-delete obj)) ) (vla-delete ss) (setq undo (vla-EndUndoMark doc)) ) ) (princ) ) Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted August 24, 2012 Share Posted August 24, 2012 Here is a shortened version of my original code: [color=GREEN];; Double Offset to Layer - Lee Mac[/color] [color=GREEN];; Offsets selected objects to both sides by the distance specified at the top of the code[/color] [color=GREEN];; and moves the resultant objects to the layer specified.[/color] ([color=BLUE]defun[/color] c:off ( [color=BLUE]/[/color] d f l r s ) ([color=BLUE]setq[/color] d 1.75 l [color=MAROON]"CONDUIT"[/color] ) ([color=BLUE]if[/color] ([color=BLUE]ssget[/color] [color=MAROON]"_:L"[/color] '((0 . [color=MAROON]"ARC,CIRCLE,ELLIPSE,*LINE"[/color]))) ([color=BLUE]progn[/color] ([color=BLUE]initget[/color] [color=MAROON]"Yes No"[/color]) ([color=BLUE]setq[/color] f ([color=BLUE]=[/color] [color=MAROON]"Yes"[/color] ([color=BLUE]getkword[/color] [color=MAROON]"\nDelete Original? [Yes/No] <No>: "[/color]))) ([color=BLUE]if[/color] ([color=BLUE]not[/color] ([color=BLUE]tblsearch[/color] [color=MAROON]"LAYER"[/color] l)) ([color=BLUE]vla-add[/color] ([color=BLUE]vla-get-layers[/color] (LM:acdoc)) l) ) ([color=BLUE]vlax-for[/color] o ([color=BLUE]setq[/color] s ([color=BLUE]vla-get-activeselectionset[/color] (LM:acdoc))) ([color=BLUE]foreach[/color] a ([color=BLUE]list[/color] d ([color=BLUE]-[/color] d)) ([color=BLUE]if[/color] ([color=BLUE]not[/color] ([color=BLUE]vl-catch-all-error-p[/color] ([color=BLUE]setq[/color] r ([color=BLUE]vl-catch-all-apply[/color] '[color=BLUE]vlax-invoke[/color] ([color=BLUE]list[/color] o 'offset a))))) ([color=BLUE]foreach[/color] b r ([color=BLUE]vla-put-layer[/color] b l)) ) ) ([color=BLUE]if[/color] f ([color=BLUE]vla-delete[/color] o)) ) ([color=BLUE]vla-delete[/color] s) ) ) ([color=BLUE]princ[/color]) ) [color=GREEN];; Active Document - Lee Mac[/color] [color=GREEN];; Returns the VLA Active Document Object[/color] ([color=BLUE]defun[/color] LM:acdoc [color=BLUE]nil[/color] ([color=BLUE]eval[/color] ([color=BLUE]list[/color] '[color=BLUE]defun[/color] 'LM:acdoc '[color=BLUE]nil[/color] ([color=BLUE]vla-get-activedocument[/color] ([color=BLUE]vlax-get-acad-object[/color])))) (LM:acdoc) ) ([color=BLUE]vl-load-com[/color]) ([color=BLUE]princ[/color]) Quote Link to comment Share on other sites More sharing options...
ksavoie Posted August 24, 2012 Share Posted August 24, 2012 Thanks for the help Lee Mac! Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted August 24, 2012 Share Posted August 24, 2012 You're very welcome Quote Link to comment Share on other sites More sharing options...
mkranthikittu Posted September 23, 2015 Share Posted September 23, 2015 Dear sir, this kranthi kumar thanks for this code a small request sir please can you help on this code, offset line should be fall on current layer is it possible sir. thanks in advance Quote Link to comment Share on other sites More sharing options...
saim Posted August 5, 2017 Share Posted August 5, 2017 This code is exactly what I was looking for. It works perfectly, thank you very much! I would like to add some features to it, thought, but I'm really just beginning to play around with autolisp. Could anyone fully comment the code, please, so I can go on from here? Quote Link to comment Share on other sites More sharing options...
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.