diff --git a/src/ifcsverchok/README.md b/src/ifcsverchok/README.md index 3fde784423..bee8f63f32 100644 --- a/src/ifcsverchok/README.md +++ b/src/ifcsverchok/README.md @@ -8,3 +8,27 @@ IfcSverchok is packaged like a regular Blender add-on, so installation is the sa Like all Blender add-ons, they can be installed using `Edit > Preferences > Addons > Install > Choose Downloaded ZIP > Enable Add-on Checkbox`. You can enable add-ons permanently by using `Save User Settings` from the Addons menu. Before installing, you will also need to [install the BlenderBIM Add-on](https://blenderbim.org/docs-python/blenderbim/installation) and [install Sverchok](https://github.com/nortikin/sverchok#installation). + +## Nodes +List of nodes (nodes not listed here are not concidered ready for use). If you find bugs/unexpected behaviour in any of them, please open an issue or get in touch otherwise. + +| Node name | Inputs | Outputs | Description | +|--------------------------|-----------------------------------------------------------------------------------|---------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------| +| IFC Create Entity | - Names
- Descriptions
- IfcClass
- Representations
- Locations
- Properties | - Entities Ids | Create IFC Entity. Takes one or multiple inputs.
If 'Representation(s)' is given, that determines number of output entities. Otherwise, 'Names' is used. | +| IFC Read Entity | - Entity Id | - Id
- is_a
- Other entity attributes (dynamic) | Decompose an IfcEntity into its attributes. Takes one entity id as input, returns attribute values. | +| IFC BMesh to IFC Repr | - Context type
- Context identifier
- Target View
- Blender Objects | - Representations
- Locations | Blender mesh to IfcShapeRepresentation. Takes one or multiple geometries.
Deconstructs joined geometries and creates a separate representation for each. | +| IFC Sverchok to IFC Repr | - Context type
- Context identifier
- Target View
- Vertices
- Edges
- Faces | - Representations | Sverchok geometry to IfcShapeRepresentation. Takes one or multiple nested lists of inputs. | +| IFC Create Blender Shape | - Entity Id(s) | - Blender Object(s) | Create Blender shape from IfcEntity Id. Takes one or multiple IfcEntity Ids.
Creates shapes in scene and returns them in output socket. | +| IFC Add Spatial Element | - Names
- IfcClass
- Elements | - Entity Id(s) | Add IfcElements to an IfcSpatialElement. Takes one or multiple nested lists of inputs.
Input can also be a (list of) spacial elements to be aggregated. | +| IFC Write File | - path | | Writes active Ifc model to path.
N.B.! It's recommended to use the 'Write File' panel under the "IfcSverchok" tab instead. | +| IFC Class Picker | - IfcProduct (from drop-down)
- IfcClass (from drop-down) | - IfcClass | Pick an IfcClass from drop-down list. | +| IFC By Id | - Id | - Entities | Get IfcElement by step id. Takes one or multiple step ids. | +| IFC By Guid | - Guid | - Entities | Get IfcElement by guid. Takes one or multiple guids. | +| IFC By Type | - IfcProduct (from drop-down)
- IfcClass (from drop-down)
- Custom IfcClass | - Entities
- Entity Ids | Get IFC element(s) in file by type. Pick an IfcProduct and an IfcClass or give a custom IfcClass. | +| IFC Add Pset | - Name
- Properties
- Element Ids | - (Pset) Entities | Add a property set and corresponding properties, in a JSON key:value format, to IfcElements. | +| IFC Generate Guid | | - Guid | Generate a unique GUID. | +| IFC Get Property | - Entity Ids
- Pset name
- Prop name | - Value | Get the value of a property of an IfcEntity. Can take multiple entity ids. | +| IFC Get Attribute | - Entity Ids
- Attribute Name | - Value | Get the value of an attribute of an IfcEntity. Can take multiple entities. | + +### IfcSverchok panel +IfcSverchok creates a "IfcSverchok" tab in the Nodes panel. It includes a "Re-run all nodes" button that creates a fresh IFC File and a "Write File" button. It's recommended to re-run all nodes before saving the file either through the panel or the "Write File" node. \ No newline at end of file diff --git a/src/ifcsverchok/nodes/ifc/add_pset.py b/src/ifcsverchok/nodes/ifc/add_pset.py index 9927e06d62..e71e5961af 100644 --- a/src/ifcsverchok/nodes/ifc/add_pset.py +++ b/src/ifcsverchok/nodes/ifc/add_pset.py @@ -70,7 +70,6 @@ class SvIfcAddPset(bpy.types.Node, SverchCustomTreeNode, ifcsverchok.helper.SvIf self.file = SvIfcStore.get_file() try: elements = [self.file.by_id(int(step_id)) for step_id in element_ids] - print(elements[0]) except Exception as e: raise Exception("Instance ID not found", e) @@ -84,7 +83,6 @@ class SvIfcAddPset(bpy.types.Node, SverchCustomTreeNode, ifcsverchok.helper.SvIf def create(self, name, properties, elements): results = [] for element in elements: - print("element: ", element) result = ifcopenshell.api.run( "pset.add_pset", self.file, product=element, name=name ) @@ -94,7 +92,6 @@ class SvIfcAddPset(bpy.types.Node, SverchCustomTreeNode, ifcsverchok.helper.SvIf pset=result, properties=json.loads(properties), ) - print("result: ", result) SvIfcStore.id_map.setdefault(self.node_id, []).append(result.id()) results.append(result) return results @@ -114,11 +111,6 @@ class SvIfcAddPset(bpy.types.Node, SverchCustomTreeNode, ifcsverchok.helper.SvIf results.append(result) return results - # def get_existing_element(self): - # entity_id = list(SvIfcStore.id_map.keys())[list(SvIfcStore.id_map.values()).index(self.node_id)] - - # return self.file.by_id(entity_id) - def register(): bpy.utils.register_class(SvIfcAddPset) diff --git a/src/ifcsverchok/nodes/ifc/bmesh_to_ifc.py b/src/ifcsverchok/nodes/ifc/bmesh_to_ifc.py index 133c118cc0..a0aaecaba7 100644 --- a/src/ifcsverchok/nodes/ifc/bmesh_to_ifc.py +++ b/src/ifcsverchok/nodes/ifc/bmesh_to_ifc.py @@ -58,7 +58,7 @@ class SvIfcBMeshToIfcRepr( def refresh_node(self, context): if self.refresh_local: - updateNode(self, context) + self.process() self.refresh_local = False refresh_local: BoolProperty( @@ -181,14 +181,16 @@ class SvIfcBMeshToIfcRepr( if blender_object.type == "MESH": try: bpy.ops.object.mode_set(mode="OBJECT") - except: + except Exception as e: + print(e) pass bpy.ops.object.select_all(action="DESELECT") - blender_object.select_set(True) try: bpy.ops.object.mode_set(mode="EDIT") - except: + except Exception as e: + print(e) pass + blender_object.select_set(True) bpy.ops.mesh.separate(type="LOOSE") representations_ids_obj = [] locations_obj = [] @@ -218,7 +220,8 @@ class SvIfcBMeshToIfcRepr( ).append(locations_obj) try: bpy.ops.object.mode_set(mode="OBJECT") - except: + except Exception as e: + print(e) pass bpy.ops.object.select_all(action="DESELECT") return representations_ids, locations diff --git a/src/ifcsverchok/nodes/ifc/by_guid.py b/src/ifcsverchok/nodes/ifc/by_guid.py index 21fc332af9..aa8b0b2177 100644 --- a/src/ifcsverchok/nodes/ifc/by_guid.py +++ b/src/ifcsverchok/nodes/ifc/by_guid.py @@ -44,14 +44,6 @@ class SvIfcByGuid(bpy.types.Node, SverchCustomTreeNode, ifcsverchok.helper.SvIfc ).tooltip = "Get IFC element by guid. Takes one or multiple guids." def process(self): - print("\n\n", "#" * 30, "Running SvIfcByGuid node", "#" * 30) - print("self: ", self) - print("id(self): ", id(self)) - print("hash(self): ", hash(self)) - print("node_id: ", self.node_id) - self.id = next(self.id_iter) - print("self.id (itertool counter): ", self.id) - self.guids = flatten_data(self.inputs["guid"].sv_get(), target_level=1) if not self.guids[0]: return diff --git a/src/ifcsverchok/nodes/ifc/by_query.py b/src/ifcsverchok/nodes/ifc/by_query.py index 81b133cab5..703de5dd8d 100644 --- a/src/ifcsverchok/nodes/ifc/by_query.py +++ b/src/ifcsverchok/nodes/ifc/by_query.py @@ -20,6 +20,7 @@ import bpy import ifcopenshell import ifcopenshell.util.selector import ifcsverchok.helper +from ifcsverchok.ifcstore import SvIfcStore from bpy.props import StringProperty from sverchok.node_tree import SverchCustomTreeNode from sverchok.data_structure import updateNode @@ -28,21 +29,22 @@ from sverchok.data_structure import updateNode class SvIfcByQuery(bpy.types.Node, SverchCustomTreeNode, ifcsverchok.helper.SvIfcCore): bl_idname = "SvIfcByQuery" bl_label = "IFC By Query" - file: StringProperty(name="file", update=updateNode) - query: StringProperty(name="query", update=updateNode) + query: StringProperty(name="Query", update=updateNode) def sv_init(self, context): - self.inputs.new("SvStringsSocket", "file").prop_name = "file" self.inputs.new("SvStringsSocket", "query").prop_name = "query" - self.outputs.new("SvStringsSocket", "entity") + self.outputs.new("SvStringsSocket", "Entity") def process(self): - self.sv_input_names = ["file", "query"] + if not self.inputs["query"].sv_get()[0][0]: + return + self.file = SvIfcStore.get_file() + self.sv_input_names = ["query"] super().process() - def process_ifc(self, file, query): + def process_ifc(self, query): selector = ifcopenshell.util.selector.Selector() - self.outputs["entity"].sv_set([selector.parse(file, query)]) + self.outputs["Entity"].sv_set([selector.parse(self.file, query)]) def register(): diff --git a/src/ifcsverchok/nodes/ifc/create_entity.py b/src/ifcsverchok/nodes/ifc/create_entity.py index e9297251c4..2335e41527 100644 --- a/src/ifcsverchok/nodes/ifc/create_entity.py +++ b/src/ifcsverchok/nodes/ifc/create_entity.py @@ -180,11 +180,8 @@ class SvIfcCreateEntity( name=self.names[i], description=self.descriptions[i], ) - print("Entity: ", entity) try: - print("Representations: ", self.representations[i]) for repr in self.representations[i]: - print("Representation: ", repr) if repr: ifcopenshell.api.run( "geometry.assign_representation", @@ -196,7 +193,6 @@ class SvIfcCreateEntity( pass try: for loc in self.locations[i]: - print("Location: ", loc) if isinstance(loc, Matrix): ifcopenshell.api.run( "geometry.edit_object_placement", diff --git a/src/ifcsverchok/nodes/ifc/get_attribute.py b/src/ifcsverchok/nodes/ifc/get_attribute.py index f625e10e2a..3e7a343c10 100644 --- a/src/ifcsverchok/nodes/ifc/get_attribute.py +++ b/src/ifcsverchok/nodes/ifc/get_attribute.py @@ -64,7 +64,6 @@ class SvIfcGetAttribute( entity_nested_inputs = [ self.file.by_id(int(step_id)) for step_id in entity_nested_input_ids ] - print(entity_nested_inputs) except Exception as e: raise Exception("Instance ID not found", e) attribute_name = self.inputs["attribute_name"].sv_get()[0][0] diff --git a/src/ifcsverchok/nodes/ifc/read_entity.py b/src/ifcsverchok/nodes/ifc/read_entity.py index 5ac742c54f..919e740e73 100644 --- a/src/ifcsverchok/nodes/ifc/read_entity.py +++ b/src/ifcsverchok/nodes/ifc/read_entity.py @@ -47,9 +47,7 @@ class SvIfcReadEntity( def process(self): self.sv_input_names = ["entity"] - # ifc_class = ensure_min_nesting(self.inputs["entity"].sv_get(), 1) entity_id = flatten_data(self.inputs["entity"].sv_get(), target_level=1) - print("entity_id", entity_id) if not entity_id[0]: return if len(entity_id) > 1: