mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-14 03:14:23 +00:00
Merge branch 'v0.8.0' into ifcmax/initial-refresh
This commit is contained in:
+1
-1
@@ -3,7 +3,7 @@ name = "IfcOpenShell"
|
||||
version = "0.0.0"
|
||||
dependencies = [
|
||||
"black==25.12",
|
||||
"ruff==0.14.10",
|
||||
"ruff==0.14.13",
|
||||
"poethepoet",
|
||||
"gersemi==0.24",
|
||||
]
|
||||
|
||||
@@ -42,15 +42,12 @@ classes = (
|
||||
ui.BIM_PT_object_documents,
|
||||
ui.BIM_UL_documents,
|
||||
ui.BIM_UL_document_objects,
|
||||
ui.BIM_MT_object_documents_context_menu,
|
||||
)
|
||||
|
||||
|
||||
def register():
|
||||
bpy.types.Scene.BIMDocumentProperties = bpy.props.PointerProperty(type=prop.BIMDocumentProperties)
|
||||
bpy.types.VIEW3D_MT_object_context_menu.append(ui.add_object_documents_context_menu)
|
||||
|
||||
|
||||
def unregister():
|
||||
del bpy.types.Scene.BIMDocumentProperties
|
||||
bpy.types.VIEW3D_MT_object_context_menu.remove(ui.add_object_documents_context_menu)
|
||||
|
||||
@@ -265,68 +265,3 @@ class BIM_UL_document_objects(UIList):
|
||||
op = row.operator("bim.unassign_document", text="", icon="X")
|
||||
op.document = document.ifc_definition_id
|
||||
op.obj = item.name
|
||||
|
||||
|
||||
def add_object_documents_context_menu(self, context):
|
||||
if not context.active_object:
|
||||
return
|
||||
|
||||
if not tool.Blender.get_ifc_definition_id(context.active_object):
|
||||
return
|
||||
|
||||
self.layout.separator()
|
||||
self.layout.menu("BIM_MT_object_documents_context_menu", icon="FILE")
|
||||
|
||||
|
||||
class BIM_MT_object_documents_context_menu(bpy.types.Menu):
|
||||
bl_idname = "BIM_MT_object_documents_context_menu"
|
||||
bl_label = "Documents"
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
if not context.selected_objects:
|
||||
layout.label(text="No documents", icon="INFO")
|
||||
return
|
||||
|
||||
if len(context.selected_objects) > 1:
|
||||
layout.label(text="Select a single object to see its referenced documents", icon="INFO")
|
||||
return
|
||||
|
||||
obj = context.active_object
|
||||
if not obj or not tool.Blender.get_ifc_definition_id(obj):
|
||||
layout.label(text="No documents", icon="INFO")
|
||||
return
|
||||
|
||||
if not ObjectDocumentData.is_loaded:
|
||||
ObjectDocumentData.load()
|
||||
|
||||
if not ObjectDocumentData.data["documents"]:
|
||||
layout.label(text="No Documents", icon="FILE")
|
||||
else:
|
||||
for document in ObjectDocumentData.data["documents"]:
|
||||
row = layout.row(align=True)
|
||||
|
||||
with_ifc_icon = document["location"] and document["location"].lower().endswith(".ifc")
|
||||
with_url_icon = bool(document["location"])
|
||||
|
||||
if with_ifc_icon:
|
||||
row.operator("bim.open_ifc_document", icon="HIDE_OFF", text="").uri = document["location"]
|
||||
else:
|
||||
row.label(text="", icon="BLANK1")
|
||||
|
||||
if with_url_icon:
|
||||
row.operator("bim.open_uri", icon="URL", text="").uri = document["location"]
|
||||
else:
|
||||
row.label(text="", icon="BLANK1")
|
||||
|
||||
doc_entity = None
|
||||
if "id" in document:
|
||||
doc_entity = tool.Ifc.get().by_id(document["id"])
|
||||
|
||||
if doc_entity and doc_entity.is_a("IfcDocumentReference"):
|
||||
display_text = document.get("description") or ""
|
||||
else:
|
||||
display_text = document.get("name") or ""
|
||||
|
||||
row.label(text=f"{document['identification'] or ''}: {display_text}")
|
||||
|
||||
@@ -22,6 +22,7 @@ from . import ui, prop, operator
|
||||
classes = (
|
||||
operator.DrawSystemArrows,
|
||||
operator.GetConnectedSystemElements,
|
||||
operator.IfcSverchokUseBonsaiFile,
|
||||
operator.ResizeToStorey,
|
||||
operator.SetOverrideColour,
|
||||
operator.SnapSpacesTogether,
|
||||
|
||||
@@ -348,3 +348,24 @@ class DrawSystemArrows(bpy.types.Operator, tool.Ifc.Operator):
|
||||
)
|
||||
)
|
||||
return matrix
|
||||
|
||||
|
||||
class IfcSverchokUseBonsaiFile(bpy.types.Operator, tool.Ifc.Operator):
|
||||
bl_idname = "bim.ifcsverchok_use_bonsai_file"
|
||||
bl_label = "Use Bonsai IFC File"
|
||||
bl_description = "Apply current IfcSverchok tree to the active Bonsai file."
|
||||
bl_options = {"REGISTER", "UNDO"}
|
||||
|
||||
def _execute(self, context):
|
||||
import sverchok.node_tree
|
||||
|
||||
ifc_file = tool.Ifc.get()
|
||||
if ifc_file is None:
|
||||
self.report({"ERROR"}, "No active IFC file.")
|
||||
return {"CANCELLED"}
|
||||
|
||||
space_data = context.space_data
|
||||
assert isinstance(space_data, bpy.types.SpaceNodeEditor)
|
||||
node_tree = space_data.node_tree
|
||||
assert isinstance(node_tree, sverchok.node_tree.SverchCustomTree)
|
||||
tool.Model.run_ifcsverchok_graph_on_bonsai_file(node_tree)
|
||||
|
||||
@@ -17,9 +17,7 @@
|
||||
# along with Bonsai. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import bpy
|
||||
import bmesh
|
||||
|
||||
import ifcopenshell
|
||||
import bonsai.tool as tool
|
||||
|
||||
|
||||
@@ -32,9 +30,23 @@ class ApplyExternalParametricGeometry(bpy.types.Operator, tool.Ifc.Operator):
|
||||
def _execute(self, context):
|
||||
obj = context.active_object
|
||||
assert obj
|
||||
assert (active_representation := tool.Geometry.get_active_representation(obj))
|
||||
ifc_context = active_representation.ContextOfItems
|
||||
tool.Model.add_representation(obj, ifc_context)
|
||||
props = tool.Model.get_epg_props(obj)
|
||||
|
||||
# TODO: consider nodes being empty.
|
||||
if props.geometry_source == "GEONODES":
|
||||
assert (active_representation := tool.Geometry.get_active_representation(obj))
|
||||
ifc_context = active_representation.ContextOfItems
|
||||
|
||||
tool.Model.add_representation(obj, ifc_context)
|
||||
elif props.geometry_source == "IFCSVERCHOK":
|
||||
import ifcsverchok.helper as helper
|
||||
|
||||
nodes = props.sverchok_nodes
|
||||
assert nodes is not None
|
||||
tool.Model.run_ifcsverchok_graph_on_bonsai_file(nodes)
|
||||
output_node = tool.Model.get_ifcsverchok_shape_output(nodes)
|
||||
representation = helper.get_socket_value(output_node.inputs, "Representation")
|
||||
tool.Model.replace_object_ifc_representation(representation.ContextOfItems, obj, representation)
|
||||
|
||||
props.is_editing = False
|
||||
return {"FINISHED"}
|
||||
|
||||
@@ -33,6 +33,9 @@ from typing import TYPE_CHECKING, Literal, get_args, Union, Any, Optional
|
||||
from collections.abc import Callable
|
||||
from mathutils import Vector
|
||||
|
||||
if TYPE_CHECKING:
|
||||
import sverchok.node_tree
|
||||
|
||||
|
||||
def get_ifc_class(self: "BIMModelProperties", context: bpy.types.Context) -> list[tuple[str, str, str]]:
|
||||
if not AuthoringData.is_loaded:
|
||||
@@ -1709,12 +1712,16 @@ def update_is_editing(self: "BIMExternalParametricGeometryProperties", context:
|
||||
if self.is_editing:
|
||||
return
|
||||
|
||||
assert isinstance(self.id_data, bpy.types.Object)
|
||||
tool.Model.clean_up_parametric_geometry(self.id_data)
|
||||
del self["is_editing"]
|
||||
del self["geo_nodes"]
|
||||
self.property_unset("is_editing")
|
||||
self.property_unset("geo_nodes")
|
||||
self.property_unset("sverchok_nodes")
|
||||
|
||||
|
||||
def update_geo_nodes(self: "BIMExternalParametricGeometryProperties", context: bpy.types.Context) -> None:
|
||||
assert isinstance(self.id_data, bpy.types.Object)
|
||||
|
||||
if self.geo_nodes:
|
||||
tool.Model.setup_parametric_geometry(self.id_data)
|
||||
return
|
||||
@@ -1725,14 +1732,25 @@ def update_geo_nodes(self: "BIMExternalParametricGeometryProperties", context: b
|
||||
del self["geo_nodes"]
|
||||
|
||||
|
||||
def poll_sverchok_nodes(self: "BIMExternalParametricGeometryProperties", node_tree: bpy.types.NodeTree) -> bool:
|
||||
return node_tree.bl_idname == "SverchCustomTreeType"
|
||||
|
||||
|
||||
class BIMExternalParametricGeometryProperties(bpy.types.PropertyGroup):
|
||||
is_editing: bpy.props.BoolProperty(
|
||||
is_editing: bpy.props.BoolProperty( # pyright: ignore[reportRedeclaration]
|
||||
name="Is Editing Paramteric Geometry",
|
||||
description="Toggle editing parametric geometry.",
|
||||
default=False,
|
||||
update=update_is_editing,
|
||||
)
|
||||
geo_nodes: bpy.props.PointerProperty(
|
||||
geometry_source: bpy.props.EnumProperty( # pyright: ignore[reportRedeclaration]
|
||||
name="Geometry Source",
|
||||
items=[
|
||||
("GEONODES", "Geometry Nodes", ""),
|
||||
("IFCSVERCHOK", "IFC Sverchok", ""),
|
||||
],
|
||||
)
|
||||
geo_nodes: bpy.props.PointerProperty( # pyright: ignore[reportRedeclaration]
|
||||
name="Geometry Nodes",
|
||||
description="Geometry nodes tree to use as a source for representation.",
|
||||
type=bpy.types.GeometryNodeTree,
|
||||
@@ -1740,6 +1758,15 @@ class BIMExternalParametricGeometryProperties(bpy.types.PropertyGroup):
|
||||
poll=lambda self, node_tree: not node_tree.name.startswith("BBIM_EPG"),
|
||||
)
|
||||
|
||||
sverchok_nodes: bpy.props.PointerProperty( # pyright: ignore[reportRedeclaration]
|
||||
name="Sverchok Nodes",
|
||||
description="Sverchok node tree to use as a source for representation.",
|
||||
type=bpy.types.NodeTree,
|
||||
poll=poll_sverchok_nodes,
|
||||
)
|
||||
|
||||
if TYPE_CHECKING:
|
||||
is_editing: bool
|
||||
geometry_source: Literal["GEONODES", "IFCSVERCHOK"]
|
||||
geo_nodes: Union[bpy.types.GeometryNodeTree, None]
|
||||
sverchok_nodes: Union[sverchok.node_tree.SverchCustomTree, None]
|
||||
|
||||
@@ -225,7 +225,7 @@ class DumbSlabPlaner:
|
||||
for inverse in tool.Ifc.get().get_inverse(layer_set):
|
||||
if not inverse.is_a("IfcMaterialLayerSetUsage") or inverse.LayerSetDirection != "AXIS3":
|
||||
continue
|
||||
|
||||
|
||||
if tool.Ifc.get().schema == "IFC2X3":
|
||||
for rel in tool.Ifc.get().get_inverse(inverse):
|
||||
if not rel.is_a("IfcRelAssociatesMaterial"):
|
||||
@@ -277,10 +277,12 @@ class DumbSlabPlaner:
|
||||
return
|
||||
self.change_thickness(element, total_thickness)
|
||||
|
||||
def change_thickness(self, element: ifcopenshell.entity_instance, thickness: float, preserve_offset: bool = False) -> None:
|
||||
def change_thickness(
|
||||
self, element: ifcopenshell.entity_instance, thickness: float, preserve_offset: bool = False
|
||||
) -> None:
|
||||
if tool.Model.get_usage_type(element) != "LAYER3":
|
||||
return
|
||||
|
||||
|
||||
layer_params = tool.Model.get_material_layer_parameters(element)
|
||||
ifc_file = tool.Ifc.get()
|
||||
body_context = ifcopenshell.util.representation.get_context(tool.Ifc.get(), "Model", "Body", "MODEL_VIEW")
|
||||
@@ -299,7 +301,7 @@ class DumbSlabPlaner:
|
||||
extrusion = tool.Model.get_extrusion(representation)
|
||||
if extrusion:
|
||||
direction_ratios = Vector(extrusion.ExtrudedDirection.DirectionRatios)
|
||||
|
||||
|
||||
# Calculate the actual extrusion angle from vertical
|
||||
extrusion_angle = 0
|
||||
if direction_ratios.length > 0:
|
||||
|
||||
@@ -16,8 +16,10 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Bonsai. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from __future__ import annotations
|
||||
import bpy
|
||||
import bonsai.bim
|
||||
from bonsai.bim import module
|
||||
import bonsai.tool as tool
|
||||
from bpy.types import Panel, Menu
|
||||
from bonsai.bim.helper import prop_with_search
|
||||
@@ -39,6 +41,9 @@ if TYPE_CHECKING or bpy.app.version >= (5, 0, 0):
|
||||
else:
|
||||
import bl_ui_utils.layout as bl_ui_utils_layout
|
||||
|
||||
if TYPE_CHECKING:
|
||||
import bonsai.bim.module.model.prop as module_prop
|
||||
|
||||
|
||||
class BIM_MT_type_manager_menu(bpy.types.Menu):
|
||||
bl_label = "Type Manager Menu"
|
||||
@@ -664,21 +669,33 @@ class BIM_PT_external_parametric_geometry(bpy.types.Panel):
|
||||
|
||||
row.operator("bim.apply_external_parametric_geometry", icon="CHECKMARK", text="")
|
||||
row.prop(props, "is_editing", icon="CANCEL", text="")
|
||||
row = layout.row(align=True)
|
||||
row.prop_search(props, "geo_nodes", bpy.data, "node_groups")
|
||||
if props.geo_nodes:
|
||||
assert (modifier := tool.Model.get_epg_modifier(obj))
|
||||
inputs = tool.Model.get_parametric_geometry_inputs(modifier)
|
||||
# NOTE: users won't be able to see inputs descriptions.
|
||||
# If we add group node inputs as modifiers inputs, descriptions will be visible.
|
||||
# But then we need to ensure inputs are up to date
|
||||
# (e.g. probably just by adding a refresh button).
|
||||
for input in inputs:
|
||||
row = layout.row(align=True)
|
||||
row.prop(input, "default_value", text=input.name)
|
||||
layout.prop(props, "geometry_source")
|
||||
if props.geometry_source == "GEONODES":
|
||||
row = layout.row(align=True)
|
||||
row.prop_search(props, "geo_nodes", bpy.data, "node_groups")
|
||||
if props.geo_nodes:
|
||||
assert (modifier := tool.Model.get_epg_modifier(obj))
|
||||
inputs = tool.Model.get_parametric_geometry_inputs(modifier)
|
||||
# NOTE: users won't be able to see inputs descriptions.
|
||||
# If we add group node inputs as modifiers inputs, descriptions will be visible.
|
||||
# But then we need to ensure inputs are up to date
|
||||
# (e.g. probably just by adding a refresh button).
|
||||
for input in inputs:
|
||||
row = layout.row(align=True)
|
||||
row.prop(input, "default_value", text=input.name)
|
||||
elif props.geometry_source == "IFCSVERCHOK":
|
||||
row = layout.row(align=True)
|
||||
row.prop(props, "sverchok_nodes")
|
||||
if props.sverchok_nodes:
|
||||
# TODO: Updating mesh in `draw` is not ideal,
|
||||
# should find a way to update only on graph changes.
|
||||
res = tool.Model.update_mesh_from_sverchok(obj, props.sverchok_nodes)
|
||||
if res is not None:
|
||||
print(res)
|
||||
layout.label(text=f"Error Updating from Graph, See System Console", icon="ERROR")
|
||||
|
||||
|
||||
def draw_door_properties(layout: bpy.types.UILayout, props: bpy.types.PropertyGroup) -> None:
|
||||
def draw_door_properties(layout: bpy.types.UILayout, props: module_prop.BIMDoorProperties) -> None:
|
||||
"""Draw door properties UI (shared between properties panel and preferences)."""
|
||||
# General properties
|
||||
general_props = props.get_general_kwargs()
|
||||
@@ -698,7 +715,7 @@ def draw_door_properties(layout: bpy.types.UILayout, props: bpy.types.PropertyGr
|
||||
layout.prop(props, prop)
|
||||
|
||||
|
||||
def draw_window_properties(layout: bpy.types.UILayout, props: bpy.types.PropertyGroup) -> None:
|
||||
def draw_window_properties(layout: bpy.types.UILayout, props: module_prop.BIMWindowProperties) -> None:
|
||||
"""Draw window properties UI (shared between properties panel and preferences)."""
|
||||
number_of_panels, panels_data = props.window_types_panels[props.window_type]
|
||||
|
||||
@@ -734,7 +751,7 @@ def draw_window_properties(layout: bpy.types.UILayout, props: bpy.types.Property
|
||||
cols[panel_i + 1].prop(props, prop, index=panel_i, text="")
|
||||
|
||||
|
||||
def draw_railing_properties(layout: bpy.types.UILayout, props: bpy.types.PropertyGroup) -> None:
|
||||
def draw_railing_properties(layout: bpy.types.UILayout, props: module_prop.BIMRailingProperties) -> None:
|
||||
"""Draw railing properties UI (shared between properties panel and preferences)."""
|
||||
general_props = props.get_general_kwargs()
|
||||
for prop in general_props:
|
||||
@@ -746,7 +763,7 @@ def draw_railing_properties(layout: bpy.types.UILayout, props: bpy.types.Propert
|
||||
layout.prop(props, prop)
|
||||
|
||||
|
||||
def draw_roof_properties(layout: bpy.types.UILayout, props: bpy.types.PropertyGroup) -> None:
|
||||
def draw_roof_properties(layout: bpy.types.UILayout, props: module_prop.BIMRoofProperties) -> None:
|
||||
"""Draw roof properties UI (shared between properties panel and preferences)."""
|
||||
# General properties
|
||||
general_props = props.get_general_kwargs()
|
||||
@@ -754,7 +771,7 @@ def draw_roof_properties(layout: bpy.types.UILayout, props: bpy.types.PropertyGr
|
||||
layout.prop(props, prop)
|
||||
|
||||
|
||||
def draw_stair_properties(layout: bpy.types.UILayout, props: bpy.types.PropertyGroup) -> None:
|
||||
def draw_stair_properties(layout: bpy.types.UILayout, props: module_prop.BIMStairProperties) -> None:
|
||||
"""Draw stair properties UI (shared between properties panel and preferences)."""
|
||||
for prop_name in props.get_props_kwargs():
|
||||
# Skip custom_tread_lock as it's handled with custom_first_last_tread_run
|
||||
|
||||
@@ -1039,7 +1039,7 @@ class Loader(bonsai.core.tool.Loader):
|
||||
z_coords = [v.co.z for v in mesh.vertices]
|
||||
mesh_z_min = min(z_coords)
|
||||
mesh_z_max = max(z_coords)
|
||||
|
||||
|
||||
bm = bmesh.new()
|
||||
bm.from_mesh(mesh)
|
||||
|
||||
@@ -1068,54 +1068,54 @@ class Loader(bonsai.core.tool.Loader):
|
||||
thickness_dir = -thickness_dir
|
||||
|
||||
no = thickness_dir
|
||||
|
||||
|
||||
# Find start point by projecting vertices onto thickness direction
|
||||
if len(mesh.vertices) > 0:
|
||||
projections = [Vector(v.co).dot(no) for v in mesh.vertices]
|
||||
min_proj = min(projections)
|
||||
max_proj = max(projections)
|
||||
|
||||
|
||||
centroid = sum((Vector(v.co) for v in mesh.vertices), Vector()) / len(mesh.vertices)
|
||||
centroid_proj = centroid.dot(no)
|
||||
|
||||
|
||||
if sense_factor == 1:
|
||||
start_proj = min_proj
|
||||
else:
|
||||
start_proj = max_proj
|
||||
|
||||
|
||||
offset_dist = start_proj - centroid_proj
|
||||
co = centroid + no * offset_dist
|
||||
|
||||
|
||||
actual_mesh_height = max_proj - min_proj
|
||||
else:
|
||||
co = Vector((0.0, 0.0, 0.0))
|
||||
|
||||
|
||||
advance_direction = thickness_dir
|
||||
elif usage.LayerSetDirection == "AXIS3":
|
||||
# AXIS3 layers go through slab thickness (local Z)
|
||||
no = Vector([0.0, 0.0, 1.0])
|
||||
|
||||
|
||||
# Find start point by projecting vertices onto Z direction
|
||||
if len(mesh.vertices) > 0:
|
||||
projections = [Vector(v.co).dot(no) for v in mesh.vertices]
|
||||
min_proj = min(projections)
|
||||
max_proj = max(projections)
|
||||
|
||||
|
||||
centroid = sum((Vector(v.co) for v in mesh.vertices), Vector()) / len(mesh.vertices)
|
||||
centroid_proj = centroid.dot(no)
|
||||
|
||||
|
||||
if sense_factor == 1:
|
||||
start_proj = min_proj
|
||||
else:
|
||||
start_proj = max_proj
|
||||
|
||||
|
||||
offset = start_proj - centroid_proj
|
||||
co = centroid + no * offset
|
||||
|
||||
|
||||
actual_mesh_height = max_proj - min_proj
|
||||
else:
|
||||
co = Vector((0.0, 0.0, 0.0))
|
||||
|
||||
|
||||
advance_direction = no
|
||||
elif usage.LayerSetDirection == "AXIS1":
|
||||
co = Vector((0.0, 0.0, offset))
|
||||
@@ -1156,13 +1156,13 @@ class Loader(bonsai.core.tool.Loader):
|
||||
# Calculate scale factor
|
||||
total_layer_thickness = sum(layer.LayerThickness for _, layer in layer_list)
|
||||
|
||||
if 'actual_mesh_height' not in locals():
|
||||
if "actual_mesh_height" not in locals():
|
||||
actual_mesh_height = mesh_z_max - mesh_z_min if len(mesh.vertices) > 0 else total_layer_thickness
|
||||
|
||||
thickness_scale = actual_mesh_height / total_layer_thickness if total_layer_thickness > 0 else 1.0
|
||||
|
||||
last_i = len(layer_set.MaterialLayers) - 1
|
||||
|
||||
|
||||
for idx, (original_i, layer) in enumerate(layer_list):
|
||||
if idx != last_i:
|
||||
prev_co = co.copy()
|
||||
|
||||
@@ -54,6 +54,8 @@ T = TypeVar("T")
|
||||
V_ = tool.Blender.V_
|
||||
|
||||
if TYPE_CHECKING:
|
||||
import sverchok.node_tree
|
||||
import ifcsverchok.nodes.ifc.shape_builder.shape_output
|
||||
from bonsai.bim.module.model.prop import (
|
||||
BIMModelProperties,
|
||||
BIMDoorProperties,
|
||||
@@ -2540,12 +2542,24 @@ class Model(bonsai.core.tool.Model):
|
||||
|
||||
@classmethod
|
||||
def clean_up_parametric_geometry(cls, obj: bpy.types.Object) -> None:
|
||||
# Geo nodes are using modifier.
|
||||
modifier = tool.Model.get_epg_modifier(obj)
|
||||
assert modifier
|
||||
node_tree = modifier.node_group
|
||||
assert node_tree
|
||||
bpy.data.node_groups.remove(node_tree)
|
||||
obj.modifiers.clear()
|
||||
if modifier is not None:
|
||||
node_tree = modifier.node_group
|
||||
assert node_tree
|
||||
bpy.data.node_groups.remove(node_tree)
|
||||
obj.modifiers.clear()
|
||||
|
||||
# Sverchok are changing the mesh data to preview changes.
|
||||
# TODO: probably should use modifiers with nodes and temp mesh instead.
|
||||
active_representation = tool.Geometry.get_active_representation(obj)
|
||||
assert active_representation is not None
|
||||
bonsai.core.geometry.switch_representation(
|
||||
tool.Ifc,
|
||||
tool.Geometry,
|
||||
obj=obj,
|
||||
representation=active_representation,
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def get_parametric_geometry_inputs(cls, modifier: bpy.types.NodesModifier) -> list[bpy.types.NodeSocket]:
|
||||
@@ -2557,6 +2571,51 @@ class Model(bonsai.core.tool.Model):
|
||||
|
||||
return [s for s in group_node.inputs if s.type != "GEOMETRY"]
|
||||
|
||||
@classmethod
|
||||
def get_ifcsverchok_shape_output(
|
||||
cls, node_tree: sverchok.node_tree.SverchCustomTree
|
||||
) -> ifcsverchok.nodes.ifc.shape_builder.shape_output.SvSbShapeOutput:
|
||||
from ifcsverchok.nodes.ifc.shape_builder.shape_output import SvSbShapeOutput
|
||||
|
||||
return next(n for n in node_tree.nodes if isinstance(n, SvSbShapeOutput))
|
||||
|
||||
@classmethod
|
||||
def update_mesh_from_sverchok(
|
||||
cls, obj: bpy.types.Object, node_tree: sverchok.node_tree.SverchCustomTree
|
||||
) -> str | None:
|
||||
"""
|
||||
:return: ``None`` if successful, otherwise error message.
|
||||
"""
|
||||
import ifcsverchok.helper as helper
|
||||
|
||||
output_node = cls.get_ifcsverchok_shape_output(node_tree)
|
||||
verts = helper.get_socket_value(output_node.outputs, "Vers", value_type="CONTAINER")
|
||||
edges = helper.get_socket_value(output_node.outputs, "Edgs", value_type="CONTAINER")
|
||||
faces = helper.get_socket_value(output_node.outputs, "Pols", value_type="CONTAINER")
|
||||
mesh = obj.data
|
||||
assert isinstance(mesh, bpy.types.Mesh)
|
||||
mesh.clear_geometry()
|
||||
|
||||
# `shade_flat=False`, because `from_pydata` is using method that doesn't support changing shading
|
||||
# during `Panel.draw` execution. We shade flat later ourselves.
|
||||
mesh.from_pydata(verts, edges, faces, shade_flat=False)
|
||||
|
||||
def _name_convention_attribute_ensure(attributes, name, domain, data_type):
|
||||
try:
|
||||
attribute = attributes[name]
|
||||
except KeyError:
|
||||
return attributes.new(name, data_type, domain)
|
||||
if attribute.domain == domain and attribute.data_type == data_type:
|
||||
return attribute
|
||||
attributes.remove(attribute)
|
||||
return attributes.new(name, data_type, domain)
|
||||
|
||||
sharp_faces = _name_convention_attribute_ensure(mesh.attributes, "sharp_face", "FACE", "BOOLEAN")
|
||||
assert isinstance(sharp_faces, bpy.types.BoolAttribute)
|
||||
data = sharp_faces.data
|
||||
ones = np.ones(len(data), dtype=bool)
|
||||
data.foreach_set("value", ones)
|
||||
|
||||
@classmethod
|
||||
def align_objects(
|
||||
cls,
|
||||
@@ -2669,3 +2728,25 @@ class Model(bonsai.core.tool.Model):
|
||||
material.OffsetFromReferenceLine = custom_offset
|
||||
|
||||
cls.recreate_wall(element, wall)
|
||||
|
||||
@classmethod
|
||||
def run_ifcsverchok_graph_on_bonsai_file(cls, node_tree: sverchok.node_tree.SverchCustomTree) -> None:
|
||||
from ifcsverchok.ifcstore import SvIfcStore
|
||||
from sverchok.core.update_system import UpdateTree
|
||||
|
||||
# We should be very careful and use bonsai file just for 1 graph update.
|
||||
# To avoid producing duplicated data in non-ephemeral file.
|
||||
SvIfcStore.use_bonsai_file = True
|
||||
try:
|
||||
# The ones below refresh asyncronously, so we're using different method to get results synchronously.
|
||||
# - bpy.ops.node.sverchok_update_context(force_mode=True)
|
||||
# - node_tree.force_update()
|
||||
# TODO: Ideally we should find shape output node and update only it's furtherest children.
|
||||
# Because user might have some nodes just floating around unused.
|
||||
# ` update_tree = UpdateTree.get(node_tree); update_tree.add_outdated(nodes)` can be used for this.
|
||||
UpdateTree.reset_tree(node_tree)
|
||||
nodes_to_update = UpdateTree.main_update(node_tree)
|
||||
# Consuming generator, which triggers the update.
|
||||
list(nodes_to_update)
|
||||
finally:
|
||||
SvIfcStore.use_bonsai_file = False
|
||||
|
||||
@@ -102,6 +102,7 @@ __all__ = [
|
||||
"file",
|
||||
"guid",
|
||||
"ifcopenshell_wrapper",
|
||||
"rocksdb_lazy_instance",
|
||||
"sqlite",
|
||||
"sqlite_entity",
|
||||
"stream",
|
||||
|
||||
@@ -125,4 +125,5 @@ __all__ = [
|
||||
"name_segments",
|
||||
"register_referent_name_callback",
|
||||
"update_fallback_position",
|
||||
"get_mapped_segments",
|
||||
]
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
import numpy as np
|
||||
|
||||
import ifcopenshell
|
||||
import ifcopenshell.api
|
||||
import ifcopenshell.api.alignment
|
||||
import ifcopenshell.geom
|
||||
import ifcopenshell.ifcopenshell_wrapper as ifcopenshell_wrapper
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import math
|
||||
from collections.abc import Sequence
|
||||
|
||||
import numpy as np
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
|
||||
import ifcopenshell
|
||||
import ifcopenshell.api.alignment
|
||||
import ifcopenshell.util
|
||||
import ifcopenshell.util.alignment
|
||||
from ifcopenshell import entity_instance
|
||||
from ifcopenshell.api.alignment._get_segment_start_point_label import (
|
||||
|
||||
@@ -16,8 +16,6 @@
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import math
|
||||
from collections.abc import Sequence
|
||||
|
||||
import ifcopenshell
|
||||
import ifcopenshell.api.alignment
|
||||
|
||||
-1
@@ -16,7 +16,6 @@
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import math
|
||||
from collections.abc import Sequence
|
||||
|
||||
import ifcopenshell
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import math
|
||||
from collections.abc import Sequence
|
||||
|
||||
import ifcopenshell
|
||||
|
||||
@@ -16,12 +16,8 @@
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import math
|
||||
from collections.abc import Sequence
|
||||
|
||||
import ifcopenshell
|
||||
import ifcopenshell.api.alignment
|
||||
import ifcopenshell.api.geometry
|
||||
from ifcopenshell import entity_instance
|
||||
|
||||
|
||||
|
||||
@@ -16,9 +16,7 @@
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from collections.abc import Sequence
|
||||
|
||||
import ifcopenshell
|
||||
from ifcopenshell import entity_instance
|
||||
|
||||
_horizontal_callback = None
|
||||
|
||||
@@ -21,7 +21,6 @@ from collections.abc import Sequence
|
||||
|
||||
import ifcopenshell
|
||||
from ifcopenshell import entity_instance
|
||||
from ifcopenshell.api.alignment import get_axis_subcontext
|
||||
|
||||
|
||||
def _get_axis(file: ifcopenshell.file, Ds: float, rail_head_distance: float) -> entity_instance:
|
||||
|
||||
-1
@@ -21,7 +21,6 @@ from collections.abc import Sequence
|
||||
|
||||
import ifcopenshell
|
||||
import ifcopenshell.ifcopenshell_wrapper as ifcopenshell_wrapper
|
||||
import ifcopenshell.util
|
||||
import ifcopenshell.util.unit
|
||||
from ifcopenshell import entity_instance
|
||||
from ifcopenshell.api.alignment._get_cant_segment import _get_cant_segment
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@ import math
|
||||
from collections.abc import Sequence
|
||||
|
||||
import ifcopenshell
|
||||
from ifcopenshell import entity_instance, ifcopenshell_wrapper
|
||||
from ifcopenshell import entity_instance
|
||||
|
||||
|
||||
def _polynomial_length(A: float, B: float, C: float, L: float) -> float:
|
||||
|
||||
+1
-6
@@ -16,14 +16,9 @@
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import math
|
||||
|
||||
import numpy as np
|
||||
|
||||
import ifcopenshell
|
||||
import ifcopenshell.api.alignment
|
||||
import ifcopenshell.geom
|
||||
from ifcopenshell import entity_instance, ifcopenshell_wrapper
|
||||
from ifcopenshell import entity_instance
|
||||
|
||||
|
||||
def _update_curve_segment_transition_code(prev_segment: entity_instance, segment: entity_instance) -> None:
|
||||
|
||||
@@ -20,7 +20,6 @@ import numpy as np
|
||||
|
||||
import ifcopenshell
|
||||
import ifcopenshell.api.alignment
|
||||
import ifcopenshell.api.nest
|
||||
import ifcopenshell.api.pset
|
||||
import ifcopenshell.geom
|
||||
import ifcopenshell.guid
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import ifcopenshell
|
||||
import ifcopenshell.api
|
||||
import ifcopenshell.api.aggregate
|
||||
import ifcopenshell.api.alignment
|
||||
import ifcopenshell.api.geometry
|
||||
|
||||
@@ -20,9 +20,6 @@ from collections.abc import Sequence
|
||||
|
||||
import ifcopenshell
|
||||
import ifcopenshell.api.aggregate
|
||||
import ifcopenshell.api.alignment
|
||||
import ifcopenshell.api.nest
|
||||
import ifcopenshell.util.alignment
|
||||
from ifcopenshell import entity_instance
|
||||
from ifcopenshell.api.alignment._create_offset_curve_representation import (
|
||||
_create_offset_curve_representation,
|
||||
|
||||
@@ -19,9 +19,7 @@
|
||||
from collections.abc import Sequence
|
||||
|
||||
import ifcopenshell
|
||||
import ifcopenshell.api.aggregate
|
||||
import ifcopenshell.api.alignment
|
||||
import ifcopenshell.api.nest
|
||||
from ifcopenshell import entity_instance
|
||||
|
||||
|
||||
|
||||
@@ -17,13 +17,10 @@
|
||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import csv
|
||||
from collections.abc import Sequence
|
||||
|
||||
import ifcopenshell
|
||||
import ifcopenshell.api
|
||||
import ifcopenshell.api.alignment
|
||||
from ifcopenshell import entity_instance
|
||||
from ifcopenshell.api.alignment import get_axis_subcontext
|
||||
|
||||
|
||||
def create_from_csv(file: ifcopenshell.file, filepath: str) -> entity_instance:
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import math
|
||||
from typing import Union
|
||||
|
||||
import numpy as np
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import ifcopenshell
|
||||
from ifcopenshell import entity_instance
|
||||
|
||||
|
||||
|
||||
@@ -18,9 +18,6 @@
|
||||
|
||||
from collections.abc import Sequence
|
||||
|
||||
import ifcopenshell
|
||||
import ifcopenshell.util
|
||||
import ifcopenshell.util.representation
|
||||
from ifcopenshell import entity_instance
|
||||
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import ifcopenshell
|
||||
from ifcopenshell import entity_instance
|
||||
|
||||
|
||||
|
||||
@@ -16,8 +16,6 @@
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import ifcopenshell
|
||||
import ifcopenshell.util
|
||||
import ifcopenshell.util.representation
|
||||
from ifcopenshell import entity_instance
|
||||
|
||||
|
||||
@@ -18,9 +18,6 @@
|
||||
|
||||
from collections.abc import Sequence
|
||||
|
||||
import ifcopenshell
|
||||
import ifcopenshell.util
|
||||
import ifcopenshell.util.element
|
||||
from ifcopenshell import entity_instance
|
||||
|
||||
|
||||
|
||||
@@ -16,8 +16,6 @@
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import ifcopenshell
|
||||
import ifcopenshell.util
|
||||
import ifcopenshell.util.representation
|
||||
from ifcopenshell import entity_instance
|
||||
|
||||
|
||||
-3
@@ -16,12 +16,9 @@
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import math
|
||||
|
||||
import numpy as np
|
||||
|
||||
import ifcopenshell
|
||||
import ifcopenshell.api
|
||||
import ifcopenshell.geom
|
||||
from ifcopenshell import entity_instance, ifcopenshell_wrapper
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import ifcopenshell
|
||||
import ifcopenshell.api.alignment
|
||||
from ifcopenshell import entity_instance
|
||||
|
||||
|
||||
@@ -18,9 +18,6 @@
|
||||
|
||||
from collections.abc import Sequence
|
||||
|
||||
import ifcopenshell
|
||||
import ifcopenshell.util
|
||||
import ifcopenshell.util.element
|
||||
from ifcopenshell import entity_instance
|
||||
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
|
||||
from collections.abc import Sequence
|
||||
|
||||
import ifcopenshell
|
||||
import ifcopenshell.api.alignment
|
||||
from ifcopenshell import entity_instance
|
||||
|
||||
|
||||
@@ -16,9 +16,6 @@
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import ifcopenshell
|
||||
import ifcopenshell.util
|
||||
import ifcopenshell.util.representation
|
||||
from ifcopenshell import entity_instance
|
||||
|
||||
|
||||
|
||||
@@ -16,9 +16,6 @@
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import ifcopenshell
|
||||
import ifcopenshell.api.alignment
|
||||
import ifcopenshell.util.element
|
||||
from ifcopenshell import entity_instance
|
||||
|
||||
|
||||
|
||||
-1
@@ -21,7 +21,6 @@ from collections.abc import Sequence
|
||||
|
||||
import ifcopenshell
|
||||
import ifcopenshell.api.alignment
|
||||
import ifcopenshell.util
|
||||
import ifcopenshell.util.unit
|
||||
from ifcopenshell import entity_instance
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import ifcopenshell
|
||||
from ifcopenshell import entity_instance
|
||||
|
||||
|
||||
|
||||
@@ -16,17 +16,11 @@
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import math
|
||||
|
||||
import numpy as np
|
||||
|
||||
import ifcopenshell
|
||||
import ifcopenshell.api.alignment
|
||||
import ifcopenshell.geom
|
||||
import ifcopenshell.guid
|
||||
import ifcopenshell.template
|
||||
import ifcopenshell.util
|
||||
import ifcopenshell.util.alignment
|
||||
from ifcopenshell import entity_instance, ifcopenshell_wrapper
|
||||
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import sys
|
||||
from types import EllipsisType
|
||||
from typing import Any, Union
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from typing import Any, Union
|
||||
from typing import Union
|
||||
|
||||
import ifcopenshell
|
||||
import ifcopenshell.guid
|
||||
|
||||
@@ -16,9 +16,7 @@
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import typing
|
||||
|
||||
import ifcopenshell
|
||||
from ifcopenshell import entity_instance
|
||||
|
||||
|
||||
|
||||
@@ -16,9 +16,7 @@
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import typing
|
||||
|
||||
import ifcopenshell
|
||||
from ifcopenshell import entity_instance
|
||||
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import ifcopenshell.api.cost
|
||||
import ifcopenshell.util.date
|
||||
import ifcopenshell.util.resource
|
||||
|
||||
|
||||
|
||||
@@ -21,8 +21,6 @@ from typing import Any
|
||||
import ifcopenshell
|
||||
import ifcopenshell.api.cost
|
||||
import ifcopenshell.util.cost
|
||||
import ifcopenshell.util.element
|
||||
import ifcopenshell.util.unit
|
||||
|
||||
|
||||
def edit_cost_value_formula(file: ifcopenshell.file, cost_value: ifcopenshell.entity_instance, formula: str) -> None:
|
||||
|
||||
@@ -28,7 +28,7 @@ from mathutils import Matrix, Vector
|
||||
|
||||
import ifcopenshell.util.shape_builder
|
||||
import ifcopenshell.util.unit
|
||||
from ifcopenshell.util.shape_builder import VectorType, ifc_safe_vector_type
|
||||
from ifcopenshell.util.shape_builder import ifc_safe_vector_type
|
||||
|
||||
if TYPE_CHECKING:
|
||||
import bonsai.tool as tool
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from math import cos, sin
|
||||
from typing import Any, Optional, Union
|
||||
from typing import Optional, Union
|
||||
|
||||
import ifcopenshell.util.element
|
||||
import ifcopenshell.util.unit
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from math import cos, pi, sin
|
||||
from math import cos, sin
|
||||
from typing import Any, Optional, Union
|
||||
|
||||
import ifcopenshell.util.element
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from typing import Any
|
||||
|
||||
import ifcopenshell.api.geometry
|
||||
import ifcopenshell.api.owner
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
from typing import Optional
|
||||
|
||||
import ifcopenshell
|
||||
import ifcopenshell.api
|
||||
import ifcopenshell.util.element
|
||||
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||
from typing import Literal, Optional
|
||||
from typing import Literal
|
||||
|
||||
import ifcopenshell
|
||||
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||
from typing import Optional
|
||||
|
||||
import ifcopenshell
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import ifcopenshell
|
||||
import ifcopenshell.util.element
|
||||
|
||||
|
||||
def unassign_layer(
|
||||
|
||||
@@ -17,8 +17,6 @@
|
||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import ifcopenshell
|
||||
import ifcopenshell.util.date
|
||||
import ifcopenshell.util.schema
|
||||
|
||||
|
||||
def add_library(file: ifcopenshell.file, name: str) -> ifcopenshell.entity_instance:
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from typing import Any
|
||||
|
||||
import ifcopenshell.util.representation
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from typing import Any
|
||||
|
||||
import ifcopenshell
|
||||
import ifcopenshell.api.owner
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from typing import Any, Optional, Union
|
||||
from typing import Optional, Union
|
||||
|
||||
import ifcopenshell.api
|
||||
import ifcopenshell.api.owner
|
||||
|
||||
@@ -20,7 +20,6 @@ import time
|
||||
from typing import Union
|
||||
|
||||
import ifcopenshell
|
||||
import ifcopenshell.api
|
||||
import ifcopenshell.api.owner.settings
|
||||
import ifcopenshell.util.element
|
||||
|
||||
|
||||
@@ -21,7 +21,6 @@ from typing import Union
|
||||
import ifcopenshell
|
||||
import ifcopenshell.api.owner
|
||||
import ifcopenshell.guid
|
||||
import ifcopenshell.util.element
|
||||
|
||||
|
||||
def assign_pset(
|
||||
|
||||
@@ -17,8 +17,6 @@
|
||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import ifcopenshell
|
||||
import ifcopenshell.api.owner
|
||||
import ifcopenshell.guid
|
||||
import ifcopenshell.util.element
|
||||
|
||||
|
||||
|
||||
@@ -17,9 +17,7 @@
|
||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import ifcopenshell
|
||||
import ifcopenshell.api.owner
|
||||
import ifcopenshell.api.pset
|
||||
import ifcopenshell.guid
|
||||
import ifcopenshell.util.element
|
||||
|
||||
|
||||
|
||||
@@ -16,12 +16,10 @@
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import math
|
||||
|
||||
import ifcopenshell.api
|
||||
import ifcopenshell.util.constraint
|
||||
import ifcopenshell.util.date
|
||||
import ifcopenshell.util.element
|
||||
import ifcopenshell.util.resource
|
||||
|
||||
|
||||
|
||||
@@ -18,8 +18,6 @@
|
||||
|
||||
import ifcopenshell.api.resource
|
||||
import ifcopenshell.util.constraint
|
||||
import ifcopenshell.util.date
|
||||
import ifcopenshell.util.element
|
||||
import ifcopenshell.util.resource
|
||||
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from typing import Any
|
||||
|
||||
import ifcopenshell
|
||||
import ifcopenshell.api.geometry
|
||||
@@ -25,7 +24,6 @@ import ifcopenshell.api.root
|
||||
import ifcopenshell.api.system
|
||||
import ifcopenshell.util.element
|
||||
import ifcopenshell.util.placement
|
||||
import ifcopenshell.util.system
|
||||
|
||||
|
||||
def copy_class(file: ifcopenshell.file, product: ifcopenshell.entity_instance) -> ifcopenshell.entity_instance:
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from typing import Any, Optional
|
||||
from typing import Optional
|
||||
|
||||
import ifcopenshell
|
||||
import ifcopenshell.api.owner
|
||||
|
||||
@@ -24,7 +24,6 @@ import ifcopenshell.api.geometry
|
||||
import ifcopenshell.api.pset
|
||||
import ifcopenshell.api.spatial
|
||||
import ifcopenshell.api.type
|
||||
import ifcopenshell.guid
|
||||
import ifcopenshell.util.element
|
||||
import ifcopenshell.util.representation
|
||||
import ifcopenshell.util.schema
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from datetime import datetime, time, timedelta
|
||||
from datetime import time
|
||||
from typing import Optional, Union
|
||||
|
||||
import ifcopenshell.api
|
||||
|
||||
@@ -23,9 +23,7 @@ import ifcopenshell.api.control
|
||||
import ifcopenshell.api.owner
|
||||
import ifcopenshell.api.sequence
|
||||
import ifcopenshell.guid
|
||||
import ifcopenshell.util.element
|
||||
import ifcopenshell.util.sequence
|
||||
import ifcopenshell.util.system
|
||||
|
||||
|
||||
def create_baseline(
|
||||
|
||||
-2
@@ -20,8 +20,6 @@ from typing import Union
|
||||
|
||||
import ifcopenshell
|
||||
import ifcopenshell.api.group
|
||||
import ifcopenshell.api.owner
|
||||
import ifcopenshell.guid
|
||||
|
||||
|
||||
def assign_structural_analysis_model(
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import ifcopenshell
|
||||
import ifcopenshell.api
|
||||
import ifcopenshell.util.element
|
||||
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import ifcopenshell
|
||||
import ifcopenshell.api
|
||||
import ifcopenshell.util.element
|
||||
|
||||
|
||||
|
||||
-2
@@ -18,8 +18,6 @@
|
||||
|
||||
import ifcopenshell
|
||||
import ifcopenshell.api.group
|
||||
import ifcopenshell.api.owner
|
||||
import ifcopenshell.util.element
|
||||
|
||||
|
||||
def unassign_structural_analysis_model(
|
||||
|
||||
@@ -20,7 +20,6 @@ from __future__ import annotations
|
||||
from typing import TYPE_CHECKING, Any, Optional
|
||||
|
||||
import ifcopenshell
|
||||
import ifcopenshell.api
|
||||
|
||||
if TYPE_CHECKING:
|
||||
import bpy
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from typing import Any
|
||||
|
||||
import ifcopenshell
|
||||
import ifcopenshell.api.geometry
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import ifcopenshell
|
||||
import ifcopenshell.api
|
||||
import ifcopenshell.util.element
|
||||
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
|
||||
import ifcopenshell
|
||||
import ifcopenshell.api.group
|
||||
import ifcopenshell.util.element
|
||||
|
||||
|
||||
def unassign_system(
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
|
||||
import ifcopenshell
|
||||
import ifcopenshell.api.geometry
|
||||
import ifcopenshell.util.element
|
||||
|
||||
|
||||
def map_type_representations(
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from typing import Any, Optional
|
||||
|
||||
import ifcopenshell.util.unit
|
||||
|
||||
|
||||
@@ -670,7 +670,6 @@ def main(
|
||||
|
||||
if __name__ == "__main__":
|
||||
import argparse
|
||||
import sys
|
||||
import time
|
||||
|
||||
times = []
|
||||
|
||||
@@ -40,7 +40,7 @@ def _has_occ():
|
||||
pass
|
||||
|
||||
try:
|
||||
import OCC.BRepTools
|
||||
import OCC.BRepTools # noqa: F401
|
||||
|
||||
return True
|
||||
except ImportError:
|
||||
@@ -52,6 +52,6 @@ def _has_occ():
|
||||
has_occ = _has_occ()
|
||||
|
||||
if has_occ:
|
||||
from . import occ_utils as utils
|
||||
from . import occ_utils as utils # noqa: F401
|
||||
|
||||
from .main import *
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
|
||||
import functools
|
||||
import multiprocessing
|
||||
import operator
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
@@ -26,11 +25,10 @@ import time
|
||||
import ifcopenshell.ifcopenshell_wrapper as W
|
||||
|
||||
try:
|
||||
from OCC.Core import AIS
|
||||
from OCC.Core import AIS # noqa: F401
|
||||
|
||||
USE_OCCT_HANDLE = False
|
||||
except ImportError:
|
||||
from OCC import AIS
|
||||
|
||||
USE_OCCT_HANDLE = True
|
||||
|
||||
@@ -56,7 +54,6 @@ from .code_editor_pane import code_edit
|
||||
try:
|
||||
from OCC.Display.pyqt5Display import qtViewer3d
|
||||
except BaseException:
|
||||
import OCC.Display
|
||||
|
||||
try:
|
||||
import OCC.Display.backend
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import logging
|
||||
import os
|
||||
import sys
|
||||
from code import InteractiveConsole
|
||||
|
||||
@@ -30,14 +29,11 @@ except BaseException:
|
||||
|
||||
try:
|
||||
from pyqode.core import api, modes, panels
|
||||
from pyqode.core.api import CodeEdit, ColorScheme
|
||||
from pyqode.core.panels import CheckerPanel
|
||||
from pyqode.core.api import CodeEdit
|
||||
from pyqode.python import modes as pymodes
|
||||
from pyqode.python import panels as pypanels
|
||||
from pyqode.python import widgets
|
||||
from pyqode.python.backend import server
|
||||
from pyqode.python.modes import PyAutoIndentMode, PythonSH
|
||||
from pyqode.python.widgets import PyInteractiveConsole
|
||||
from pyqode.python.modes import PythonSH
|
||||
|
||||
has_pyqode = True
|
||||
except BaseException:
|
||||
|
||||
@@ -19,9 +19,6 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import operator
|
||||
import os
|
||||
import sys
|
||||
from collections.abc import Generator, Iterable
|
||||
from typing import TYPE_CHECKING, Any, Literal, Optional, TypeVar, Union, cast, overload
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ import operator
|
||||
import random
|
||||
import warnings
|
||||
from collections.abc import Iterable
|
||||
from typing import Any, NamedTuple, Union
|
||||
from typing import NamedTuple, Union
|
||||
|
||||
import OCC
|
||||
from typing_extensions import assert_never
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
import copy
|
||||
import json
|
||||
from pathlib import Path
|
||||
from typing import Any, Literal, Optional, TypedDict, Union
|
||||
from typing import Optional, TypedDict, Union
|
||||
|
||||
from typing_extensions import NotRequired
|
||||
|
||||
|
||||
@@ -30,7 +30,6 @@ import ifcopenshell.api.project
|
||||
import ifcopenshell.api.unit
|
||||
import ifcopenshell.guid
|
||||
import ifcopenshell.ifcopenshell_wrapper as W
|
||||
import ifcopenshell.util.attribute
|
||||
|
||||
if not RUN_FROM_DEV_REPO:
|
||||
import shutil
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import re
|
||||
import sys
|
||||
from collections.abc import Iterable
|
||||
from decimal import Decimal
|
||||
from types import EllipsisType
|
||||
@@ -32,7 +31,6 @@ import ifcopenshell.util
|
||||
import ifcopenshell.util.attribute
|
||||
import ifcopenshell.util.classification
|
||||
import ifcopenshell.util.element
|
||||
import ifcopenshell.util.fm
|
||||
import ifcopenshell.util.geolocation
|
||||
import ifcopenshell.util.placement
|
||||
import ifcopenshell.util.pset
|
||||
|
||||
@@ -16,28 +16,36 @@
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from math import cos, radians
|
||||
from typing import Literal, Optional, Union
|
||||
from typing import TYPE_CHECKING, Literal, Optional, Union
|
||||
|
||||
import numpy as np
|
||||
import numpy.typing as npt
|
||||
import shapely
|
||||
import shapely.ops
|
||||
|
||||
import ifcopenshell.ifcopenshell_wrapper as W
|
||||
import ifcopenshell.util.element
|
||||
import ifcopenshell.util.placement
|
||||
import ifcopenshell.util.representation
|
||||
from ifcopenshell.geom import ShapeElementType
|
||||
from ifcopenshell.util.shape_builder import VectorType
|
||||
|
||||
tol = 1e-6
|
||||
AXIS_LITERAL = Literal["X", "Y", "Z"]
|
||||
VECTOR_3D = tuple[float, float, float]
|
||||
if TYPE_CHECKING:
|
||||
|
||||
import ifcopenshell.ifcopenshell_wrapper as W
|
||||
from ifcopenshell.geom import ShapeElementType
|
||||
from ifcopenshell.util.shape_builder import VectorType
|
||||
|
||||
AXIS_LITERAL = Literal["X", "Y", "Z"]
|
||||
|
||||
VECTOR_3D = tuple[float, float, float]
|
||||
|
||||
# Used only for typing, but reused by `shape.py` users.
|
||||
MatrixType = npt.NDArray[np.float64]
|
||||
"""`npt.NDArray[np.float64]`"""
|
||||
|
||||
tol = 1e-6
|
||||
|
||||
# NOTE: See IfcGeomRepresentation.h for W.Triangulation buffer types.
|
||||
|
||||
# NOTE: For functions that return a single scalar ensure to use .item() to
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import collections
|
||||
import collections.abc
|
||||
from collections.abc import Sequence
|
||||
from itertools import chain
|
||||
@@ -29,7 +28,6 @@ import numpy as np
|
||||
import numpy.typing as npt
|
||||
|
||||
import ifcopenshell
|
||||
import ifcopenshell.api
|
||||
import ifcopenshell.util.element
|
||||
import ifcopenshell.util.placement
|
||||
import ifcopenshell.util.representation
|
||||
@@ -315,7 +313,7 @@ class ShapeBuilder:
|
||||
Generate an IfcIndexedPolyCurve based on the provided points.
|
||||
|
||||
:param points: List of 2d or 3d points
|
||||
:param closed: Whether polyline should be closed. Default is `False`
|
||||
:param closed: Whether polyline should be closed.
|
||||
:param position_offset: offset to be applied to all points
|
||||
:param arc_points: Indices of the middle points for arcs. For creating an arc segment,
|
||||
provide 3 points: `arc_start`, `arc_middle` and `arc_end` to `points` and add the `arc_middle`
|
||||
@@ -418,8 +416,9 @@ class ShapeBuilder:
|
||||
3 2
|
||||
0 1
|
||||
|
||||
:param size: rectangle size, could be either 2d or 3d, defaults to `(1,1)`
|
||||
:param position: rectangle position, default to `None`.
|
||||
:param size: rectangle size, could be either 2d or 3d.
|
||||
Use 0 for one of 3d dimensions to create 2d rectangle in 3d space.
|
||||
:param position: rectangle position.
|
||||
if `position` not specified zero-vector will be used
|
||||
:return: list of rectangle coords
|
||||
"""
|
||||
@@ -444,9 +443,11 @@ class ShapeBuilder:
|
||||
"""
|
||||
Generate a rectangle polyline.
|
||||
|
||||
:param size: rectangle size, could be either 2d or 3d, defaults to `(1,1)`
|
||||
:param position: rectangle position, default to `None`.
|
||||
if `position` not specified zero-vector will be used
|
||||
:param size: rectangle.
|
||||
:param position: rectangle position.
|
||||
|
||||
See ``get_rectangle_coords`` for more information.
|
||||
|
||||
:return: IfcIndexedPolyCurve
|
||||
"""
|
||||
return self.polyline(self.get_rectangle_coords(size, position), closed=True)
|
||||
@@ -787,7 +788,7 @@ class ShapeBuilder:
|
||||
"""
|
||||
Create IfcAxis2Placement3D from numpy matrix.
|
||||
|
||||
:param matrix: 4x4 transformation matrix, defaults to `np.eye(4)`
|
||||
:param matrix: 4x4 transformation matrix, defaults to ``np.eye(4)``
|
||||
:return: IfcAxis2Placement3D
|
||||
"""
|
||||
if matrix is None:
|
||||
@@ -968,8 +969,8 @@ class ShapeBuilder:
|
||||
|
||||
def sphere(self, radius: float = 1.0, center: VectorType = (0.0, 0.0, 0.0)) -> ifcopenshell.entity_instance:
|
||||
"""
|
||||
:param radius: radius of the sphere, defaults to 1.0
|
||||
:param center: sphere position, defaults to `(0.0, 0.0, 0.0)`
|
||||
:param radius: radius of the sphere.
|
||||
:param center: sphere position.
|
||||
|
||||
:return: IfcSphere
|
||||
"""
|
||||
@@ -1072,7 +1073,7 @@ class ShapeBuilder:
|
||||
|
||||
:param context: IfcGeometricRepresentationSubContext
|
||||
:param items: could be a list or single curve/IfcExtrudedAreaSolid
|
||||
:param representation_type: Explicitly specified RepresentationType, defaults to `None`.
|
||||
:param representation_type: Explicitly specified RepresentationType.
|
||||
If not provided it will be guessed from the items types
|
||||
:return: IfcShapeRepresentation
|
||||
"""
|
||||
@@ -1183,8 +1184,8 @@ class ShapeBuilder:
|
||||
:param fillets: list of points from `coords` to base fillet on. Example: (1,)
|
||||
:param fillet_radius: list of fillet radius for each of corresponding point form `fillets`.
|
||||
Example: (5.,) Note: `fillet_radius` could be just 1 float value if it's the same for all fillets.
|
||||
:param closed: boolean whether curve should be closed (whether last point connected to first one). Default: True
|
||||
:param create_ifc_curve: create IfcIndexedPolyCurve or just return the data. Default: False
|
||||
:param closed: boolean whether curve should be closed (whether last point connected to first one).
|
||||
:param create_ifc_curve: create IfcIndexedPolyCurve or just return the data.
|
||||
|
||||
:return: (points, segments, ifc_curve) for the created simple curve
|
||||
if both points in e are equally far from pt, then v1 is returned.
|
||||
@@ -1463,10 +1464,10 @@ class ShapeBuilder:
|
||||
|
||||
:param points: list of points, assuming they form consecutive closed polyline.
|
||||
:param magnitude: extrusion magnitude
|
||||
:param extrusion_vector: extrusion direction, by default it's extruding by Z+ axis
|
||||
:param extrusion_vector: extrusion direction.
|
||||
:param offset: offset from the points
|
||||
:param start_cap: if True, create start cap, by default it's True
|
||||
:param end_cap: if True, create end cap, by default it's True
|
||||
:param start_cap: if True, create start cap.
|
||||
:param end_cap: if True, create end cap.
|
||||
:return: IfcPolygonalFaceSet
|
||||
"""
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@ from math import pi
|
||||
from typing import Literal, Optional, Union
|
||||
|
||||
import ifcopenshell
|
||||
import ifcopenshell.api.unit
|
||||
import ifcopenshell.ifcopenshell_wrapper as ifcopenshell_wrapper
|
||||
|
||||
prefixes = {
|
||||
|
||||
@@ -45,3 +45,6 @@ include = ["ifcopenshell*"]
|
||||
|
||||
[tool.ruff]
|
||||
extend = "../../pyproject.toml"
|
||||
lint.select = [
|
||||
"F401", # unused imports
|
||||
]
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import pytest
|
||||
|
||||
import ifcopenshell.api.alignment
|
||||
import ifcopenshell.api.context
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import pytest
|
||||
|
||||
import ifcopenshell.api.alignment
|
||||
import ifcopenshell.api.context
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user