There are hundreds of regions to examine in my drawing, so my code becomes a bit time consuming.
(1) If we arrive at a solution I suspect it will be speedy enough, but it will take some work on your part to adequately describe the end game and the initial -- interim -- and final steps -- you're taking to arrive there.
(2) Sample drawings -- original line work -- initial created regions -- and then desired final regions -- will significantly reduce time spent.
If I understood you correctly, your approach would be a 'fake explode' with an option to inspect the 'spawned' entities? I tried implementing it, but the '_explode' function returns nil when selecting a region I'd like to inspect.
(3) Are you passing an entity name or an object to the function? Every legit object I used to test said function yielded objects as expected.
Could you please add to your code the check if the spawned entities are regions (which would mean the original region is complex) or lines (for a simple original region).
(4) That's why the
_hosts-regions function was written -- if called like this:
(_hosts-regions a-region-object)It will return
T if the region hosts at least 1 child region, otherwise
nil.
The regions are generated with (vlax-invoke _ 'addregion (list of line entities)) so they are made up of only lines, no curves. I think this method only creates non-complex regions, but I will need a way to filter the complex ones some time soon.
(5) If you are creating regions this way I don't believe it will ever generate "complex" regions.
(6) However, if passed 12 lines representing the 2 by 2 configuration in your image -- 5 regions will be created -- 1 for each child square -- and 1 for a periphery region enclosing the others --
"the annoying one". That said, the latter will not be a "complex" region.
(7) If passed 6 lines representing the 2 by 2 configuration in your image -- 1 region will be created -- the periphery region enclosing all. It will not be a "complex" region. Interior regions will not be created.
Note: An alternate strategy may be to leverage the bpoly / boundary command. Need more info.
I also have another issue, if anyone can help. The 'addregion method does create what I need, which are regions of every enclosed space between the provided lines. But, it also creates a bigger region which is like an outline of all the smaller regions. Is there a way to avoid that big region? There may be a more than one of them, so deleting only one with the biggest area isn't an option.
(8) See response (6), adding -- everything is possible -- testing on real data -- see item (2) -- will be the acid test for any candidate code.
I'd like to help but I need a clear map -- items (1) and (2) -- to proceed. Cheers.