It looks like you're new here. If you want to get involved, click one of these buttons!
Hi,
I would like to group objects within an area inside the parent cell into a smaller cell, which can be easily achieved through select and make cell using the GUI. However, I couldn't find a way to do that using the Python Script. I tried the clip function but the clip won't remove the co-responding area in the parent cell. Any suggestion on suitable function/class would be very helpful.
Thanks.
Comments
Hi @billlch,
actually you're not quite right. Turning a rectangular selection into a cell is not something that is easily achieved by the UI function. It will only turn the selected objects into a cell. These do not necessarily form a rectangular region. It maybe less (in case of polygons partially outside the selection box) or more (in case or array instances with array member outside the selection box).
A script that emulates the UI function can be made, but a script that truly turns a selected rectangle into a cell is a difficult endeavor. Seamlessly deleting objects from a cell while preserving as much as possible from the original hierarchy is a complex algorithm.
One approximation is to separate the area into clips and taking out the one you're interesting in, then flatten the others. Like this:
In that case, you create five clips, take out the red one and flatten the other clip cells, so they would reveal the original hierarchy - except at the cut lines.
Matthias
Thank you for your comment! I have thought about the 5 clips method but it felt like a not so elegant solution compared to the selection and make cell approach. I didn't realize it is much more complicated under the hood! I guess I will write a custom function that turn large rectangle into smaller rectangles.