Get all entities considering xclip-clipping area #1084
-
Hi! I have been using the features of the recently released version 1.3.0 and they are very helpful. I have a question regarding the existing recursive_decompose function. So, my question is: I would appreciate any ideas you might have. Thank you in advance ;) |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Sorry, I can't help - it just don't work. |
Beta Was this translation helpful? Give feedback.
-
There is a way to explode clipped block references. It is not possible to clip arbitrary DXF entities with These new DXF entities are not related to the input entities! The layer is preserved but everything else is lost e.g. dashed lines will be exploded into short solid lines, similar to importing PDF files. import ezdxf
from ezdxf import xclip
from ezdxf.addons.drawing import Frontend, RenderContext, dxf
def main():
doc = ezdxf.readfile("xclip.dxf")
msp = doc.modelspace()
backend = dxf.DXFBackend(msp) # target layout msp could be a new BLOCK
frontend = Frontend(RenderContext(doc), backend)
for insert in msp.query("INSERT"):
if xclip.XClip(insert).is_clipping_enabled:
frontend.draw_entities([insert])
insert.destroy()
doc.saveas("exploded.dxf")
if __name__ == "__main__":
main() input file: xclip.zip As an example the |
Beta Was this translation helpful? Give feedback.
There is a way to explode clipped block references.
It is not possible to clip arbitrary DXF entities with
ezdxf
but it is possible by using thedrawing
add-on and theDXFBackend
.This process converts all entities inside the clipped block reference into drawing primitives. The clipping path is applied to the drawing primitives and the result is exported as DXF entities.
These new DXF entities are not related to the input entities! The layer is preserved but everything else is lost e.g. dashed lines will be exploded into short solid lines, similar to importing PDF files.