vernonlee Posted February 10, 2015 Posted February 10, 2015 Found this lisp previously by a user name Kent Cooper. The lisp routine will allow to offset on both side by a user input distance & able to join the ends on both sides making it an object. Could someone help me to modify it such that both ends will also extend to the same distance as the offset before joining the ends. Thanks ;; OffsetBothSidesJoin.lsp [command name: OBSJ] ;; To Offset the same object to Both Sides at the same distance, and ;; if open-ended, Join the resulting objects with PEDIT. ;; On first use, offers regular Offset command's default distance, ;; but only if numerical [not "Through"]. ;; Remembers specified offset distance, separately from regular ;; Offset command's default, and offers as default on later use. ;; Kent Cooper, 21 March 2014 ; (defun C:OBSJ (/ osd disttemp obj); = Offset to Both Sides ; (setq osd (getvar 'offsetdist)) (setvar 'peditaccept 1) ; (if *obsjdist (initget 6) (initget 7)) ; no 0, no negative, no Enter on first use (setq disttemp (getdist (strcat "\nBoth-sides-offset distance" (strcat (if (or *obsjdist (> osd 0)) (strcat ; then - construct default " <" (if *obsjdist (rtos *obsjdist) (rtos osd) ); end if ">" ); end strcat "" ; else - no default offered on first use if Offset's is Through ); end if ); end strcat ": " ); end strcat ); end getdist *obsjdist (cond (disttemp); User specified something other than Enter - use it (*obsjdist); Enter with prior value set - use that ((> osd 0) osd) ; Enter on first use with non-Through Offset default - use that ); end cond & *obsjdist ); end setq ; (while T (if (setq obj (vlax-ename->vla-object (car (entsel "\nSelect object to Offset to Both Sides [Esc to exit]: ")) ); end vlax-... ); end setq (progn (vla-offset obj *obsjdist) (setq ent1 (entlast)) (vla-offset obj (- *obsjdist)) (if (not (vlax-curve-isClosed obj)); e.g. Line, Arc, open Polyline (command "_.pedit" "_m" ent1 (entlast) "" "_j" "_j" "_b" (* *obsjdist 2.5) "") ); if ); end progn ); end if ); end while ; (princ) ); end defun (prompt "Type OBSJ to Offset to Both Sides by the same distance and Join if possible.") Quote
rkmcswain Posted February 10, 2015 Posted February 10, 2015 Found this lisp previously by a user name Kent Cooper..... Kent is a frequent contributor in the Autodesk customization forums. If you don't get a reply here, I bet he would help you if you posted over there. Quote
BIGAL Posted February 11, 2015 Posted February 11, 2015 (edited) A possible workaround offset 0.00000001 and join remember this object (setq obj (entlast)) then offset say 99.99999999 erase obj. Tested manually need add entlast to code 0.001 then 50 Edited February 11, 2015 by BIGAL Quote
vernonlee Posted February 17, 2015 Author Posted February 17, 2015 Kent is a frequent contributor in the Autodesk customization forums. If you don't get a reply here, I bet he would help you if you posted over there. I have PM him & it so happens that he came up with another lisp for another user who needed something like my query. I tried it but did not work for me due to some limitation which he did highlight. But it is fine as there is a workaround for the current code. I just need to offset smaller then what i require then later use normal offset so that the ends will be longer. An extra step but i can live with it. Thanks Quote
vernonlee Posted February 17, 2015 Author Posted February 17, 2015 A possible workaround offset 0.00000001 and join remember this object (setq obj (entlast)) then offset say 99.99999999 erase obj. Tested manually need add entlast to code 0.001 then 50 Look through the code but did not see any "(setq obj (entlast))"? But is is fine as i will use the workaround. Thanks 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.