bobbykimchi Posted December 4, 2019 Share Posted December 4, 2019 Currently using Lee Mac's doff-lsp (Double Offset) and I find it useful. I wonder if it is possible to rescript so we select multiple objects instead of needing to click on every separate polyline. See example below: In order to double offset all three polylines below I would need to doff tre separate objects. Is it possible to get below result by rescripting the code to select multiple objects? Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted December 4, 2019 Share Posted December 4, 2019 My original Double Offset application was designed to precisely emulate the prompts & options offered by the standard AutoCAD OFFSET command, however with the offset being performed to both sides rather than a selected side. Here's a quickly written alternative to permit multiple object selection: (defun c:mdoff ( / d i o s ) (initget 6) (if (and (setq d (getdist "\nSpecify offset distance: ")) (setq s (ssget "_:L" '( (0 . "ARC,CIRCLE,ELLIPSE,*LINE") (-4 . "<NOT") (-4 . "<AND") (0 . "POLYLINE") (-4 . "&") (70 . 80) (-4 . "AND>") (-4 . "NOT>") ) ) ) ) (repeat (setq i (sslength s)) (setq i (1- i) o (vlax-ename->vla-object (ssname s i)) ) (foreach x (list d (- d)) (vl-catch-all-apply 'vlax-invoke (list o 'offset x)) ) ) ) (princ) ) (vl-load-com) (princ) 1 1 Quote Link to comment Share on other sites More sharing options...
bobbykimchi Posted December 5, 2019 Author Share Posted December 5, 2019 18 hours ago, Lee Mac said: My original Double Offset application was designed to precisely emulate the prompts & options offered by the standard AutoCAD OFFSET command, however with the offset being performed to both sides rather than a selected side. Here's a quickly written alternative to permit multiple object selection: (defun c:mdoff ( / d i o s ) (initget 6) (if (and (setq d (getdist "\nSpecify offset distance: ")) (setq s (ssget "_:L" '( (0 . "ARC,CIRCLE,ELLIPSE,*LINE") (-4 . "<NOT") (-4 . "<AND") (0 . "POLYLINE") (-4 . "&") (70 . 80) (-4 . "AND>") (-4 . "NOT>") ) ) ) ) (repeat (setq i (sslength s)) (setq i (1- i) o (vlax-ename->vla-object (ssname s i)) ) (foreach x (list d (- d)) (vl-catch-all-apply 'vlax-invoke (list o 'offset x)) ) ) ) (princ) ) (vl-load-com) (princ) That works great. I wonder if it is possible to have the offsetted lines placed in layers such as your original doff-script? Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted December 5, 2019 Share Posted December 5, 2019 3 hours ago, bobbykimchi said: That works great. I wonder if it is possible to have the offsetted lines placed in layers such as your original doff-script? The following will offset to the current layer: (defun c:mdoff ( / d i l o r s ) (setq l (getvar 'clayer)) (initget 6) (if (and (setq d (getdist "\nSpecify offset distance: ")) (setq s (ssget "_:L" '( (0 . "ARC,CIRCLE,ELLIPSE,*LINE") (-4 . "<NOT") (-4 . "<AND") (0 . "POLYLINE") (-4 . "&") (70 . 80) (-4 . "AND>") (-4 . "NOT>") ) ) ) ) (repeat (setq i (sslength s)) (setq i (1- i) o (vlax-ename->vla-object (ssname s i)) ) (foreach x (list d (- d)) (if (not (vl-catch-all-error-p (setq r (vl-catch-all-apply 'vlax-invoke (list o 'offset x))))) (foreach y r (vla-put-layer y l)) ) ) ) ) (princ) ) (vl-load-com) (princ) 1 Quote Link to comment Share on other sites More sharing options...
ELF-153 Posted February 20 Share Posted February 20 Hello, I just found this thread and lisp (DoubleOffsetV1-1) and installed it. I'm searching for one where my source line would be centre of the input distance typed. For example, when prompted I type 18" and then it would offset 9" on either side, so the the total is 18". Is there a simple way to edit this one, or another known lisp out there? Quote Link to comment Share on other sites More sharing options...
fuccaro Posted February 20 Share Posted February 20 Hello ELF-153, welcome in the forum! You could edit the code yourself using Notepad. After the line (setq d (getdist.....) insert this: (setq d (* 0.5 d)) After you enter the distance, that will cut it in half before it use it. Good luck! Quote Link to comment Share on other sites More sharing options...
BIGAL Posted February 21 Share Posted February 21 You could also do a factor of offset like 1. means do 18 each side. 0.25 would do 0.25 1 side 0.75 other side. 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.