mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-13 02:47:48 +00:00
bonsai other ifcopenshell packages #5178
This commit is contained in:
@@ -288,8 +288,8 @@ class Blender:
|
||||
def calculate(
|
||||
ifc_file: ifcopenshell.file, elements: set[ifcopenshell.entity_instance], qtos: dict, results: dict
|
||||
) -> None:
|
||||
import blenderbim.tool as tool
|
||||
import blenderbim.bim.module.qto.calculator as calculator
|
||||
import bonsai.tool as tool
|
||||
import bonsai.bim.module.qto.calculator as calculator
|
||||
|
||||
unit_converter = SI2ProjectUnitConverter(ifc_file)
|
||||
formula_functions = {}
|
||||
|
||||
@@ -24,7 +24,7 @@ from mathutils import Vector, Matrix
|
||||
from typing import Union, Optional, Literal, Any, TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from blenderbim.bim.module.geometry.helper import Helper
|
||||
from bonsai.bim.module.geometry.helper import Helper
|
||||
|
||||
|
||||
Z_AXIS = Vector((0, 0, 1))
|
||||
@@ -72,7 +72,7 @@ def add_representation(
|
||||
) -> ifcopenshell.entity_instance:
|
||||
# lazy import Helper to avoid circular import
|
||||
if "Helper" not in globals():
|
||||
from blenderbim.bim.module.geometry.helper import Helper
|
||||
from bonsai.bim.module.geometry.helper import Helper
|
||||
|
||||
globals()["Helper"] = Helper
|
||||
|
||||
@@ -460,7 +460,7 @@ class Usecase:
|
||||
return results
|
||||
|
||||
def is_mesh_curve_consecutive(self, geom_data):
|
||||
import blenderbim.tool as tool
|
||||
import bonsai.tool as tool
|
||||
|
||||
bm = tool.Blender.get_bmesh_for_mesh(geom_data)
|
||||
bm.verts.ensure_lookup_table()
|
||||
@@ -514,7 +514,7 @@ class Usecase:
|
||||
return self.create_curves_from_mesh_ifc2x3(should_exclude_faces=should_exclude_faces, is_2d=is_2d)
|
||||
return self.create_curves_from_mesh(should_exclude_faces=should_exclude_faces, is_2d=is_2d)
|
||||
|
||||
import blenderbim.tool as tool
|
||||
import bonsai.tool as tool
|
||||
|
||||
selected_objects = bpy.context.selected_objects
|
||||
active_object = bpy.context.active_object
|
||||
@@ -568,7 +568,7 @@ class Usecase:
|
||||
return curves
|
||||
|
||||
def remove_doubles_from_mesh(self, mesh):
|
||||
import blenderbim.tool as tool
|
||||
import bonsai.tool as tool
|
||||
|
||||
bm = tool.Blender.get_bmesh_for_mesh(mesh)
|
||||
bmesh.ops.remove_doubles(bm, verts=bm.verts, dist=0.0001)
|
||||
|
||||
@@ -31,7 +31,7 @@ def edit_georeferencing(
|
||||
Setting the correct georeferencing parameters is a complex topic and
|
||||
should ideally be done with three parties present: the lead architect,
|
||||
surveyor, and a third-party digital engineer with expertise in IFC to
|
||||
moderate. For more information, read the BlenderBIM Add-on documentation
|
||||
moderate. For more information, read the Bonsai documentation
|
||||
for Georeferencing:
|
||||
https://docs.bonsaibim.org/users/advanced/georeferencing.html
|
||||
|
||||
@@ -63,7 +63,7 @@ def edit_georeferencing(
|
||||
|
||||
# For buildings, it is almost always recommended to specify map
|
||||
# conversion parameters to a false origin and orientation to project
|
||||
# north. See the diagram in the BlenderBIM Add-on Georeferencing
|
||||
# north. See the diagram in the Bonsai Georeferencing
|
||||
# documentation for correct calculation of the X Axis Abcissa and
|
||||
# Ordinate.
|
||||
ifcopenshell.api.georeference.edit_georeferencing(model,
|
||||
|
||||
@@ -174,7 +174,7 @@ class Usecase:
|
||||
return self.create_surface_texture(links[0].from_node, "DIFFUSE")
|
||||
|
||||
def create_surface_texture(self, node, mode):
|
||||
import blenderbim.tool as tool
|
||||
import bonsai.tool as tool
|
||||
|
||||
texture = self.file.create_entity(
|
||||
"IfcImageTexture",
|
||||
|
||||
@@ -28,7 +28,7 @@ HEADER_EXTRACTOR_TEST_FILE_STR = """
|
||||
ISO-10303-21;
|
||||
HEADER;
|
||||
FILE_DESCRIPTION(('ViewDefinition[DesignTransferView]'),'2;1');
|
||||
FILE_NAME('file.ifc','2024-06-25T15:48:10+05:00',(),(),'IfcOpenShell 0.0.0','BlenderBIM 0.0.999999-xxxxxxx','Nobody');
|
||||
FILE_NAME('file.ifc','2024-06-25T15:48:10+05:00',(),(),'IfcOpenShell 0.0.0','Bonsai 0.0.999999-xxxxxxx','Nobody');
|
||||
FILE_SCHEMA(('IFC4X3_ADD2'));
|
||||
ENDSEC;
|
||||
DATA;
|
||||
|
||||
@@ -58,10 +58,10 @@ class Patcher:
|
||||
|
||||
def patch(self):
|
||||
import bpy
|
||||
import blenderbim.tool as tool
|
||||
import bonsai.tool as tool
|
||||
import ifcopenshell
|
||||
import ifcopenshell.util.element
|
||||
from blenderbim.bim.ifc import IfcStore
|
||||
from bonsai.bim.ifc import IfcStore
|
||||
from mathutils import Vector, Matrix
|
||||
|
||||
if len(bpy.data.objects) > 0:
|
||||
|
||||
@@ -70,7 +70,7 @@ class Patcher:
|
||||
def patch(self):
|
||||
import bpy
|
||||
import bmesh
|
||||
import blenderbim.tool as tool
|
||||
import bonsai.tool as tool
|
||||
from math import degrees
|
||||
|
||||
bpy.context.scene.BIMProjectProperties.should_use_native_meshes = True
|
||||
|
||||
@@ -34,7 +34,7 @@ class Patcher:
|
||||
If filesize is an issue, another approach would be to use IFCZIP
|
||||
instead to compress the model. Optimising the model only typically
|
||||
affects filesize and has minimal impact on load times. Large filesizes
|
||||
can usually be solved through other means. Consult the BlenderBIM Add-on
|
||||
can usually be solved through other means. Consult the bonsai Add-on
|
||||
documentation on dealing with large models for more details.
|
||||
|
||||
Warning: this optimise recipe is very, very slow. Please consider using
|
||||
|
||||
@@ -34,7 +34,7 @@ class Patcher:
|
||||
If filesize is an issue, another approach would be to use IFCZIP
|
||||
instead to compress the model. Optimising the model only typically
|
||||
affects filesize and has minimal impact on load times. Large filesizes
|
||||
can usually be solved through other means. Consult the BlenderBIM Add-on
|
||||
can usually be solved through other means. Consult Bonsai
|
||||
documentation on dealing with large models for more details.
|
||||
|
||||
This patch may be run multiple times with diminishing returns.
|
||||
|
||||
@@ -68,7 +68,7 @@ def ensure_addons_are_enabled(*addon_names: str) -> None:
|
||||
raise Exception("Some issues were found trying to enable IFC Sverchok:\n" + "\n".join(errors))
|
||||
|
||||
|
||||
ensure_addons_are_enabled("blenderbim", "sverchok")
|
||||
ensure_addons_are_enabled("bonsai", "sverchok")
|
||||
|
||||
|
||||
from sverchok.ui.nodeview_space_menu import add_node_menu
|
||||
|
||||
@@ -24,8 +24,8 @@ import ifcopenshell
|
||||
import ifcsverchok.helper
|
||||
import ifcopenshell.api
|
||||
from ifcsverchok.ifcstore import SvIfcStore
|
||||
import blenderbim.tool as tool
|
||||
import blenderbim.core.geometry as core
|
||||
import bonsai.tool as tool
|
||||
import bonsai.core.geometry as core
|
||||
from bpy.props import (
|
||||
StringProperty,
|
||||
EnumProperty,
|
||||
@@ -35,7 +35,7 @@ from bpy.props import (
|
||||
)
|
||||
from sverchok.node_tree import SverchCustomTreeNode
|
||||
from sverchok.data_structure import updateNode, flatten_data, fixed_iter, flat_iter
|
||||
from blenderbim.bim.module.root.prop import get_contexts
|
||||
from bonsai.bim.module.root.prop import get_contexts
|
||||
from sverchok.data_structure import zip_long_repeat, node_id
|
||||
from sverchok.core.socket_data import sv_get_socket
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ import logging
|
||||
import ifcopenshell
|
||||
import ifcsverchok.helper
|
||||
from ifcsverchok.ifcstore import SvIfcStore
|
||||
import blenderbim.bim.import_ifc
|
||||
import bonsai.bim.import_ifc
|
||||
from bpy.props import StringProperty, PointerProperty, BoolProperty
|
||||
from sverchok.node_tree import SverchCustomTreeNode
|
||||
from sverchok.data_structure import updateNode, flatten_data
|
||||
@@ -84,10 +84,10 @@ class SvIfcCreateShape(bpy.types.Node, SverchCustomTreeNode, ifcsverchok.helper.
|
||||
if not entity.is_a("IfcProduct"):
|
||||
return
|
||||
logger = logging.getLogger("ImportIFC")
|
||||
self.ifc_import_settings = blenderbim.bim.import_ifc.IfcImportSettings.factory(bpy.context, "", logger)
|
||||
self.ifc_import_settings = bonsai.bim.import_ifc.IfcImportSettings.factory(bpy.context, "", logger)
|
||||
settings = ifcopenshell.geom.settings()
|
||||
shape = ifcopenshell.geom.create_shape(settings, entity)
|
||||
ifc_importer = blenderbim.bim.import_ifc.IfcImporter(self.ifc_import_settings)
|
||||
ifc_importer = bonsai.bim.import_ifc.IfcImporter(self.ifc_import_settings)
|
||||
ifc_importer.file = self.file
|
||||
mesh = ifc_importer.create_mesh(entity, shape)
|
||||
obj = bpy.data.objects.new("IFC Element", mesh)
|
||||
|
||||
@@ -23,7 +23,7 @@ import ifcsverchok.helper
|
||||
from bpy.props import StringProperty
|
||||
from sverchok.node_tree import SverchCustomTreeNode
|
||||
from sverchok.data_structure import updateNode
|
||||
from blenderbim.bim.ifc import IfcStore
|
||||
from bonsai.bim.ifc import IfcStore
|
||||
|
||||
|
||||
class SvIfcSelectBlenderObjectsRefresh(bpy.types.Operator):
|
||||
|
||||
@@ -23,8 +23,8 @@ import ifcsverchok.helper
|
||||
import ifcopenshell.api
|
||||
import ifcopenshell.util.representation
|
||||
from ifcsverchok.ifcstore import SvIfcStore
|
||||
import blenderbim.tool as tool
|
||||
import blenderbim.core.geometry as core
|
||||
import bonsai.tool as tool
|
||||
import bonsai.core.geometry as core
|
||||
from bpy.props import StringProperty, EnumProperty, IntProperty, FloatVectorProperty
|
||||
from sverchok.node_tree import SverchCustomTreeNode
|
||||
from sverchok.data_structure import updateNode, ensure_min_nesting
|
||||
|
||||
Reference in New Issue
Block a user