LITOKARDO_BC Posted February 19, 2020 Posted February 19, 2020 Good morning to all the communication, you could help with a necessary LISP to trim then join. Send example. Thank you EXAMPLE TRIM TO JOIN.dwg Quote
LITOKARDO_BC Posted February 19, 2020 Author Posted February 19, 2020 2 hours ago, LITOKARDO_BC said: Good morning to all the communication, you could help with a necessary LISP to trim then join. Send example. Thank you EXAMPLE TRIM TO JOIN.dwg 75.16 kB · 0 downloads (defun c:C6() (setq PT (getpoint "Center")) (command "circle" PT "0.06") (command "trim") ) Quote
ronjonp Posted February 19, 2020 Posted February 19, 2020 Try this perhaps. (defun c:hop (/ a b d e ent i o p1 p2 p3) ;; RJP » 2020-02-19 ;; Set below for hop size (setq a 0.5) (while (setq ent (entsel "\nSelect polyline to add hop: ")) (cond ((= (cdr (assoc 0 (entget (setq e (car ent))))) "LWPOLYLINE") (setq p1 (vlax-curve-getclosestpointto e (trans (cadr ent) 1 0))) (setq i (fix (vlax-curve-getparamatpoint e p1))) (setq b (vla-getbulge (setq o (vlax-ename->vla-object e)) i)) (setq d (vlax-curve-getdistatpoint e p1)) (vlax-put (vlax-ename->vla-object (tblobjname "layer" (vla-get-layer o))) 'lock 0) (if (and (setq p2 (vlax-curve-getpointatdist e (+ d a))) (setq p3 (vlax-curve-getpointatdist e (- d a))) ) (cond ((= (fix (vlax-curve-getparamatpoint e p2)) (fix (vlax-curve-getparamatpoint e p3)) i) (vlax-invoke o 'addvertex (setq i (1+ i)) (mapcar '+ p2 '(0 0))) (vlax-invoke o 'addvertex i (mapcar '+ p3 '(0 0))) (vla-setbulge o i (if (< (angle '(0 0 0) p2) (angle '(0 0 0) p3)) -1. 1.) ) ) ((princ "\nVertex overlap! Pick another point...")) ) ) ) (princ "\nObject needs to be a lwpolyline...") ) ) (princ) ) Quote
LITOKARDO_BC Posted February 19, 2020 Author Posted February 19, 2020 41 minutes ago, ronjonp said: Try this perhaps. (defun c:hop (/ a b d e ent i o p1 p2 p3) ;; RJP » 2020-02-19 ;; Set below for hop size (setq a 0.5) (while (setq ent (entsel "\nSelect polyline to add hop: ")) (cond ((= (cdr (assoc 0 (entget (setq e (car ent))))) "LWPOLYLINE") (setq p1 (vlax-curve-getclosestpointto e (trans (cadr ent) 1 0))) (setq i (fix (vlax-curve-getparamatpoint e p1))) (setq b (vla-getbulge (setq o (vlax-ename->vla-object e)) i)) (setq d (vlax-curve-getdistatpoint e p1)) (vlax-put (vlax-ename->vla-object (tblobjname "layer" (vla-get-layer o))) 'lock 0) (if (and (setq p2 (vlax-curve-getpointatdist e (+ d a))) (setq p3 (vlax-curve-getpointatdist e (- d a))) ) (cond ((= (fix (vlax-curve-getparamatpoint e p2)) (fix (vlax-curve-getparamatpoint e p3)) i) (vlax-invoke o 'addvertex (setq i (1+ i)) (mapcar '+ p2 '(0 0))) (vlax-invoke o 'addvertex i (mapcar '+ p3 '(0 0))) (vla-setbulge o i (if (< (angle '(0 0 0) p2) (angle '(0 0 0) p3)) -1. 1.) ) ) ((princ "\nVertex overlap! Pick another point...")) ) ) ) (princ "\nObject needs to be a lwpolyline...") ) ) (princ) ) https://drive.google.com/file/d/126bvy7_lAzTiZ81TAvlJb2Cx24vCLupH/view?usp=sharing Quote
LITOKARDO_BC Posted February 19, 2020 Author Posted February 19, 2020 (edited) THANK YOU FOR THE SOON ANSWER, IT IS POSSIBLE TO INDICATE THE ARC DIAMETER, AND PRESISE THE POINT OF INTERSECTION. SEND A GIF BY GOOGLE DRIVE. THANKShttps://drive.google.com/file/d/126bvy7_lAzTiZ81TAvlJb2Cx24vCLupH/view?usp=sharing Quote Edit Quote Edited February 19, 2020 by LITOKARDO_BC Quote
ronjonp Posted February 19, 2020 Posted February 19, 2020 Try this to set the hop size .. I don't have time at the moment to do the precision for you. (defun c:hop (/ a b d e ent i o p1 p2 p3) ;; RJP » 2020-02-19 ;; Set below for hop size (setq a (/ (cond ((setq a (getdist "\nEnter hop size: "))) (1) ) 2. ) ) (while (setq ent (entsel "\nSelect polyline to add hop: ")) (cond ((= (cdr (assoc 0 (entget (setq e (car ent))))) "LWPOLYLINE") (setq p1 (vlax-curve-getclosestpointto e (trans (cadr ent) 1 0))) (setq i (fix (vlax-curve-getparamatpoint e p1))) (setq b (vla-getbulge (setq o (vlax-ename->vla-object e)) i)) (setq d (vlax-curve-getdistatpoint e p1)) (vlax-put (vlax-ename->vla-object (tblobjname "layer" (vla-get-layer o))) 'lock 0) (if (and (setq p2 (vlax-curve-getpointatdist e (+ d a))) (setq p3 (vlax-curve-getpointatdist e (- d a))) ) (cond ((= (fix (vlax-curve-getparamatpoint e p2)) (fix (vlax-curve-getparamatpoint e p3)) i) (vlax-invoke o 'addvertex (setq i (1+ i)) (mapcar '+ p2 '(0 0))) (vlax-invoke o 'addvertex i (mapcar '+ p3 '(0 0))) (vla-setbulge o i (if (< (angle '(0 0 0) p2) (angle '(0 0 0) p3)) -1. 1. ) ) ) ((princ "\nVertex overlap! Pick another point...")) ) ) ) (princ "\nObject needs to be a lwpolyline...") ) ) (princ) ) Quote
LITOKARDO_BC Posted February 19, 2020 Author Posted February 19, 2020 OK NO PROBLEM. THANKS A LOT. IT WAS A LOT OF HELP. 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.