Elektrik Posted February 21, 2023 Posted February 21, 2023 When I try to fillet some lines, I fail to do so as their Z elevations are different. When I use flatten command, sometimes it works and I can then fillet them, but another times I can't fillet themeven after using flatten command, and I have no idea why. The other problem I have with the flatten command i sthat it recreates flatten versions of blocks, but I do not want it to do that either. So, is there any lisp that would bring Z elevations to 0 so that I could always fillet lines, and would not recreate the flatten verions of blocks. Thanks in advance. Quote
devitg Posted February 21, 2023 Posted February 21, 2023 48 minutes ago, Elektrik said: When I try to fillet some lines, I fail to do so as their Z elevations are different. When I use flatten command, sometimes it works and I can then fillet them, but another times I can't fillet themeven after using flatten command, and I have no idea why. The other problem I have with the flatten command i sthat it recreates flatten versions of blocks, but I do not want it to do that either. So, is there any lisp that would bring Z elevations to 0 so that I could always fillet lines, and would not recreate the flatten verions of blocks. Thanks in advance. Please upload your sample.dwg with a before and after Quote
Emmanuel Delay Posted February 21, 2023 Posted February 21, 2023 (edited) What this code does: - Lines are no problem. Everywhere the Z value is set to 0 - Arc: Arcs have a center; I set its z-value to 0 - Polyline: they have an elevation, just a number. I set it to 0. Things like polylines, circles, arcs... are always drawn on a UCS plane. If that plane is not parallel to the current plane, then this code will not do what you want. I don't touch anything else, like blocks, 3D polyline, ... Just what you asked. Command FLAT (feel free to rename) (defun c:flat ( / ss i ent ip1 ip2 elv) ;; lines (setq ss (ssget "_X" (list (cons 0 "LINE")))) (setq i 0) (repeat (sslength ss) (setq ent (ssname ss i)) ;; insert point start (setq ip1 (cdr (assoc 10 (entget ent)))) ;; add a z-value 0.0 , or replace the z-value by 0.0 (setq ip1 (list (nth 0 ip1) (nth 1 ip1) 0.0 )) ;; insert point start (setq ip2 (cdr (assoc 11 (entget ent)))) ;; add a z-value 0.0 , or replace the z-value by 0.0 (setq ip2 (list (nth 0 ip2) (nth 1 ip2) 0.0 )) ;; entity modify, by substituting groups (entmod (subst (cons 10 ip1) (assoc 10 (entget ent)) (entget ent) )) ;; substitute IP start (entmod (subst (cons 11 ip2) (assoc 11 (entget ent)) (entget ent) )) ;; substitute IP end (setq i (+ i 1)) ) ;; ARC (setq ss (ssget "_X" (list (cons 0 "ARC")))) (setq i 0) (repeat (sslength ss) (setq ent (ssname ss i)) ;; insert point center (setq ip1 (cdr (assoc 10 (entget ent)))) ;; add a z-value 0.0 , or replace the z-value by 0.0 (setq ip1 (list (nth 0 ip1) (nth 1 ip1) 0.0 )) (entmod (subst (cons 10 ip1) (assoc 10 (entget ent)) (entget ent) )) ;; substitute IP center (setq i (+ i 1)) ) ;; POLYLINE (setq ss (ssget "_X" (list (cons 0 "LWPOLYLINE")))) (setq i 0) (repeat (sslength ss) (setq ent (ssname ss i)) ;; Elevation (setq elv 0.0) (entmod (subst (cons 38 elv) (assoc 38 (entget ent)) (entget ent) )) ;; substitute elevation (setq i (+ i 1)) ) ) Edited February 21, 2023 by Emmanuel Delay 1 Quote
Tharwat Posted February 21, 2023 Posted February 21, 2023 Here is mine but unfortunately its not a freeware. https://autolispprograms.wordpress.com/flatten-program/ 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.