Forum Replies Created
-
AuthorPosts
-
jgnedy
MemberThanks Ronald. I found your second method to work the best for me. I wrote a helper function in a separate module, then used the with block in my function that returns a cell. In this way, the expensive hull calculation is contained.
@contextmanager def temp_attributes(obj, **kwargs): prev_vals = {k: getattr(obj, k) for k in kwargs} for k, v in kwargs.items(): setattr(obj, k, v) try: yield finally: for k, v in prev_vals.items(): setattr(obj, k, v) --- with temp_attributes(nd.cfg, use_hull=True, hull_based_bbox=True): with Cell('main') as main: ...jgnedy
MemberI understand a little better. I was hoping to use the bbox (or hull) to extract tight bounding box dimensions of a cell containing many elements, ignoring such rotated bounding boxes of child cells. As you say, the hull of basic elements intentionally matches its bounding box, leading to a similar issue in this case. I thought to try something like “instantiate=False” in the child cell, and/or “hull=True, hull_based_bbox=True”, but no luck. Do you see a way to do this?
Thanks,
Joe
jgnedy
MemberThanks Ronald, good to know. I’ll look into using pathfinder if/when it is ready. I do see one forum post regarding it.
-Joe
jgnedy
MemberThanks! I was confused as to the purpose of the instantiate argument. I am now using both instantiate and nd.cfg.cellnames.
-
AuthorPosts