mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-16 13:46:54 +00:00
You can now delete a type when managing types
This commit is contained in:
@@ -439,6 +439,7 @@ class LoadTypeThumbnails(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
y_offset = (size / 2) - (height / 2)
|
y_offset = (size / 2) - (height / 2)
|
||||||
draw.rectangle([x_offset, y_offset, width + x_offset, height + y_offset], outline="white", width=2)
|
draw.rectangle([x_offset, y_offset, width + x_offset, height + y_offset], outline="white", width=2)
|
||||||
current_thickness = 0
|
current_thickness = 0
|
||||||
|
del thicknesses[-1]
|
||||||
for thickness in thicknesses:
|
for thickness in thicknesses:
|
||||||
current_thickness += thickness
|
current_thickness += thickness
|
||||||
if element.is_a("IfcSlabType"):
|
if element.is_a("IfcSlabType"):
|
||||||
|
|||||||
@@ -76,12 +76,16 @@ class LaunchTypeManager(bpy.types.Operator):
|
|||||||
row = box.row()
|
row = box.row()
|
||||||
row.template_icon(icon_value=relating_type["icon_id"], scale=4)
|
row.template_icon(icon_value=relating_type["icon_id"], scale=4)
|
||||||
|
|
||||||
row = box.row()
|
row = box.row(align=True)
|
||||||
|
|
||||||
op = row.operator("bim.add_constr_type_instance", icon="ADD")
|
op = row.operator("bim.add_constr_type_instance", icon="ADD")
|
||||||
op.from_invoke = True
|
op.from_invoke = True
|
||||||
op.ifc_class = relating_type["ifc_class"]
|
op.ifc_class = relating_type["ifc_class"]
|
||||||
op.relating_type_id = relating_type["id"]
|
op.relating_type_id = relating_type["id"]
|
||||||
|
|
||||||
|
op = row.operator("bim.remove_type", icon="X", text="")
|
||||||
|
op.element = relating_type["id"]
|
||||||
|
|
||||||
|
|
||||||
class BIM_PT_authoring(Panel):
|
class BIM_PT_authoring(Panel):
|
||||||
bl_label = "Architectural"
|
bl_label = "Architectural"
|
||||||
|
|||||||
@@ -21,12 +21,13 @@ from . import ui, prop, operator
|
|||||||
|
|
||||||
classes = (
|
classes = (
|
||||||
operator.AssignType,
|
operator.AssignType,
|
||||||
operator.UnassignType,
|
|
||||||
operator.EnableEditingType,
|
|
||||||
operator.DisableEditingType,
|
operator.DisableEditingType,
|
||||||
|
operator.EnableEditingType,
|
||||||
|
operator.RemoveType,
|
||||||
operator.SelectSimilarType,
|
operator.SelectSimilarType,
|
||||||
operator.SelectTypeObjects,
|
|
||||||
operator.SelectType,
|
operator.SelectType,
|
||||||
|
operator.SelectTypeObjects,
|
||||||
|
operator.UnassignType,
|
||||||
prop.BIMTypeProperties,
|
prop.BIMTypeProperties,
|
||||||
ui.BIM_PT_type,
|
ui.BIM_PT_type,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -166,3 +166,19 @@ class SelectTypeObjects(bpy.types.Operator):
|
|||||||
if obj:
|
if obj:
|
||||||
obj.select_set(True)
|
obj.select_set(True)
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
|
|
||||||
|
class RemoveType(bpy.types.Operator, tool.Ifc.Operator):
|
||||||
|
bl_idname = "bim.remove_type"
|
||||||
|
bl_label = "Remove Type"
|
||||||
|
bl_options = {"REGISTER"}
|
||||||
|
element: bpy.props.IntProperty()
|
||||||
|
|
||||||
|
def _execute(self, context):
|
||||||
|
element = tool.Ifc.get().by_id(self.element)
|
||||||
|
obj = tool.Ifc.get_object(element)
|
||||||
|
ifcopenshell.api.run("root.remove_product", tool.Ifc.get(), product=element)
|
||||||
|
if obj:
|
||||||
|
tool.Ifc.unlink(obj=obj)
|
||||||
|
bpy.data.objects.remove(obj)
|
||||||
|
return {"FINISHED"}
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ class Cad:
|
|||||||
p3 = p3.to_3d()
|
p3 = p3.to_3d()
|
||||||
p4 = p4.to_3d()
|
p4 = p4.to_3d()
|
||||||
results = mathutils.geometry.intersect_line_line(p1, p2, p3, p4)
|
results = mathutils.geometry.intersect_line_line(p1, p2, p3, p4)
|
||||||
if is_2d:
|
if is_2d and results:
|
||||||
r1, r2 = results
|
r1, r2 = results
|
||||||
return r1.to_2d() if r1 else r1, r2.to_2d() if r2 else r2
|
return r1.to_2d() if r1 else r1, r2.to_2d() if r2 else r2
|
||||||
return results
|
return results
|
||||||
|
|||||||
@@ -158,7 +158,6 @@ class Usecase:
|
|||||||
return self.added_elements[element.id()]
|
return self.added_elements[element.id()]
|
||||||
new = self.file.add(element)
|
new = self.file.add(element)
|
||||||
self.added_elements[element.id()] = new
|
self.added_elements[element.id()] = new
|
||||||
self.check_inverses(element)
|
|
||||||
for subelement in self.settings["library"].traverse(element):
|
for subelement in self.settings["library"].traverse(element):
|
||||||
self.check_inverses(subelement)
|
self.check_inverses(subelement)
|
||||||
return new
|
return new
|
||||||
|
|||||||
Reference in New Issue
Block a user