rlx Posted July 29, 2021 Posted July 29, 2021 ??? look like you want something like : (defun c:test ( / input) (setq input (getint "\nEnter 1 or 2")) (cond ((= input 1)(alert "You pressed 1")) ((= input 2)(alert "You pressed 2")) (t (alert "You didn't enter 1 or 2")) ) ) Quote
RIA Posted July 30, 2021 Author Posted July 30, 2021 Actually looking 01.automatic chamfer on ortho polyline corners in (Screen Short result 01) 02.And automatic 45 dgr double polylines on intersection polylines. (Screen Short result 02) Quote
BIGAL Posted July 31, 2021 Posted July 31, 2021 (edited) 2 seperate functions. 1. Pick object1 pick object2 do a chamfer not hard to do as a lisp with say pre set cham fer 2. Pick object1 pick object2, more complicated break object2 at intersection of object1, draw 2 new lines, if pline add into original. 3. Sorry on iPad, pretty sure 2 has been done already maybe as a 1/2 circle google. Edited July 31, 2021 by BIGAL Quote
RIA Posted July 31, 2021 Author Posted July 31, 2021 (edited) Hai Bigal Thank you for your replay.. i m doing the same... if some one help me to bypass those steps with lisp ... it may make me more faster. looking for, auto chamfer on 90dgr corners. and auto twin 45dgr on intersections. hope it is possible with lisp. Edited July 31, 2021 by RIA Quote
BIGAL Posted August 2, 2021 Posted August 2, 2021 You still need somehow to pick what you want done the chamfer maybe 2 lines look for 2 matching xyz points and chamfer. The 45 jump over you have to say which one some how. The only help is a drag over method so no need to be exact when picking. (setq pt1 (getpoint "\n1st point ")) (setq pt2 (getpoint pt1 "\n2nd point ")) (setq ss (ssget "F" (list pt1 pt2))) do your thing with the two objects Quote
Ajmal Posted August 8, 2021 Posted August 8, 2021 (edited) this is for the action 01 and result 01. the fire link for multiple jumper @ronjonp hoops for single lee mac will be use full (defun c:jumper (/ *error* A AENT B1 B2 BDIS BENT DOC ENT OV P1 P2 UFLAG VL O W) (vl-load-com) (setq Bdis(getdist(strcat "\Specify insulation thickness <" (vl-princ-to-string Bdis)"> : "))) ;; Arc Radius (defun *error* (msg) (and uFlag (vla-EndUndoMark doc)) (and ov (mapcar (function setvar) vl ov)) (and msg (or (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*") (princ (strcat "\n** Error: " msg " **")))) (princ)) (setq doc (vla-get-ActiveDocument (vlax-get-acad-object)) vl '("PEDITACCEPT" "CMDECHO" "OSMODE") ov (mapcar (function getvar) vl)) (setvar "PEDITACCEPT" 1) (while (and (setq uFlag (not (vla-StartUndoMark doc))) (mapcar (function setvar) (cdr vl) '(0 32)) (setq p1 (getpoint "\nPick INTERSECTION: ")) (setq ent (entsel "\nPick LINE TO BREAK: "))) (setq p2 (osnap (cadr ent) "_nea") b1 (polar p1 (setq a (angle p1 p2)) bDis) b2 (polar p1 (+ pi a) bDis)) (setvar "OSMODE" 0) (command "_.break" b1 b2) (setq bEnt (entlast)) (if (> a (/ pi 2.)) (command "_.arc" b2 "_E" b1 "_A" 180.) (command "_.arc" b1 "_E" b2 "_A" 180.)) (setq aEnt (entlast)) (if (eq "LWPOLYLINE" (cdr (assoc 0 (entget (setq ent (car ent)))))) (progn (setq w (vla-get-ConstantWidth (setq o (vlax-ename->vla-object ent)))) (command "_.pedit" "_M" bEnt aEnt ent "" "_J" "" "") (vla-put-ConstantWidth (vlax-ename->vla-object (entlast)) w))) (setq uFlag (vla-EndUndoMark doc))) (*error* nil) (princ)) this is the link or ronjonp code (defun c:hop (/ a d e i o p p1 p2 p3) ;; RJP » 2019-01-14 ;; Adds a 'hop' to a lwpolyline ( very little error checking ) (setq a 0.125) (while (and (setq e (entsel "\nPick a polyline to add a hop: ")) (= "LWPOLYLINE" (cdr (assoc 0 (entget (car e))))) (setq p (vlax-curve-getclosestpointto (car e) (cadr e))) (setq i (1+ (fix (vlax-curve-getparamatpoint (setq e (car e)) p)))) (setq d (vlax-curve-getdistatpoint e p)) (setq p1 (vlax-curve-getpointatdist e (+ d a))) (setq p2 (vlax-curve-getpointatdist e (- d a))) ) (setq o (vlax-ename->vla-object e)) (vlax-invoke o 'addvertex i (mapcar '+ p1 '(0 0))) (vlax-invoke o 'addvertex i (mapcar '+ p2 '(0 0))) (vla-setbulge o i (cond ((< (angle '(0 0) p1) (angle '(0 0) p2)) -1.) (1.) ) ) ) (princ) ) (vl-load-com) this is the link for that https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/simple-line-break-and-jump-autolisp/td-p/8520869 Edited August 8, 2021 by Ajmal Quote
RIA Posted August 11, 2021 Author Posted August 11, 2021 Thank you guys... with the above i can make only arcs.. any chance to make as mentioned in screen short? i mean 45 dgr lines ? Quote
BIGAL Posted August 12, 2021 Posted August 12, 2021 The hop works via a pick point the issue is you need to pick twice, first the object and second pick is where, to place the ^ The code has this which is the left and right point of the hop so need to add a 3rd vertex using this method. (vlax-invoke o 'addvertex i (mapcar '+ p1 '(0 0))) (vlax-invoke o 'addvertex i p3) (vlax-invoke o 'addvertex i (mapcar '+ p2 '(0 0))) So need to work out p3 it needs angle p1 p2 and a polar. A modify of hop is needed for the pick twice, hence I was suggesting drag over the 2 objects. (setq p (vlax-curve-getclosestpointto (car e) (getpoint "\nPick V point")) It would make sense for say ronjonp to maybe add the ^ as an option. PM him. Quote
RIA Posted August 14, 2021 Author Posted August 14, 2021 1st point 2nd point ; error: extra right paren on input this is coming.. Quote
BIGAL Posted August 15, 2021 Posted August 15, 2021 (edited) this is coming.. Whose code are you running ? Try this based on ronjonp codeMulti radio buttons.lsp https://www.cadtutor.net/forum/topic/73466-can-anyone-help-me-to-make-a-lisp-to-make-below-action/ (defun c:hop (/ a d e i o p p1 p2 p3 oldsnap) ;; RJP » 2019-01-14 ;; Adds a 'hop' to a lwpolyline ( very little error checking ) ;; peak added by AlanH Aug 2021 ; requires multi radio buttons.lsp for choice more could be added (setq a 20.0) (setq oldsnap (getvar 'osmode)) (while (setq e (entsel "\nPick a line or polyline to add a hop Enter to exit: ")) (setvar 'osmode 32) (setq p (getpoint "\nPick the intersection point")) (cond ((= "LWPOLYLINE" (cdr (assoc 0 (entget (car e)))))(setq e (car e))) ((= "LINE" (cdr (assoc 0 (entget (car e)))))(command "pedit" e "Y" "")(setq e (entlast))) ((alert "you did not pick a line or pline \nwill now exit")(exit)) ) (setq p (vlax-curve-getclosestpointto e p)) (setq i (1+ (fix (vlax-curve-getparamatpoint e p)))) (setq d (vlax-curve-getdistatpoint e p)) (setq p1 (vlax-curve-getpointatdist e (+ d a))) (setq p2 (vlax-curve-getpointatdist e (- d a))) (setq o (vlax-ename->vla-object e)) (if (not AH:Butts)(load "Multi Radio buttons.lsp")) (if (= but nil)(setq but 1)) (ah:butts but "h" '("Choose Arc or Peak" "Arc" "Peak")) (if (= but 1) (progn (vlax-invoke o 'addvertex i (mapcar '+ p1 '(0 0))) (vlax-invoke o 'addvertex i (mapcar '+ p2 '(0 0))) (vla-setbulge o i (cond ((< (angle '(0 0) p1) (angle '(0 0) p2)) -1.) (1.) ) ) ) ) ;if (if (= but 2) (progn (setq p3 (polar p (+ (/ pi 2.0) (angle p1 p2)) a)) (vlax-invoke o 'addvertex i (mapcar '+ p1 '(0 0))) (vlax-invoke o 'addvertex i (mapcar '+ p3 '(0 0))) (vlax-invoke o 'addvertex i (mapcar '+ p2 '(0 0))) ) ) ;if ) ; while (setvar 'osmode oldsnap) (princ) ) ; defun (vl-load-com) Edited August 15, 2021 by BIGAL Quote
RIA Posted August 15, 2021 Author Posted August 15, 2021 Whose code are you running ? Try this based on ronjonp code Command: HOP Pick a line or polyline to add a hop Enter to exit: Pick the intersection point; error: LOAD failed: "Multi Radio buttons.lsp" Quote
BIGAL Posted August 15, 2021 Posted August 15, 2021 Click on the MULTI RADIO BUTTONS.lsp icon in the post above to download it is a library routine used in any code. Or go to DOWNLOADS, there is Multi radio buttons, getval, toggles. I do have more. Multi radio buttons.lsp 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.