Cad-n-ator Posted December 2, 2009 Posted December 2, 2009 Hello all! I am getting fimilar with lisp now and would like to know if anyone could give me insite to creating a lisp that would basically trim or fillet corners within an area chosen. Start with this: picture 1 and the output to look picture 2 Thanks! Quote
CALCAD Posted December 3, 2009 Posted December 3, 2009 Cad-n-ator, If you want your lisp to do all the intersections in one go, you could use SSGET with the "I" implied mode, to get all the lines which you had previously selected (with PICKFIRST on). Then it's a matter of writing a loop to check each line against the others and find the intersections (with INTERS). Within that loop, every time you have an intersection you could call the FILLET command with a zero radius to get a double trim. This is one approach among many. Enjoy. Quote
SteveK Posted December 3, 2009 Posted December 3, 2009 I was thinking something along the same lines as Randy... For your example drawing you could accomplish this because for each line there is only two intersections. What about if there is more than two (ie your overall group is not a square)? You'd have to introduce conditions like only intersections within a certain distance from either end. I'd say if you are learning lisp you are biting into a pretty big chunk.. Quote
Cad-n-ator Posted December 3, 2009 Author Posted December 3, 2009 Thanks for the insite guys ... i am looking to just use this for rectangular areas. I'm still a newbie to the whole lisp/macro thing in autocad so i have my work cut out for me. Thanks! Quote
Lee Mac Posted December 3, 2009 Posted December 3, 2009 If you are looking to proceed with the fillet method (zero radius), then you would need to work out a way to know which lines in the selection set need to be filleted with which. As, if you just iterate through the selectionset filleting all the lines with each other, you could get undesired fillets. Quote
Lee Mac Posted December 3, 2009 Posted December 3, 2009 Please try this: (defun c:boxed (/ vlax-list->3D-point i j ss e1 e2 o1 o2 iLst) ;; by Lee McDonnell ~ 03.12.2009 (vl-load-com) (defun vlax-list->3D-point (lst) (if lst (cons (list (car lst) (cadr lst) (caddr lst)) (vlax-list->3D-point (cdddr lst))))) (if (setq i -1 ss (ssget '((0 . "LINE")))) (while (setq j (1+ i) e1 (ssname ss (setq i (1+ i)))) (while (setq e2 (ssname ss (setq j (1+ j)))) (if (setq iLst (vlax-list->3D-point (vlax-invoke (setq o1 (vlax-ename->vla-object e1)) 'IntersectWith (setq o2 (vlax-ename->vla-object e2)) acExtendBoth))) (foreach x (list e1 e2) (if (< (distance (vlax-curve-getStartPoint x) (car iLst)) (distance (vlax-curve-getEndPoint x) (car iLst))) (vla-put-StartPoint (vlax-ename->vla-object x) (vlax-3D-point (car iLst))) (vla-put-EndPoint (vlax-ename->vla-object x) (vlax-3D-point (car iLst))))))))) (princ)) Quote
Lee Mac Posted December 3, 2009 Posted December 3, 2009 The above yields undesirable results if the lines in question are not parallel/perpendicular. :wink: Quote
Cad-n-ator Posted December 3, 2009 Author Posted December 3, 2009 That works just like i wanted it too! Thanks! How could i modify it so that i would not have to window or select the lines but just click within the rectangular area and it automatic do this? Quote
Lee Mac Posted December 3, 2009 Posted December 3, 2009 That works just like i wanted it too! Thanks! How could i modify it so that i would not have to window or select the lines but just click within the rectangular area and it automatic do this? Is the window selection just too much effort? Quote
Cad-n-ator Posted December 3, 2009 Author Posted December 3, 2009 Sorry - No, Just toying with the possibilities since i am still learning what all that lisp routines can do. Quote
Lee Mac Posted December 3, 2009 Posted December 3, 2009 Sorry - No, Just toying with the possibilities since i am still learning what all that lisp routines can do. I see - well to have the user click inside of the polylines is a difficult feat to accomplish, as there is no inherent method to detect whether a point is within a certain boundary. And - in your case the boundary is broken upon invoking the command, so this further complicates things. I have written various functions to determine the inside of a boundary, but these are not quick to implement and the drawbacks outweigh the advantages in such a program. Just my 2 cents, Lee Quote
Cad-n-ator Posted December 3, 2009 Author Posted December 3, 2009 Okay - I see what you mean, thanks for the help! Really appreciate the input! JQJ Quote
BIGAL Posted December 4, 2009 Posted December 4, 2009 Food for thought you should be able to fillet any shape with as many lines as you like, If you draw a line through all lines the equivalent to using FENCE going in a circle you then can know the inters point of a line and the next line etc hence then just fillet. Obviously you erase the fence line as you go. I did something like this for converting a room layout into the outside multi line architectural wall. 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.