mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-26 18:21:59 +00:00
Dumb grids are auto placed in an IfcSite if it can be detected for convenience
This commit is contained in:
@@ -14,7 +14,18 @@ def add_object(self, context):
|
|||||||
default_collection.objects.unlink(obj)
|
default_collection.objects.unlink(obj)
|
||||||
|
|
||||||
collection = bpy.data.collections.new("IfcGrid/" + name)
|
collection = bpy.data.collections.new("IfcGrid/" + name)
|
||||||
bpy.context.view_layer.active_layer_collection.collection.children.link(collection)
|
has_site_collection = False
|
||||||
|
for child in bpy.context.view_layer.layer_collection.children:
|
||||||
|
if "IfcProject/" not in child.name:
|
||||||
|
continue
|
||||||
|
for grandchild in child.children:
|
||||||
|
if "IfcSite/" not in grandchild.name:
|
||||||
|
continue
|
||||||
|
has_site_collection = True
|
||||||
|
grandchild.collection.children.link(collection)
|
||||||
|
break
|
||||||
|
if not has_site_collection:
|
||||||
|
bpy.context.view_layer.active_layer_collection.collection.children.link(collection)
|
||||||
collection.objects.link(obj)
|
collection.objects.link(obj)
|
||||||
|
|
||||||
axes_collection = bpy.data.collections.new("UAxes")
|
axes_collection = bpy.data.collections.new("UAxes")
|
||||||
|
|||||||
Reference in New Issue
Block a user