mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 17:31:45 +00:00
Minor fix
This commit is contained in:
@@ -327,7 +327,7 @@ class EnableEditingSketchExtrusionProfile(bpy.types.Operator, tool.Ifc.Operator)
|
||||
context.scene["sketcher"].update(json.loads(pset["Entities"]))
|
||||
bpy.context.view_layer.update()
|
||||
bpy.ops.wm.tool_set_by_id(name="sketcher.slvs_select")
|
||||
bpy.ops.view3d.slvs_set_all_constraints_visibility(visibility='SHOW')
|
||||
bpy.ops.view3d.slvs_set_all_constraints_visibility(visibility="SHOW")
|
||||
return {"FINISHED"}
|
||||
|
||||
body = ifcopenshell.util.representation.get_representation(element, "Model", "Body", "MODEL_VIEW")
|
||||
@@ -692,12 +692,14 @@ class EnableEditingExtrusionProfile(bpy.types.Operator, tool.Ifc.Operator):
|
||||
x = self.convert_unit_to_si(profile.XDim)
|
||||
y = self.convert_unit_to_si(profile.YDim)
|
||||
|
||||
self.vertices.extend([
|
||||
position @ p_position @ Vector((-x/2, -y/2, 0.0)),
|
||||
position @ p_position @ Vector((x/2, -y/2, 0.0)),
|
||||
position @ p_position @ Vector((x/2, y/2, 0.0)),
|
||||
position @ p_position @ Vector((-x/2, y/2, 0.0)),
|
||||
])
|
||||
self.vertices.extend(
|
||||
[
|
||||
position @ p_position @ Vector((-x / 2, -y / 2, 0.0)),
|
||||
position @ p_position @ Vector((x / 2, -y / 2, 0.0)),
|
||||
position @ p_position @ Vector((x / 2, y / 2, 0.0)),
|
||||
position @ p_position @ Vector((-x / 2, y / 2, 0.0)),
|
||||
]
|
||||
)
|
||||
self.edges.extend([(i, i + 1) for i in range(0, len(self.vertices))])
|
||||
self.edges[-1] = (len(self.vertices) - 1, 0) # Close the loop
|
||||
|
||||
@@ -821,7 +823,7 @@ class EditExtrusionProfile(bpy.types.Operator, tool.Ifc.Operator):
|
||||
center = self.convert_si_to_unit(list(position_i @ p1.lerp(p2, 0.5)))
|
||||
radius = self.convert_si_to_unit((p1 - p2).length / 2)
|
||||
return tool.Ifc.get().createIfcCircle(
|
||||
tool.Ifc.get().createIfcAxis2Placement2D(tool.Ifc.get().createIfcCartesianPoint(center)), radius
|
||||
tool.Ifc.get().createIfcAxis2Placement2D(tool.Ifc.get().createIfcCartesianPoint(center[0:2])), radius
|
||||
)
|
||||
if tool.Ifc.get().schema == "IFC2X3":
|
||||
points = []
|
||||
|
||||
@@ -270,6 +270,9 @@ class Hotkey(bpy.types.Operator, tool.Ifc.Operator):
|
||||
bl_label = "Hotkey"
|
||||
bl_options = {"REGISTER", "UNDO"}
|
||||
hotkey: bpy.props.StringProperty()
|
||||
x: bpy.props.FloatProperty(name="X", default=0.5)
|
||||
y: bpy.props.FloatProperty(name="Y", default=0.5)
|
||||
z: bpy.props.FloatProperty(name="Z", default=0.5)
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
@@ -285,15 +288,23 @@ class Hotkey(bpy.types.Operator, tool.Ifc.Operator):
|
||||
getattr(self, f"hotkey_{self.hotkey}")()
|
||||
return {"FINISHED"}
|
||||
|
||||
def invoke(self, context, event):
|
||||
# https://blender.stackexchange.com/questions/276035/how-do-i-make-operators-remember-their-property-values-when-called-from-a-hotkey
|
||||
self.props = context.scene.BIMModelProperties
|
||||
self.x = self.props.x
|
||||
self.y = self.props.y
|
||||
self.z = self.props.z
|
||||
return self.execute(context)
|
||||
|
||||
def draw(self, context):
|
||||
props = context.scene.BIMModelProperties
|
||||
if self.hotkey == "S_O":
|
||||
row = self.layout.row()
|
||||
row.prop(props, "x")
|
||||
row.prop(self, "x")
|
||||
row = self.layout.row()
|
||||
row.prop(props, "y")
|
||||
row.prop(self, "y")
|
||||
row = self.layout.row()
|
||||
row.prop(props, "z")
|
||||
row.prop(self, "z")
|
||||
|
||||
def hotkey_S_A(self):
|
||||
bpy.ops.bim.add_constr_type_instance()
|
||||
@@ -376,7 +387,10 @@ class Hotkey(bpy.types.Operator, tool.Ifc.Operator):
|
||||
if len(bpy.context.selected_objects) == 2:
|
||||
bpy.ops.bim.add_opening()
|
||||
else:
|
||||
bpy.ops.bim.add_potential_opening(x=self.props.x, y=self.props.y, z=self.props.z)
|
||||
bpy.ops.bim.add_potential_opening(x=self.x, y=self.y, z=self.z)
|
||||
self.props.x = self.x
|
||||
self.props.y = self.y
|
||||
self.props.z = self.z
|
||||
|
||||
def hotkey_A_D(self):
|
||||
bpy.ops.bim.toggle_decomposition_parenting()
|
||||
|
||||
@@ -401,7 +401,6 @@ class Pset:
|
||||
class Qto:
|
||||
def get_radius_of_selected_vertices(cls, obj): pass
|
||||
def set_qto_result(cls, result): pass
|
||||
def set_active_object(cls, object): pass
|
||||
def get_pset_qto_object_ifc_info(cls, object): pass
|
||||
def get_pset_qto_properties(cls, object): pass
|
||||
def get_pset_qto_name(cls, object): pass
|
||||
@@ -410,7 +409,6 @@ class Qto:
|
||||
def get_pset_qto_id(cls, object): pass
|
||||
def get_pset_qto_name(cls, object): pass
|
||||
def get_new_quantity(cls, object, quantity_name, alternative_prop_names): pass
|
||||
def get_non_calculated_value(cls): pass
|
||||
def get_rounded_value(cls, new_quantity): pass
|
||||
def get_calculated_quantities(cls, object, pset_qto_properties): pass
|
||||
def assign_pset_qto_to_selected_object(cls, object): pass
|
||||
|
||||
@@ -67,7 +67,8 @@ class Model(blenderbim.core.tool.Model):
|
||||
if obj:
|
||||
opening_obj.parent = obj
|
||||
opening_obj.matrix_parent_inverse = obj.matrix_world.inverted()
|
||||
ifc_importer.place_objects_in_collections()
|
||||
for obj in ifc_importer.added_data.values():
|
||||
bpy.context.scene.collection.objects.link(obj)
|
||||
return ifc_importer.added_data.values()
|
||||
|
||||
@classmethod
|
||||
|
||||
@@ -45,7 +45,7 @@ class TestCreateProject:
|
||||
context_type="Model", context_identifier="Body", target_view="MODEL_VIEW", parent="model"
|
||||
).should_be_called().will_return("body")
|
||||
project.run_context_add_context(
|
||||
context_type="MODEL", context_identifier="Axis", target_view="GRAPH_VIEW", parent="model"
|
||||
context_type="Model", context_identifier="Axis", target_view="GRAPH_VIEW", parent="model"
|
||||
).should_be_called()
|
||||
project.run_context_add_context(
|
||||
context_type="Model", context_identifier="Box", target_view="MODEL_VIEW", parent="model"
|
||||
|
||||
@@ -213,7 +213,7 @@ class Parser:
|
||||
for space in rel.RelatedObjects:
|
||||
if not space.is_a("IfcSpace"):
|
||||
continue
|
||||
self.zones[element.Name + space.Name] = {
|
||||
self.zones[(element.Name or "Unnamed") + (space.Name or "Unnamed")] = {
|
||||
"Name": element.Name,
|
||||
"AuthorOrganizationName": element.OwnerHistory.OwningUser.TheOrganization.Name,
|
||||
"AuthorDate": ifcopenshell.util.date.ifc2datetime(
|
||||
|
||||
@@ -500,14 +500,12 @@ class Writer:
|
||||
# "ririooooooooooeee",
|
||||
# )
|
||||
|
||||
def write_data(self, sheet, data, fieldnames, colours, sort_fields, custom_data={}):
|
||||
self.sheet_data[sheet] = {"headers": fieldnames + list(custom_data.keys()), "colours": colours, "rows": []}
|
||||
def write_data(self, sheet, data, fieldnames, colours, sort_fields):
|
||||
self.sheet_data[sheet] = {"headers": fieldnames, "colours": colours, "rows": []}
|
||||
for row in multikeysort(list(data.values()), sort_fields):
|
||||
values = []
|
||||
for fieldname in fieldnames:
|
||||
values.append(row[fieldname])
|
||||
for fieldname in custom_data.keys():
|
||||
values.append(row[fieldname])
|
||||
self.sheet_data[sheet]["rows"].append(values)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user