p7q Posted 2 hours ago Posted 2 hours ago Hi everyone, I'm working with a large AutoLISP routine that sets the Z elevation of all objects to 0 — similar to a custom Z0 command. It handles a wide range of entity types including: LINEs, ARCs, CIRCLEs, POLYLINEs (both 2D and 3D), LWPOLYLINEs, SPLINEs, HATCHes, TEXT, MTEXT, DIMENSIONs, INSERTs (blocks), including nested block content, and REGION entities. What it does: For each entity, I check its Z elevation and flatten it: For regular entities, I modify their coordinate group codes (10, 11, etc.) using entmod, or use vla-put-elevation where applicable. For INSERTs, I dive into their nested entities and apply the same logic. For REGIONs, I currently copy and explode them temporarily, analyze the resulting geometry to determine the average Z, then move the original REGION to Z=0. My problem: The command works fine, but performance is a major issue, especially on complex or large drawings. What are the best ways to optimize performance for a routine like this? Is there a better way to flatten REGIONs without exploding them? Specifically, is there a way (maybe via a filter or a helper LISP) to select only entities whose Z coordinate is not zero? That would allow me to skip processing objects that are already flat and significantly improve performance. Thanks a lot in advance for any suggestions! Quote
Steven P Posted 1 hour ago Posted 1 hour ago Here is a quick example, (ssget (list '(-4 . "<OR") '(-4 . "*,*,<>") (list 10 0.0 0.0 0.0) '(-4 . "*,*,<>") (list 11 0.0 0.0 0.0) '(-4 . "OR>") )) Should select the more simple entities not at 0 elevation - not sure it will work for 3d polylines for example, but should be OK for lines, circles, arcs and so on and apply similar to others? Quote
Steven P Posted 1 hour ago Posted 1 hour ago I guess the flatten command has some limitations for you (I've never been 100% with trusting flatten) Quote
p7q Posted 58 minutes ago Author Posted 58 minutes ago 5 minutes ago, Steven P said: I guess the flatten command has some limitations for you (I've never been 100% with trusting flatten) yes flatten is not working sometimes block, pline, dimension. So ı need this lisp. 8 minutes ago, Steven P said: Here is a quick example, (ssget (list '(-4 . "<OR") '(-4 . "*,*,<>") (list 10 0.0 0.0 0.0) '(-4 . "*,*,<>") (list 11 0.0 0.0 0.0) '(-4 . "OR>") )) Should select the more simple entities not at 0 elevation - not sure it will work for 3d polylines for example, but should be OK for lines, circles, arcs and so on and apply similar to others? this lips so limited. for exaple there are multiple 10 dxf data in POLYLINE. I need something more comprehensive 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.