mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-12 10:33:20 +00:00
merage
This commit is contained in:
+37
@@ -0,0 +1,37 @@
|
||||
# -*- mode: Dockerfile -*-
|
||||
|
||||
FROM ubuntu:focal
|
||||
|
||||
ARG CHANNEL
|
||||
ENV CHANNEL=${CHANNEL:-latest}
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y \
|
||||
vim \
|
||||
ssh \
|
||||
sudo \
|
||||
wget \
|
||||
software-properties-common ;\
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN useradd --user-group --create-home --shell /bin/bash IfcOpenShell ;\
|
||||
echo "IfcOpenShell ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
|
||||
|
||||
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
RUN echo "deb http://archive.ubuntu.com/ubuntu focal-proposed main restricted" | tee -a /etc/apt/sources.list; \
|
||||
echo "deb http://archive.ubuntu.com/ubuntu focal-proposed universe" | tee -a /etc/apt/sources.list; \
|
||||
echo "deb http://archive.ubuntu.com/ubuntu focal-proposed multiverse" | tee -a /etc/apt/sources.list; \
|
||||
apt-get -qq update; \
|
||||
apt-get -y install tzdata dos2unix rsync; \
|
||||
apt-get -y install python3 libxml2 liboce-foundation11 liboce-modeling11 liboce-ocaf11 liboce-visualization11 \
|
||||
liboce-ocaf-lite11 libpython3.8 libboost-system1.67.0 libboost-program-options1.67.0 \
|
||||
libboost-regex1.67.0 libboost-thread1.67.0 libboost-date-time1.67.0; \
|
||||
rm -rf /var/lib/apt/lists/* ;
|
||||
|
||||
COPY . /home/IfcOpenShell/
|
||||
RUN ls -lrtR /home/IfcOpenShell
|
||||
|
||||
RUN dpkg -i /home/IfcOpenShell/*.deb
|
||||
|
||||
USER IfcOpenShell
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
# ****************************************************************************
|
||||
# line endings
|
||||
|
||||
# to suppress line ending changes in github, add ?w=1 at link end of a diff
|
||||
|
||||
# for more information see
|
||||
# FreeCAD source code src/Mod/.gitattributes
|
||||
# FreeCAD forum topic https://forum.freecadweb.org/viewtopic.php?f=17&t=41117
|
||||
# FreeCAD pull request https://github.com/FreeCAD/FreeCAD/pull/2752
|
||||
|
||||
|
||||
# get all used file types
|
||||
|
||||
# in a directory in a bash use
|
||||
# find . -type f -name '*.*' | sed 's|.*\.||' | sort -u
|
||||
|
||||
# search for a specific file ending
|
||||
# find . -type f -name '*.ico'
|
||||
|
||||
|
||||
# normalize the line endings of the following files
|
||||
*.cpp text
|
||||
*.css text
|
||||
*.csv text
|
||||
*.feature text
|
||||
*.gitattributes text
|
||||
*.gitignore text
|
||||
*.gitkeep
|
||||
*.h text
|
||||
*.html text
|
||||
*.ifc text
|
||||
*.json text
|
||||
*.md text
|
||||
*.po text
|
||||
*.pot text
|
||||
*.py text
|
||||
*.txt text
|
||||
|
||||
|
||||
# files not normalized ATM
|
||||
# bat
|
||||
# bnf
|
||||
# blend
|
||||
# i
|
||||
# ico
|
||||
# mo
|
||||
# mpass
|
||||
# png
|
||||
# pth
|
||||
# pyc
|
||||
# rst
|
||||
# svg
|
||||
# ttf
|
||||
# xsd
|
||||
|
||||
|
||||
# line endings of all directories will be normalized
|
||||
# to exclude a directory from being normalized add it here
|
||||
# example: to exclude dirctory ifcbimtester use the following line without #
|
||||
# ifcbimtester/** -text
|
||||
|
||||
|
||||
# use git to manually correct the file endings
|
||||
# git add --renormalize .
|
||||
@@ -61,7 +61,7 @@ endif
|
||||
cp -r dist/working/io_import_scene_ifc/ifcopenshell dist/blenderbim/libs/site/packages/
|
||||
|
||||
# See bug #812
|
||||
cd dist/working && wget https://raw.githubusercontent.com/IfcOpenShell/IfcOpenShell/v0.6.0/src/ifcblenderexport/occ_utils.py
|
||||
cd dist/working && wget https://raw.githubusercontent.com/IfcOpenShell/IfcOpenShell/v0.6.0/src/blenderbim/occ_utils.py
|
||||
cd dist/working && mv occ_utils.py ../blenderbim/libs/site/packages/ifcopenshell/geom/occ_utils.py
|
||||
rm -rf dist/working
|
||||
|
||||
@@ -142,6 +142,7 @@ endif
|
||||
cd dist/working && unzip v0.6.0.zip
|
||||
# IfcOpenBot sometimes lags behind, so we hotfix the Python utilities
|
||||
cp -r dist/working/IfcOpenShell-0.6.0/src/ifcopenshell-python/ifcopenshell/util/* dist/blenderbim/libs/site/packages/ifcopenshell/util/
|
||||
cp -r dist/working/IfcOpenShell-0.6.0/src/ifcopenshell-python/ifcopenshell/api dist/blenderbim/libs/site/packages/ifcopenshell/api
|
||||
# Provides bcf functionality
|
||||
cp -r dist/working/IfcOpenShell-0.6.0/src/bcf/bcf dist/blenderbim/libs/site/packages/
|
||||
# Provides IFCClash functionality
|
||||
|
Before Width: | Height: | Size: 399 KiB After Width: | Height: | Size: 399 KiB |
+72
-62
@@ -6,68 +6,71 @@ import numpy
|
||||
import pickle
|
||||
import multiprocessing
|
||||
|
||||
try:
|
||||
from OCC.Core import (
|
||||
gp,
|
||||
Geom,
|
||||
Bnd,
|
||||
BRepBndLib,
|
||||
BRep,
|
||||
BRepPrimAPI,
|
||||
BRepAlgoAPI,
|
||||
BRepBuilderAPI,
|
||||
TopOpeBRepTool,
|
||||
TopOpeBRepBuild,
|
||||
ShapeExtend,
|
||||
GProp,
|
||||
BRepGProp,
|
||||
GC,
|
||||
ShapeAnalysis,
|
||||
TopTools,
|
||||
TopExp,
|
||||
TopAbs,
|
||||
HLRAlgo,
|
||||
HLRBRep,
|
||||
TopLoc,
|
||||
Bnd,
|
||||
BRepBndLib,
|
||||
BRepTools,
|
||||
TopoDS,
|
||||
GeomLProp,
|
||||
IntCurvesFace,
|
||||
)
|
||||
from OCC.Core.TopoDS import topods
|
||||
except ImportError:
|
||||
from OCC import (
|
||||
gp,
|
||||
Geom,
|
||||
Bnd,
|
||||
BRepBndLib,
|
||||
BRep,
|
||||
BRepPrimAPI,
|
||||
BRepAlgoAPI,
|
||||
BRepBuilderAPI,
|
||||
TopOpeBRepTool,
|
||||
TopOpeBRepBuild,
|
||||
ShapeExtend,
|
||||
GProp,
|
||||
BRepGProp,
|
||||
GC,
|
||||
ShapeAnalysis,
|
||||
TopTools,
|
||||
TopExp,
|
||||
TopAbs,
|
||||
HLRAlgo,
|
||||
HLRBRep,
|
||||
TopLoc,
|
||||
Bnd,
|
||||
BRepBndLib,
|
||||
BRepTools,
|
||||
TopoDS,
|
||||
GeomLProp,
|
||||
IntCurvesFace,
|
||||
)
|
||||
from OCC.TopoDS import topods
|
||||
|
||||
def load_occ():
|
||||
# Don't import until we really need to, as a temporary step before we can purge OCC
|
||||
try:
|
||||
from OCC.Core import (
|
||||
gp,
|
||||
Geom,
|
||||
Bnd,
|
||||
BRepBndLib,
|
||||
BRep,
|
||||
BRepPrimAPI,
|
||||
BRepAlgoAPI,
|
||||
BRepBuilderAPI,
|
||||
TopOpeBRepTool,
|
||||
TopOpeBRepBuild,
|
||||
ShapeExtend,
|
||||
GProp,
|
||||
BRepGProp,
|
||||
GC,
|
||||
ShapeAnalysis,
|
||||
TopTools,
|
||||
TopExp,
|
||||
TopAbs,
|
||||
HLRAlgo,
|
||||
HLRBRep,
|
||||
TopLoc,
|
||||
Bnd,
|
||||
BRepBndLib,
|
||||
BRepTools,
|
||||
TopoDS,
|
||||
GeomLProp,
|
||||
IntCurvesFace,
|
||||
)
|
||||
from OCC.Core.TopoDS import topods
|
||||
except ImportError:
|
||||
from OCC import (
|
||||
gp,
|
||||
Geom,
|
||||
Bnd,
|
||||
BRepBndLib,
|
||||
BRep,
|
||||
BRepPrimAPI,
|
||||
BRepAlgoAPI,
|
||||
BRepBuilderAPI,
|
||||
TopOpeBRepTool,
|
||||
TopOpeBRepBuild,
|
||||
ShapeExtend,
|
||||
GProp,
|
||||
BRepGProp,
|
||||
GC,
|
||||
ShapeAnalysis,
|
||||
TopTools,
|
||||
TopExp,
|
||||
TopAbs,
|
||||
HLRAlgo,
|
||||
HLRBRep,
|
||||
TopLoc,
|
||||
Bnd,
|
||||
BRepBndLib,
|
||||
BRepTools,
|
||||
TopoDS,
|
||||
GeomLProp,
|
||||
IntCurvesFace,
|
||||
)
|
||||
from OCC.TopoDS import topods
|
||||
|
||||
import ifcopenshell
|
||||
import ifcopenshell.geom
|
||||
@@ -79,6 +82,7 @@ this_file = os.path.join(cwd, "cut_ifc.py")
|
||||
|
||||
|
||||
def get_booleaned_edges(shape):
|
||||
load_occ()
|
||||
edges = []
|
||||
exp = TopExp.TopExp_Explorer(shape, TopAbs.TopAbs_EDGE)
|
||||
while exp.More():
|
||||
@@ -88,6 +92,7 @@ def get_booleaned_edges(shape):
|
||||
|
||||
|
||||
def connect_edges_into_wires(unconnected_edges):
|
||||
load_occ()
|
||||
edges = TopTools.TopTools_HSequenceOfShape()
|
||||
edges_handle = TopTools.Handle_TopTools_HSequenceOfShape(edges)
|
||||
wires = TopTools.TopTools_HSequenceOfShape()
|
||||
@@ -101,6 +106,7 @@ def connect_edges_into_wires(unconnected_edges):
|
||||
|
||||
|
||||
def do_cut(process_data):
|
||||
load_occ()
|
||||
global_id, shape, section, trsf_data = process_data
|
||||
|
||||
axis = gp.gp_Ax2(
|
||||
@@ -320,6 +326,7 @@ class IfcCutter:
|
||||
return False
|
||||
|
||||
def create_section_box(self):
|
||||
load_occ()
|
||||
top_left_corner = gp.gp_Pnt(
|
||||
self.section_box["top_left_corner"][0],
|
||||
self.section_box["top_left_corner"][1],
|
||||
@@ -350,6 +357,7 @@ class IfcCutter:
|
||||
self.transformation.SetDisplacement(source, destination)
|
||||
|
||||
def get_bbox(self, shape):
|
||||
load_occ()
|
||||
bbox = Bnd.Bnd_Box()
|
||||
BRepBndLib.brepbndlib_Add(shape, bbox)
|
||||
return bbox
|
||||
@@ -361,6 +369,7 @@ class IfcCutter:
|
||||
return zpos, zmax
|
||||
|
||||
def get_booleaned_edges(self, shape):
|
||||
load_occ()
|
||||
edges = []
|
||||
exp = TopExp.TopExp_Explorer(shape, TopAbs.TopAbs_EDGE)
|
||||
while exp.More():
|
||||
@@ -377,6 +386,7 @@ class IfcCutter:
|
||||
|
||||
def get_annotation(self):
|
||||
import mathutils
|
||||
load_occ()
|
||||
|
||||
self.annotation_objs = []
|
||||
settings_2d = ifcopenshell.geom.settings()
|
||||
+21
-3
@@ -7,6 +7,7 @@ import zipfile
|
||||
import tempfile
|
||||
import ifcopenshell
|
||||
import ifcopenshell.util.placement
|
||||
import ifcopenshell.api
|
||||
from blenderbim.bim.ifc import IfcStore
|
||||
import addon_utils
|
||||
|
||||
@@ -19,7 +20,7 @@ class IfcExporter:
|
||||
self.file = IfcStore.get_file()
|
||||
self.set_header()
|
||||
if bpy.context.scene.BIMProjectProperties.is_authoring:
|
||||
self.sync_object_placements()
|
||||
self.sync_object_placements_and_deletions()
|
||||
self.sync_edited_objects()
|
||||
extension = self.ifc_export_settings.output_file.split(".")[-1]
|
||||
if extension == "ifczip":
|
||||
@@ -74,13 +75,22 @@ class IfcExporter:
|
||||
# else:
|
||||
# self.file.wrapped_data.header.file_name.authorization = "Nobody"
|
||||
|
||||
def sync_object_placements(self):
|
||||
def sync_object_placements_and_deletions(self):
|
||||
self.unit_scale = ifcopenshell.util.unit.calculate_unit_scale(self.file)
|
||||
for obj in bpy.data.objects:
|
||||
to_delete = []
|
||||
|
||||
for guid, obj in IfcStore.guid_map.items():
|
||||
try:
|
||||
self.sync_object_placement(obj)
|
||||
except:
|
||||
pass
|
||||
if self.should_delete(guid, obj):
|
||||
to_delete.append(guid)
|
||||
|
||||
for guid in to_delete:
|
||||
product = self.file.by_id(guid)
|
||||
IfcStore.unlink_element(product)
|
||||
ifcopenshell.api.run("remove_product", self.file, **{"product": product})
|
||||
|
||||
def sync_edited_objects(self):
|
||||
for obj_name in IfcStore.edited_objs.copy():
|
||||
@@ -114,6 +124,14 @@ class IfcExporter:
|
||||
if not np.allclose(ifc_matrix, blender_matrix, atol=0.0001):
|
||||
bpy.ops.bim.edit_object_placement(obj=obj.name)
|
||||
|
||||
def should_delete(self, guid, obj):
|
||||
try:
|
||||
# This will throw an exception if the Blender object no longer exists
|
||||
foo = obj.name
|
||||
return False
|
||||
except:
|
||||
return True
|
||||
|
||||
def get_application_name(self):
|
||||
return "BlenderBIM"
|
||||
|
||||
+87
-6
@@ -1,9 +1,11 @@
|
||||
import bpy
|
||||
import json
|
||||
import addon_utils
|
||||
import blenderbim.bim.decoration as decoration
|
||||
import ifcopenshell.api.owner.settings
|
||||
from bpy.app.handlers import persistent
|
||||
from blenderbim.bim.ifc import IfcStore
|
||||
from blenderbim.bim.module.attribute.data import Data as AttributeData
|
||||
from ifcopenshell.api.attribute.data import Data as AttributeData
|
||||
|
||||
|
||||
def mode_callback(obj, data):
|
||||
@@ -28,7 +30,7 @@ def name_callback(obj, data):
|
||||
if not element.is_a("IfcRoot"):
|
||||
return
|
||||
element.Name = "/".join(obj.name.split("/")[1:])
|
||||
AttributeData.load(obj.BIMObjectProperties.ifc_definition_id)
|
||||
AttributeData.load(IfcStore.get_file(), obj.BIMObjectProperties.ifc_definition_id)
|
||||
|
||||
|
||||
def subscribe_to(object, data_path, callback):
|
||||
@@ -46,14 +48,13 @@ def subscribe_to(object, data_path, callback):
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
def purge_module_data():
|
||||
from blenderbim.bim import modules
|
||||
|
||||
for module in modules.values():
|
||||
if not module:
|
||||
continue
|
||||
for name in modules.keys():
|
||||
try:
|
||||
getattr(getattr(module, "data"), "Data").purge()
|
||||
getattr(getattr(getattr(ifcopenshell.api, name), "data"), "Data").purge()
|
||||
except AttributeError:
|
||||
pass
|
||||
|
||||
@@ -99,8 +100,88 @@ def storeIdMap(scene):
|
||||
bpy.context.scene.BIMProperties.guid_map = json.dumps({k: v.name for k, v in IfcStore.guid_map.items()})
|
||||
|
||||
|
||||
def get_application(ifc):
|
||||
version = get_application_version()
|
||||
for element in ifc.by_type("IfcApplication"):
|
||||
if element.ApplicationIdentifier == "BlenderBIM" and element.Version == version:
|
||||
return element
|
||||
return ifc.create_entity(
|
||||
"IfcApplication",
|
||||
**{
|
||||
"ApplicationDeveloper": create_application_organisation(ifc),
|
||||
"Version": get_application_version(),
|
||||
"ApplicationFullName": "BlenderBIM Add-on",
|
||||
"ApplicationIdentifier": "BlenderBIM",
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
def get_application_version():
|
||||
return ".".join(
|
||||
[
|
||||
str(x)
|
||||
for x in [
|
||||
addon.bl_info.get("version", (-1, -1, -1))
|
||||
for addon in addon_utils.modules()
|
||||
if addon.bl_info["name"] == "BlenderBIM"
|
||||
][0]
|
||||
]
|
||||
)
|
||||
|
||||
|
||||
def create_application_organisation(ifc):
|
||||
return ifc.create_entity(
|
||||
"IfcOrganization",
|
||||
**{
|
||||
"Name": "IfcOpenShell",
|
||||
"Description": "IfcOpenShell is an open source (LGPL) software library that helps users and software developers to work with the IFC file format.",
|
||||
"Roles": [ifc.create_entity("IfcActorRole", **{"Role": "USERDEFINED", "UserDefinedRole": "CONTRIBUTOR"})],
|
||||
"Addresses": [
|
||||
ifc.create_entity(
|
||||
"IfcTelecomAddress",
|
||||
**{
|
||||
"Purpose": "USERDEFINED",
|
||||
"UserDefinedPurpose": "WEBPAGE",
|
||||
"Description": "The main webpage of the software collection.",
|
||||
"WWWHomePageURL": "https://ifcopenshell.org",
|
||||
},
|
||||
),
|
||||
ifc.create_entity(
|
||||
"IfcTelecomAddress",
|
||||
**{
|
||||
"Purpose": "USERDEFINED",
|
||||
"UserDefinedPurpose": "WEBPAGE",
|
||||
"Description": "The BlenderBIM Add-on webpage of the software collection.",
|
||||
"WWWHomePageURL": "https://blenderbim.org",
|
||||
},
|
||||
),
|
||||
ifc.create_entity(
|
||||
"IfcTelecomAddress",
|
||||
**{
|
||||
"Purpose": "USERDEFINED",
|
||||
"UserDefinedPurpose": "REPOSITORY",
|
||||
"Description": "The source code repository of the software collection.",
|
||||
"WWWHomePageURL": "https://github.com/IfcOpenShell/IfcOpenShell.git",
|
||||
},
|
||||
),
|
||||
],
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
@persistent
|
||||
def setDefaultProperties(scene):
|
||||
ifcopenshell.api.owner.settings.get_person = (
|
||||
lambda ifc : ifc.by_id(int(bpy.context.scene.BIMOwnerProperties.user_person))
|
||||
if bpy.context.scene.BIMOwnerProperties.user_person
|
||||
else None
|
||||
)
|
||||
ifcopenshell.api.owner.settings.get_organisation = (
|
||||
lambda ifc : ifc.by_id(int(bpy.context.scene.BIMOwnerProperties.user_organisation))
|
||||
if bpy.context.scene.BIMOwnerProperties.user_organisation
|
||||
else None
|
||||
)
|
||||
ifcopenshell.api.owner.settings.get_application = get_application
|
||||
if len(bpy.context.scene.DocProperties.drawing_styles) == 0:
|
||||
drawing_style = bpy.context.scene.DocProperties.drawing_styles.add()
|
||||
drawing_style.name = "Technical"
|
||||
+42
-26
@@ -21,7 +21,6 @@ import numpy as np
|
||||
from pathlib import Path
|
||||
from itertools import cycle
|
||||
from datetime import datetime
|
||||
from blenderbim.bim.module.context.data import Data as ContextData
|
||||
from blenderbim.bim.ifc import IfcStore
|
||||
from . import schema
|
||||
|
||||
@@ -420,7 +419,7 @@ class IfcImporter:
|
||||
representations = self.get_transformed_body_representations(element.Representation.Representations)
|
||||
|
||||
# Single swept disk solids (e.g. rebar) are better natively represented as beveled curves
|
||||
if [r for r in representations if self.is_native_swept_disk_solid(r)]:
|
||||
if self.is_native_swept_disk_solid(representations):
|
||||
self.native_data[element.GlobalId] = {
|
||||
"representations": representations,
|
||||
"representation": self.get_body_representation(element.Representation.Representations),
|
||||
@@ -429,19 +428,26 @@ class IfcImporter:
|
||||
return True
|
||||
# FacetedBreps (without voids) are meshes. See #841.
|
||||
# Commented out as seems currently too slow.
|
||||
# if [r for r in representations if self.is_native_faceted_brep(r)]:
|
||||
# self.native_data[element.GlobalId] = {
|
||||
# "representations": representations,
|
||||
# "representation": self.get_body_representation(element.Representation.Representations),
|
||||
# "type": "IfcFacetedBrep",
|
||||
# }
|
||||
# return True
|
||||
# if self.is_native_faceted_brep(representations):
|
||||
# self.native_data[element.GlobalId] = {
|
||||
# "representations": representations,
|
||||
# "representation": self.get_body_representation(element.Representation.Representations),
|
||||
# "type": "IfcFacetedBrep",
|
||||
# }
|
||||
# return True
|
||||
|
||||
def is_native_swept_disk_solid(self, representation):
|
||||
return len(representation["raw"].Items) == 1 and representation["raw"].Items[0].is_a("IfcSweptDiskSolid")
|
||||
def is_native_swept_disk_solid(self, representations):
|
||||
for representation in representations:
|
||||
if len(representation["raw"].Items) > 1 or not representation["raw"].Items[0].is_a("IfcSweptDiskSolid"):
|
||||
return False
|
||||
return True
|
||||
|
||||
def is_native_faceted_brep(self, representation):
|
||||
return bool([i for i in representation["raw"].Items if i.is_a() == "IfcFacetedBrep"])
|
||||
def is_native_faceted_brep(self, representations):
|
||||
for representation in representations:
|
||||
for i in representation["raw"].Items:
|
||||
if i.is_a() != "IfcFacetedBrep":
|
||||
return False
|
||||
return True
|
||||
|
||||
def get_products_from_shape_representation(self, element):
|
||||
products = [pr.ShapeOfProduct[0] for pr in element.OfProductRepresentation]
|
||||
@@ -634,6 +640,7 @@ class IfcImporter:
|
||||
def create_native_products(self):
|
||||
total = 0
|
||||
checkpoint = time.time()
|
||||
bm = bmesh.new()
|
||||
for element in self.native_elements:
|
||||
total += 1
|
||||
if total % 250 == 0:
|
||||
@@ -641,6 +648,8 @@ class IfcImporter:
|
||||
checkpoint = time.time()
|
||||
native_data = self.native_data[element.GlobalId]
|
||||
representation = native_data["representation"]
|
||||
if not representation:
|
||||
continue
|
||||
context_id = representation.ContextOfItems.id() if hasattr(representation, "ContextOfItems") else 0
|
||||
mesh_name = f"{context_id}/{representation.id()}"
|
||||
mesh = self.meshes.get(mesh_name)
|
||||
@@ -650,16 +659,17 @@ class IfcImporter:
|
||||
elif native_data["type"] == "IfcFacetedBrep":
|
||||
mesh = self.create_native_faceted_brep(element, mesh_name)
|
||||
mesh.BIMMeshProperties.ifc_definition_id = representation.id()
|
||||
mesh.name = mesh_name
|
||||
self.meshes[mesh_name] = mesh
|
||||
self.create_product(element, mesh=mesh)
|
||||
if native_data["type"] == "IfcFacetedBrep":
|
||||
# The current implementation doesn't reuse vertices, so we weld it after assigning materials.
|
||||
# This welding isn't true to the representation, but is easy and seems inexpensive.
|
||||
bm = bmesh.new()
|
||||
bm.from_mesh(mesh)
|
||||
bmesh.ops.remove_doubles(bm, verts=bm.verts, dist=0.001)
|
||||
bm.to_mesh(mesh)
|
||||
bm.free()
|
||||
bm.clear()
|
||||
bm.free()
|
||||
|
||||
print("Done creating geometry")
|
||||
|
||||
@@ -715,21 +725,27 @@ class IfcImporter:
|
||||
|
||||
def create_structural_point_connections(self):
|
||||
for product in self.file.by_type("IfcStructuralPointConnection"):
|
||||
# TODO: make this based off ifcopenshell. See #1409
|
||||
placement_matrix = ifcopenshell.util.placement.get_local_placement(product.ObjectPlacement)
|
||||
vertex = None
|
||||
for subelement in self.file.traverse(product):
|
||||
context = None
|
||||
representation = None
|
||||
for subelement in self.file.traverse(product.Representation):
|
||||
if subelement.is_a("IfcVertex") and subelement.VertexGeometry.is_a("IfcCartesianPoint"):
|
||||
vertex = list(subelement.VertexGeometry.Coordinates)
|
||||
break
|
||||
if not vertex:
|
||||
elif subelement.is_a("IfcGeometricRepresentationContext"):
|
||||
context = subelement
|
||||
elif subelement.is_a("IfcTopologyRepresentation"):
|
||||
representation = subelement
|
||||
if not vertex or not context or not representation:
|
||||
continue # TODO implement non cartesian point vertexes
|
||||
placement_matrix[0, 3] += vertex[0] * self.unit_scale
|
||||
placement_matrix[1, 3] += vertex[1] * self.unit_scale
|
||||
placement_matrix[2, 3] += vertex[2] * self.unit_scale
|
||||
obj = bpy.data.objects.new("{}/{}".format(product.is_a(), product.Name), None)
|
||||
|
||||
mesh_name = f"{context.id()}/{representation.id()}"
|
||||
mesh = bpy.data.meshes.new(mesh_name)
|
||||
mesh.from_pydata([mathutils.Vector(vertex) * self.unit_scale], [], [])
|
||||
|
||||
obj = bpy.data.objects.new("{}/{}".format(product.is_a(), product.Name), mesh)
|
||||
obj.matrix_world = mathutils.Matrix(placement_matrix.tolist())
|
||||
obj.empty_display_type = "SPHERE"
|
||||
obj.empty_display_size = 0.1
|
||||
self.link_element(product, obj)
|
||||
|
||||
def create_curve_products(self, products):
|
||||
@@ -843,7 +859,7 @@ class IfcImporter:
|
||||
points = outer_bound[0].copy()
|
||||
[points.extend(p) for p in inner_bounds]
|
||||
tessellated_polygons = mathutils.geometry.tessellate_polygon(outer_bound + inner_bounds)
|
||||
tessellated_faces = [[{"Coordinates": points[pi]} for pi in t] for t in tessellated_polygons]
|
||||
tessellated_faces = [({"Coordinates": points[pi]} for pi in t) for t in tessellated_polygons]
|
||||
else:
|
||||
tessellated_faces = [face["Bounds"][0]["Bound"]["Polygon"]]
|
||||
|
||||
@@ -855,7 +871,7 @@ class IfcImporter:
|
||||
for point in tessellated_face:
|
||||
co.extend(
|
||||
representation["matrix"]
|
||||
@ mathutils.Vector([c * self.unit_scale for c in point["Coordinates"]])
|
||||
@ mathutils.Vector((c * self.unit_scale for c in point["Coordinates"]))
|
||||
)
|
||||
total_verts += 1
|
||||
loop_count += 1
|
||||
+7
-6
@@ -1,7 +1,7 @@
|
||||
import bpy
|
||||
import blenderbim.bim.module.aggregate.assign_object as assign_object
|
||||
import ifcopenshell.api
|
||||
from blenderbim.bim.ifc import IfcStore
|
||||
from blenderbim.bim.module.aggregate.data import Data
|
||||
from ifcopenshell.api.aggregate.data import Data
|
||||
|
||||
|
||||
class AssignObject(bpy.types.Operator):
|
||||
@@ -18,15 +18,16 @@ class AssignObject(bpy.types.Operator):
|
||||
if not relating_object or not relating_object.BIMObjectProperties.ifc_definition_id:
|
||||
return {"FINISHED"}
|
||||
product = self.file.by_id(props.ifc_definition_id)
|
||||
assign_object.Usecase(
|
||||
ifcopenshell.api.run(
|
||||
"aggregate.assign_object",
|
||||
self.file,
|
||||
{
|
||||
**{
|
||||
"product": product,
|
||||
"relating_object": self.file.by_id(relating_object.BIMObjectProperties.ifc_definition_id),
|
||||
},
|
||||
).execute()
|
||||
)
|
||||
bpy.ops.bim.edit_object_placement(obj=related_object.name)
|
||||
Data.load(props.ifc_definition_id)
|
||||
Data.load(IfcStore.get_file(), props.ifc_definition_id)
|
||||
bpy.ops.bim.disable_editing_aggregate(obj=related_object.name)
|
||||
|
||||
spatial_collection = bpy.data.collections.get(related_object.name)
|
||||
+3
-3
@@ -1,5 +1,5 @@
|
||||
from bpy.types import Panel
|
||||
from blenderbim.bim.module.aggregate.data import Data
|
||||
from ifcopenshell.api.aggregate.data import Data
|
||||
from blenderbim.bim.ifc import IfcStore
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ class BIM_PT_aggregate(Panel):
|
||||
if not IfcStore.get_file().by_id(props.ifc_definition_id).is_a("IfcObjectDefinition"):
|
||||
return False
|
||||
if props.ifc_definition_id not in Data.products:
|
||||
Data.load(props.ifc_definition_id)
|
||||
Data.load(IfcStore.get_file(), props.ifc_definition_id)
|
||||
if not Data.products[props.ifc_definition_id]:
|
||||
return False
|
||||
return True
|
||||
@@ -29,7 +29,7 @@ class BIM_PT_aggregate(Panel):
|
||||
if not props.ifc_definition_id:
|
||||
return
|
||||
if props.ifc_definition_id not in Data.products:
|
||||
Data.load(props.ifc_definition_id)
|
||||
Data.load(IfcStore.get_file(), props.ifc_definition_id)
|
||||
|
||||
if props.is_editing_aggregate:
|
||||
row = self.layout.row(align=True)
|
||||
+7
-8
@@ -1,9 +1,9 @@
|
||||
import bpy
|
||||
import json
|
||||
import ifcopenshell
|
||||
import blenderbim.bim.module.attribute.edit_attributes as edit_attributes
|
||||
import ifcopenshell.api
|
||||
from blenderbim.bim.ifc import IfcStore
|
||||
from blenderbim.bim.module.attribute.data import Data
|
||||
from ifcopenshell.api.attribute.data import Data
|
||||
|
||||
|
||||
class EnableEditingAttributes(bpy.types.Operator):
|
||||
@@ -33,7 +33,7 @@ class EnableEditingAttributes(bpy.types.Operator):
|
||||
elif attribute["type"] == "integer":
|
||||
new.int_value = attribute["value"] or 0
|
||||
elif attribute["type"] == "float":
|
||||
new.float_value = attribute["value"] or 0.
|
||||
new.float_value = attribute["value"] or 0.0
|
||||
elif attribute["type"] == "enum":
|
||||
new.enum_items = json.dumps(attribute["enum_items"])
|
||||
if attribute["value"]:
|
||||
@@ -95,17 +95,16 @@ class EditAttributes(bpy.types.Operator):
|
||||
elif attribute["type"] == "enum":
|
||||
attributes[attribute["name"]] = blender_attribute.enum_value
|
||||
product = self.file.by_id(oprops.ifc_definition_id)
|
||||
edit_attributes.Usecase(self.file, {
|
||||
"product": product,
|
||||
"attributes": attributes
|
||||
}).execute()
|
||||
ifcopenshell.api.run(
|
||||
"attribute.edit_attributes", self.file, **{"product": product, "attributes": attributes}
|
||||
)
|
||||
if "Name" in attributes:
|
||||
new_name = "{}/{}".format(product.is_a(), product.Name or "Unnamed")
|
||||
collection = bpy.data.collections.get(obj.name)
|
||||
if collection:
|
||||
collection.name = new_name
|
||||
obj.name = new_name
|
||||
Data.load(oprops.ifc_definition_id)
|
||||
Data.load(IfcStore.get_file(), oprops.ifc_definition_id)
|
||||
bpy.ops.bim.disable_editing_attributes(obj=obj.name, obj_type=self.obj_type)
|
||||
return {"FINISHED"}
|
||||
|
||||
-1
@@ -1,6 +1,5 @@
|
||||
import bpy
|
||||
import blenderbim.bim.schema # refactor
|
||||
from blenderbim.bim.module.material.data import Data
|
||||
from blenderbim.bim.ifc import IfcStore
|
||||
from blenderbim.bim.prop import StrProperty, Attribute
|
||||
from bpy.types import PropertyGroup
|
||||
+3
-2
@@ -1,5 +1,6 @@
|
||||
from bpy.types import Panel
|
||||
from blenderbim.bim.module.attribute.data import Data
|
||||
from blenderbim.bim.ifc import IfcStore
|
||||
from ifcopenshell.api.attribute.data import Data
|
||||
|
||||
|
||||
def draw_ui(context, layout, obj_type):
|
||||
@@ -7,7 +8,7 @@ def draw_ui(context, layout, obj_type):
|
||||
oprops = obj.BIMObjectProperties
|
||||
props = obj.BIMAttributeProperties
|
||||
if oprops.ifc_definition_id not in Data.products:
|
||||
Data.load(oprops.ifc_definition_id)
|
||||
Data.load(IfcStore.get_file(), oprops.ifc_definition_id)
|
||||
|
||||
if props.is_editing_attributes:
|
||||
row = layout.row(align=True)
|
||||
-1
@@ -1,6 +1,5 @@
|
||||
import bpy
|
||||
from blenderbim.bim.prop import StrProperty, Attribute
|
||||
from blenderbim.bim.module.owner.data import Data
|
||||
from bpy.types import PropertyGroup
|
||||
from bpy.props import (
|
||||
PointerProperty,
|
||||
+39
-32
@@ -1,13 +1,8 @@
|
||||
import bpy
|
||||
import json
|
||||
import blenderbim.bim.module.classification.add_classification as add_classification
|
||||
import blenderbim.bim.module.classification.remove_classification as remove_classification
|
||||
import blenderbim.bim.module.classification.edit_classification as edit_classification
|
||||
import blenderbim.bim.module.classification.add_reference as add_reference
|
||||
import blenderbim.bim.module.classification.remove_reference as remove_reference
|
||||
import blenderbim.bim.module.classification.edit_reference as edit_reference
|
||||
import ifcopenshell.api
|
||||
from blenderbim.bim.ifc import IfcStore
|
||||
from blenderbim.bim.module.classification.data import Data
|
||||
from ifcopenshell.api.classification.data import Data
|
||||
from blenderbim.bim.module.classification.prop import getClassifications, getReferences
|
||||
|
||||
|
||||
@@ -34,10 +29,12 @@ class AddClassification(bpy.types.Operator):
|
||||
|
||||
def execute(self, context):
|
||||
props = context.scene.BIMClassificationProperties
|
||||
add_classification.Usecase(
|
||||
IfcStore.get_file(), {"classification": Data.library_file.by_id(int(props.available_classifications))}
|
||||
).execute()
|
||||
Data.load()
|
||||
ifcopenshell.api.run(
|
||||
"classification.add_classification",
|
||||
IfcStore.get_file(),
|
||||
**{"classification": Data.library_file.by_id(int(props.available_classifications))},
|
||||
)
|
||||
Data.load(IfcStore.get_file())
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
@@ -80,8 +77,12 @@ class RemoveClassification(bpy.types.Operator):
|
||||
|
||||
def execute(self, context):
|
||||
self.file = IfcStore.get_file()
|
||||
remove_classification.Usecase(self.file, {"classification": self.file.by_id(self.classification)}).execute()
|
||||
Data.load()
|
||||
ifcopenshell.api.run(
|
||||
"classification.remove_classification",
|
||||
self.file,
|
||||
**{"classification": self.file.by_id(self.classification)},
|
||||
)
|
||||
Data.load(IfcStore.get_file())
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
@@ -100,10 +101,12 @@ class EditClassification(bpy.types.Operator):
|
||||
else:
|
||||
attributes[attribute.name] = attribute.string_value
|
||||
self.file = IfcStore.get_file()
|
||||
edit_classification.Usecase(
|
||||
self.file, {"classification": self.file.by_id(props.active_classification_id), "attributes": attributes}
|
||||
).execute()
|
||||
Data.load()
|
||||
ifcopenshell.api.run(
|
||||
"classification.edit_classification",
|
||||
self.file,
|
||||
**{"classification": self.file.by_id(props.active_classification_id), "attributes": attributes},
|
||||
)
|
||||
Data.load(IfcStore.get_file())
|
||||
bpy.ops.bim.disable_editing_classification()
|
||||
return {"FINISHED"}
|
||||
|
||||
@@ -152,15 +155,16 @@ class RemoveClassificationReference(bpy.types.Operator):
|
||||
def execute(self, context):
|
||||
obj = bpy.data.objects.get(self.obj) if self.obj else bpy.context.active_object
|
||||
self.file = IfcStore.get_file()
|
||||
remove_reference.Usecase(
|
||||
ifcopenshell.api.run(
|
||||
"classification.remove_reference",
|
||||
self.file,
|
||||
{
|
||||
**{
|
||||
"reference": self.file.by_id(self.reference),
|
||||
"product": self.file.by_id(obj.BIMObjectProperties.ifc_definition_id),
|
||||
},
|
||||
).execute()
|
||||
Data.load(obj.BIMObjectProperties.ifc_definition_id)
|
||||
Data.load()
|
||||
)
|
||||
Data.load(IfcStore.get_file(), obj.BIMObjectProperties.ifc_definition_id)
|
||||
Data.load(IfcStore.get_file())
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
@@ -179,10 +183,12 @@ class EditClassificationReference(bpy.types.Operator):
|
||||
else:
|
||||
attributes[attribute.name] = attribute.string_value
|
||||
self.file = IfcStore.get_file()
|
||||
edit_reference.Usecase(
|
||||
self.file, {"reference": self.file.by_id(props.active_reference_id), "attributes": attributes}
|
||||
).execute()
|
||||
Data.load()
|
||||
ifcopenshell.api.run(
|
||||
"classification.edit_reference",
|
||||
self.file,
|
||||
**{"reference": self.file.by_id(props.active_reference_id), "attributes": attributes},
|
||||
)
|
||||
Data.load(IfcStore.get_file())
|
||||
bpy.ops.bim.disable_editing_classification_reference()
|
||||
return {"FINISHED"}
|
||||
|
||||
@@ -206,16 +212,17 @@ class AddClassificationReference(bpy.types.Operator):
|
||||
classification = self.file.by_id(classification_id)
|
||||
break
|
||||
|
||||
add_reference.Usecase(
|
||||
ifcopenshell.api.run(
|
||||
"classification.add_reference",
|
||||
self.file,
|
||||
{
|
||||
**{
|
||||
"reference": Data.library_file.by_id(self.reference),
|
||||
"product": self.file.by_id(obj.BIMObjectProperties.ifc_definition_id),
|
||||
"classification": classification
|
||||
"classification": classification,
|
||||
},
|
||||
).execute()
|
||||
Data.load(obj.BIMObjectProperties.ifc_definition_id)
|
||||
Data.load()
|
||||
)
|
||||
Data.load(IfcStore.get_file(), obj.BIMObjectProperties.ifc_definition_id)
|
||||
Data.load(IfcStore.get_file())
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import bpy
|
||||
from blenderbim.bim.prop import StrProperty, Attribute
|
||||
from blenderbim.bim.module.classification.data import Data
|
||||
from ifcopenshell.api.classification.data import Data
|
||||
from bpy.types import PropertyGroup
|
||||
from bpy.props import (
|
||||
PointerProperty,
|
||||
+4
-4
@@ -1,6 +1,6 @@
|
||||
from bpy.types import Panel, UIList
|
||||
from blenderbim.bim.ifc import IfcStore
|
||||
from blenderbim.bim.module.classification.data import Data
|
||||
from ifcopenshell.api.classification.data import Data
|
||||
|
||||
|
||||
class BIM_PT_classifications(Panel):
|
||||
@@ -17,7 +17,7 @@ class BIM_PT_classifications(Panel):
|
||||
|
||||
def draw(self, context):
|
||||
if not Data.is_loaded:
|
||||
Data.load()
|
||||
Data.load(IfcStore.get_file())
|
||||
|
||||
self.props = context.scene.BIMClassificationProperties
|
||||
|
||||
@@ -79,9 +79,9 @@ class BIM_PT_classification_references(Panel):
|
||||
self.props = obj.BIMClassificationReferenceProperties
|
||||
self.file = IfcStore.get_file()
|
||||
if not Data.is_loaded:
|
||||
Data.load()
|
||||
Data.load(IfcStore.get_file())
|
||||
if self.oprops.ifc_definition_id not in Data.products:
|
||||
Data.load(self.oprops.ifc_definition_id)
|
||||
Data.load(IfcStore.get_file(), self.oprops.ifc_definition_id)
|
||||
|
||||
self.draw_add_ui()
|
||||
|
||||
+32
-24
@@ -1,13 +1,9 @@
|
||||
import bpy
|
||||
import json
|
||||
import ifcopenshell.api
|
||||
import ifcopenshell.util.attribute
|
||||
import blenderbim.bim.module.constraint.add_objective as add_objective
|
||||
import blenderbim.bim.module.constraint.edit_objective as edit_objective
|
||||
import blenderbim.bim.module.constraint.remove_constraint as remove_constraint
|
||||
import blenderbim.bim.module.constraint.assign_constraint as assign_constraint
|
||||
import blenderbim.bim.module.constraint.unassign_constraint as unassign_constraint
|
||||
from blenderbim.bim.ifc import IfcStore
|
||||
from blenderbim.bim.module.constraint.data import Data
|
||||
from ifcopenshell.api.constraint.data import Data
|
||||
|
||||
|
||||
class LoadObjectives(bpy.types.Operator):
|
||||
@@ -83,8 +79,8 @@ class AddObjective(bpy.types.Operator):
|
||||
bl_label = "Add Objective"
|
||||
|
||||
def execute(self, context):
|
||||
result = add_objective.Usecase(IfcStore.get_file()).execute()
|
||||
Data.load()
|
||||
result = ifcopenshell.api.run("constraint.add_objective", IfcStore.get_file())
|
||||
Data.load(IfcStore.get_file())
|
||||
bpy.ops.bim.load_objectives()
|
||||
bpy.ops.bim.enable_editing_constraint(constraint=result.id())
|
||||
return {"FINISHED"}
|
||||
@@ -105,10 +101,12 @@ class EditObjective(bpy.types.Operator):
|
||||
else:
|
||||
attributes[attribute.name] = attribute.string_value
|
||||
self.file = IfcStore.get_file()
|
||||
edit_objective.Usecase(
|
||||
self.file, {"objective": self.file.by_id(props.active_constraint_id), "attributes": attributes}
|
||||
).execute()
|
||||
Data.load()
|
||||
ifcopenshell.api.run(
|
||||
"constraint.edit_objective",
|
||||
self.file,
|
||||
**{"objective": self.file.by_id(props.active_constraint_id), "attributes": attributes}
|
||||
)
|
||||
Data.load(IfcStore.get_file())
|
||||
bpy.ops.bim.load_objectives()
|
||||
return {"FINISHED"}
|
||||
|
||||
@@ -121,8 +119,10 @@ class RemoveConstraint(bpy.types.Operator):
|
||||
def execute(self, context):
|
||||
props = context.scene.BIMConstraintProperties
|
||||
self.file = IfcStore.get_file()
|
||||
remove_constraint.Usecase(self.file, {"constraint": self.file.by_id(self.constraint)}).execute()
|
||||
Data.load()
|
||||
ifcopenshell.api.run(
|
||||
"constraint.remove_constraint", self.file, **{"constraint": self.file.by_id(self.constraint)}
|
||||
)
|
||||
Data.load(IfcStore.get_file())
|
||||
if props.is_editing == "IfcObjective":
|
||||
bpy.ops.bim.load_objectives()
|
||||
return {"FINISHED"}
|
||||
@@ -163,11 +163,15 @@ class AssignConstraint(bpy.types.Operator):
|
||||
def execute(self, context):
|
||||
obj = bpy.data.objects.get(self.obj) if self.obj else context.active_object
|
||||
self.file = IfcStore.get_file()
|
||||
assign_constraint.Usecase(self.file, {
|
||||
"product": self.file.by_id(obj.BIMObjectProperties.ifc_definition_id),
|
||||
"constraint": self.file.by_id(self.constraint)
|
||||
}).execute()
|
||||
Data.load(obj.BIMObjectProperties.ifc_definition_id)
|
||||
ifcopenshell.api.run(
|
||||
"constraint.assign_constraint",
|
||||
self.file,
|
||||
**{
|
||||
"product": self.file.by_id(obj.BIMObjectProperties.ifc_definition_id),
|
||||
"constraint": self.file.by_id(self.constraint),
|
||||
}
|
||||
)
|
||||
Data.load(IfcStore.get_file(), obj.BIMObjectProperties.ifc_definition_id)
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
@@ -180,9 +184,13 @@ class UnassignConstraint(bpy.types.Operator):
|
||||
def execute(self, context):
|
||||
obj = bpy.data.objects.get(self.obj) if self.obj else context.active_object
|
||||
self.file = IfcStore.get_file()
|
||||
unassign_constraint.Usecase(self.file, {
|
||||
"product": self.file.by_id(obj.BIMObjectProperties.ifc_definition_id),
|
||||
"constraint": self.file.by_id(self.constraint)
|
||||
}).execute()
|
||||
Data.load(obj.BIMObjectProperties.ifc_definition_id)
|
||||
ifcopenshell.api.run(
|
||||
"constraint.unassign_constraint",
|
||||
self.file,
|
||||
**{
|
||||
"product": self.file.by_id(obj.BIMObjectProperties.ifc_definition_id),
|
||||
"constraint": self.file.by_id(self.constraint),
|
||||
}
|
||||
)
|
||||
Data.load(IfcStore.get_file(), obj.BIMObjectProperties.ifc_definition_id)
|
||||
return {"FINISHED"}
|
||||
+4
-4
@@ -1,6 +1,6 @@
|
||||
from bpy.types import Panel, UIList
|
||||
from blenderbim.bim.ifc import IfcStore
|
||||
from blenderbim.bim.module.constraint.data import Data
|
||||
from ifcopenshell.api.constraint.data import Data
|
||||
|
||||
|
||||
class BIM_PT_constraints(Panel):
|
||||
@@ -17,7 +17,7 @@ class BIM_PT_constraints(Panel):
|
||||
|
||||
def draw(self, context):
|
||||
if not Data.is_loaded:
|
||||
Data.load()
|
||||
Data.load(IfcStore.get_file())
|
||||
|
||||
self.props = context.scene.BIMConstraintProperties
|
||||
|
||||
@@ -73,9 +73,9 @@ class BIM_PT_object_constraints(Panel):
|
||||
self.props = obj.BIMObjectConstraintProperties
|
||||
self.file = IfcStore.get_file()
|
||||
if not Data.is_loaded:
|
||||
Data.load()
|
||||
Data.load(IfcStore.get_file())
|
||||
if self.oprops.ifc_definition_id not in Data.products:
|
||||
Data.load(self.oprops.ifc_definition_id)
|
||||
Data.load(IfcStore.get_file(), self.oprops.ifc_definition_id)
|
||||
|
||||
self.draw_add_ui()
|
||||
|
||||
+11
-10
@@ -1,8 +1,7 @@
|
||||
import bpy
|
||||
import blenderbim.bim.module.context.add_context as add_context
|
||||
import blenderbim.bim.module.context.remove_context as remove_context
|
||||
import ifcopenshell.api
|
||||
from blenderbim.bim.ifc import IfcStore
|
||||
from blenderbim.bim.module.context.data import Data
|
||||
from ifcopenshell.api.context.data import Data
|
||||
|
||||
|
||||
class AddSubcontext(bpy.types.Operator):
|
||||
@@ -14,15 +13,16 @@ class AddSubcontext(bpy.types.Operator):
|
||||
|
||||
def execute(self, context):
|
||||
self.file = IfcStore.get_file()
|
||||
add_context.Usecase(
|
||||
ifcopenshell.api.run(
|
||||
"context.add_context",
|
||||
self.file,
|
||||
{
|
||||
**{
|
||||
"context": self.context or bpy.context.scene.BIMProperties.available_contexts,
|
||||
"subcontext": self.subcontext or bpy.context.scene.BIMProperties.available_subcontexts,
|
||||
"target_view": self.target_view or bpy.context.scene.BIMProperties.available_target_views,
|
||||
},
|
||||
).execute()
|
||||
Data.load()
|
||||
)
|
||||
Data.load(IfcStore.get_file())
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
@@ -33,7 +33,8 @@ class RemoveSubcontext(bpy.types.Operator):
|
||||
|
||||
def execute(self, context):
|
||||
self.file = IfcStore.get_file()
|
||||
usecase = remove_context.Usecase(self.file, {"context": self.file.by_id(self.ifc_definition_id)})
|
||||
usecase.execute()
|
||||
Data.load()
|
||||
ifcopenshell.api.run(
|
||||
"context.remove_context", self.file, **{"context": self.file.by_id(self.ifc_definition_id)}
|
||||
)
|
||||
Data.load(IfcStore.get_file())
|
||||
return {"FINISHED"}
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
from bpy.types import Panel
|
||||
from blenderbim.bim.module.context.data import Data
|
||||
from ifcopenshell.api.context.data import Data
|
||||
from blenderbim.bim.ifc import IfcStore
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ class BIM_PT_context(Panel):
|
||||
|
||||
def draw(self, context):
|
||||
if not Data.is_loaded:
|
||||
Data.load()
|
||||
Data.load(IfcStore.get_file())
|
||||
|
||||
props = context.scene.BIMProperties
|
||||
|
||||
+3
@@ -53,6 +53,9 @@ class BIM_PT_debug(Panel):
|
||||
row = layout.row(align=True)
|
||||
row.prop(attribute, "name", text="")
|
||||
row.prop(attribute, "string_value", text="")
|
||||
if attribute.name == "GlobalId":
|
||||
op = row.operator("bim.select_global_id", icon="RESTRICT_SELECT_OFF", text="")
|
||||
op.global_id = attribute.string_value
|
||||
if attribute.int_value:
|
||||
row.operator(
|
||||
"bim.inspect_from_step_id", icon="DISCLOSURE_TRI_RIGHT", text=""
|
||||
+38
-32
@@ -1,15 +1,9 @@
|
||||
import bpy
|
||||
import json
|
||||
import ifcopenshell.api
|
||||
import ifcopenshell.util.attribute
|
||||
import blenderbim.bim.module.document.add_information as add_information
|
||||
import blenderbim.bim.module.document.add_reference as add_reference
|
||||
import blenderbim.bim.module.document.edit_information as edit_information
|
||||
import blenderbim.bim.module.document.edit_reference as edit_reference
|
||||
import blenderbim.bim.module.document.remove_document as remove_document
|
||||
import blenderbim.bim.module.document.assign_document as assign_document
|
||||
import blenderbim.bim.module.document.unassign_document as unassign_document
|
||||
from blenderbim.bim.ifc import IfcStore
|
||||
from blenderbim.bim.module.document.data import Data
|
||||
from ifcopenshell.api.document.data import Data
|
||||
|
||||
|
||||
class LoadInformation(bpy.types.Operator):
|
||||
@@ -116,8 +110,8 @@ class AddInformation(bpy.types.Operator):
|
||||
bl_label = "Add Information"
|
||||
|
||||
def execute(self, context):
|
||||
result = add_information.Usecase(IfcStore.get_file()).execute()
|
||||
Data.load()
|
||||
result = ifcopenshell.api.run("document.add_information", IfcStore.get_file())
|
||||
Data.load(IfcStore.get_file())
|
||||
bpy.ops.bim.load_information()
|
||||
bpy.ops.bim.enable_editing_document(document=result.id())
|
||||
return {"FINISHED"}
|
||||
@@ -128,8 +122,8 @@ class AddDocumentReference(bpy.types.Operator):
|
||||
bl_label = "Add Document Reference"
|
||||
|
||||
def execute(self, context):
|
||||
result = add_reference.Usecase(IfcStore.get_file()).execute()
|
||||
Data.load()
|
||||
result = ifcopenshell.api.run("document.add_reference", IfcStore.get_file())
|
||||
Data.load(IfcStore.get_file())
|
||||
bpy.ops.bim.load_document_references()
|
||||
bpy.ops.bim.enable_editing_document(document=result.id())
|
||||
return {"FINISHED"}
|
||||
@@ -150,10 +144,12 @@ class EditInformation(bpy.types.Operator):
|
||||
else:
|
||||
attributes[attribute.name] = attribute.string_value
|
||||
self.file = IfcStore.get_file()
|
||||
edit_information.Usecase(
|
||||
self.file, {"information": self.file.by_id(props.active_document_id), "attributes": attributes}
|
||||
).execute()
|
||||
Data.load()
|
||||
ifcopenshell.api.run(
|
||||
"document.edit_information",
|
||||
self.file,
|
||||
**{"information": self.file.by_id(props.active_document_id), "attributes": attributes}
|
||||
)
|
||||
Data.load(IfcStore.get_file())
|
||||
bpy.ops.bim.load_information()
|
||||
return {"FINISHED"}
|
||||
|
||||
@@ -171,10 +167,12 @@ class EditDocumentReference(bpy.types.Operator):
|
||||
else:
|
||||
attributes[attribute.name] = attribute.string_value
|
||||
self.file = IfcStore.get_file()
|
||||
edit_reference.Usecase(
|
||||
self.file, {"reference": self.file.by_id(props.active_document_id), "attributes": attributes}
|
||||
).execute()
|
||||
Data.load()
|
||||
ifcopenshell.api.run(
|
||||
"document.edit_reference",
|
||||
self.file,
|
||||
**{"reference": self.file.by_id(props.active_document_id), "attributes": attributes}
|
||||
)
|
||||
Data.load(IfcStore.get_file())
|
||||
bpy.ops.bim.load_document_references()
|
||||
return {"FINISHED"}
|
||||
|
||||
@@ -187,8 +185,8 @@ class RemoveDocument(bpy.types.Operator):
|
||||
def execute(self, context):
|
||||
props = context.scene.BIMDocumentProperties
|
||||
self.file = IfcStore.get_file()
|
||||
remove_document.Usecase(self.file, {"document": self.file.by_id(self.document)}).execute()
|
||||
Data.load()
|
||||
ifcopenshell.api.run("document.remove_document", self.file, **{"document": self.file.by_id(self.document)})
|
||||
Data.load(IfcStore.get_file())
|
||||
if props.is_editing == "information":
|
||||
bpy.ops.bim.load_information()
|
||||
elif props.is_editing == "reference":
|
||||
@@ -233,11 +231,15 @@ class AssignDocument(bpy.types.Operator):
|
||||
def execute(self, context):
|
||||
obj = bpy.data.objects.get(self.obj) if self.obj else context.active_object
|
||||
self.file = IfcStore.get_file()
|
||||
assign_document.Usecase(self.file, {
|
||||
"product": self.file.by_id(obj.BIMObjectProperties.ifc_definition_id),
|
||||
"document": self.file.by_id(self.document)
|
||||
}).execute()
|
||||
Data.load(obj.BIMObjectProperties.ifc_definition_id)
|
||||
ifcopenshell.api.run(
|
||||
"document.assign_document",
|
||||
self.file,
|
||||
**{
|
||||
"product": self.file.by_id(obj.BIMObjectProperties.ifc_definition_id),
|
||||
"document": self.file.by_id(self.document),
|
||||
}
|
||||
)
|
||||
Data.load(IfcStore.get_file(), obj.BIMObjectProperties.ifc_definition_id)
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
@@ -250,9 +252,13 @@ class UnassignDocument(bpy.types.Operator):
|
||||
def execute(self, context):
|
||||
obj = bpy.data.objects.get(self.obj) if self.obj else context.active_object
|
||||
self.file = IfcStore.get_file()
|
||||
unassign_document.Usecase(self.file, {
|
||||
"product": self.file.by_id(obj.BIMObjectProperties.ifc_definition_id),
|
||||
"document": self.file.by_id(self.document)
|
||||
}).execute()
|
||||
Data.load(obj.BIMObjectProperties.ifc_definition_id)
|
||||
ifcopenshell.api.run(
|
||||
"document.unassign_document",
|
||||
self.file,
|
||||
**{
|
||||
"product": self.file.by_id(obj.BIMObjectProperties.ifc_definition_id),
|
||||
"document": self.file.by_id(self.document),
|
||||
}
|
||||
)
|
||||
Data.load(IfcStore.get_file(), obj.BIMObjectProperties.ifc_definition_id)
|
||||
return {"FINISHED"}
|
||||
+4
-4
@@ -1,6 +1,6 @@
|
||||
from bpy.types import Panel, UIList
|
||||
from blenderbim.bim.ifc import IfcStore
|
||||
from blenderbim.bim.module.document.data import Data
|
||||
from ifcopenshell.api.document.data import Data
|
||||
|
||||
|
||||
class BIM_PT_documents(Panel):
|
||||
@@ -17,7 +17,7 @@ class BIM_PT_documents(Panel):
|
||||
|
||||
def draw(self, context):
|
||||
if not Data.is_loaded:
|
||||
Data.load()
|
||||
Data.load(IfcStore.get_file())
|
||||
|
||||
self.props = context.scene.BIMDocumentProperties
|
||||
|
||||
@@ -77,9 +77,9 @@ class BIM_PT_object_documents(Panel):
|
||||
self.props = obj.BIMObjectDocumentProperties
|
||||
self.file = IfcStore.get_file()
|
||||
if not Data.is_loaded:
|
||||
Data.load()
|
||||
Data.load(IfcStore.get_file())
|
||||
if self.oprops.ifc_definition_id not in Data.products:
|
||||
Data.load(self.oprops.ifc_definition_id)
|
||||
Data.load(IfcStore.get_file(), self.oprops.ifc_definition_id)
|
||||
|
||||
self.draw_add_ui()
|
||||
|
||||
+2
-2
@@ -5,8 +5,8 @@ import subprocess
|
||||
import webbrowser
|
||||
from blenderbim.bim.operator import open_with_user_command
|
||||
from blenderbim.bim.ifc import IfcStore
|
||||
from blenderbim.bim.module.group.data import Data as GroupData
|
||||
from blenderbim.bim.module.pset.data import Data as PsetData
|
||||
from ifcopenshell.api.group.data import Data as GroupData
|
||||
from ifcopenshell.api.pset.data import Data as PsetData
|
||||
|
||||
cwd = os.path.dirname(os.path.realpath(__file__))
|
||||
|
||||
+47
-44
@@ -4,19 +4,12 @@ import ifcopenshell
|
||||
import ifcopenshell.util.unit
|
||||
import ifcopenshell.util.element
|
||||
import logging
|
||||
import blenderbim.bim.module.geometry.edit_object_placement as edit_object_placement
|
||||
import blenderbim.bim.module.geometry.add_representation as add_representation
|
||||
import blenderbim.bim.module.geometry.map_representation as map_representation
|
||||
import blenderbim.bim.module.geometry.assign_styles as assign_styles
|
||||
import blenderbim.bim.module.geometry.assign_representation as assign_representation
|
||||
import blenderbim.bim.module.geometry.unassign_representation as unassign_representation
|
||||
import blenderbim.bim.module.geometry.remove_representation as remove_representation
|
||||
import blenderbim.bim.module.grid.create_axis_curve as create_axis_curve
|
||||
import ifcopenshell.api
|
||||
from blenderbim.bim.ifc import IfcStore
|
||||
from blenderbim.bim import import_ifc
|
||||
from blenderbim.bim.module.geometry.data import Data
|
||||
from blenderbim.bim.module.context.data import Data as ContextData
|
||||
from blenderbim.bim.module.void.data import Data as VoidData
|
||||
from ifcopenshell.api.geometry.data import Data
|
||||
from ifcopenshell.api.context.data import Data as ContextData
|
||||
from ifcopenshell.api.void.data import Data as VoidData
|
||||
from mathutils import Vector
|
||||
|
||||
|
||||
@@ -55,13 +48,14 @@ class EditObjectPlacement(bpy.types.Operator):
|
||||
float(props.blender_x_axis_ordinate),
|
||||
)
|
||||
)
|
||||
edit_object_placement.Usecase(
|
||||
ifcopenshell.api.run(
|
||||
"geometry.edit_object_placement",
|
||||
self.file,
|
||||
{
|
||||
**{
|
||||
"product": self.file.by_id(obj.BIMObjectProperties.ifc_definition_id),
|
||||
"matrix": matrix,
|
||||
},
|
||||
).execute()
|
||||
)
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
@@ -103,7 +97,7 @@ class AddRepresentation(bpy.types.Operator):
|
||||
"should_force_triangulation": context.scene.BIMGeometryProperties.should_force_triangulation,
|
||||
}
|
||||
|
||||
result = add_representation.Usecase(self.file, representation_data).execute()
|
||||
result = ifcopenshell.api.run("geometry.add_representation", self.file, **representation_data)
|
||||
|
||||
if not result:
|
||||
print("Failed to write shape representation")
|
||||
@@ -117,12 +111,15 @@ class AddRepresentation(bpy.types.Operator):
|
||||
and context_of_items.ContextIdentifier == "Body"
|
||||
):
|
||||
representation_data["context"] = self.file.by_id(box_context_id)
|
||||
new_box = add_representation.Usecase(self.file, representation_data).execute()
|
||||
assign_representation.Usecase(self.file, {"product": product, "representation": new_box}).execute()
|
||||
new_box = ifcopenshell.api.run("geometry.add_representation", self.file, **representation_data)
|
||||
ifcopenshell.api.run(
|
||||
"geometry.assign_representation", self.file, **{"product": product, "representation": new_box}
|
||||
)
|
||||
|
||||
assign_styles.Usecase(
|
||||
ifcopenshell.api.run(
|
||||
"geometry.assign_styles",
|
||||
self.file,
|
||||
{
|
||||
**{
|
||||
"shape_representation": result,
|
||||
"styles": [
|
||||
self.file.by_id(s.material.BIMMaterialProperties.ifc_style_id)
|
||||
@@ -131,15 +128,17 @@ class AddRepresentation(bpy.types.Operator):
|
||||
],
|
||||
"should_use_presentation_style_assignment": context.scene.BIMGeometryProperties.should_use_presentation_style_assignment,
|
||||
},
|
||||
).execute()
|
||||
assign_representation.Usecase(self.file, {"product": product, "representation": result}).execute()
|
||||
)
|
||||
ifcopenshell.api.run(
|
||||
"geometry.assign_representation", self.file, **{"product": product, "representation": result}
|
||||
)
|
||||
|
||||
existing_mesh = obj.data
|
||||
mesh = obj.data.copy()
|
||||
mesh.name = "{}/{}".format(context_id, result.id())
|
||||
mesh.BIMMeshProperties.ifc_definition_id = int(result.id())
|
||||
obj.data = mesh
|
||||
Data.load(obj.BIMObjectProperties.ifc_definition_id)
|
||||
Data.load(IfcStore.get_file(), obj.BIMObjectProperties.ifc_definition_id)
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
@@ -190,7 +189,7 @@ class SwitchRepresentation(bpy.types.Operator):
|
||||
|
||||
if self.disable_opening_subtractions and self.context_of_items.ContextIdentifier == "Body":
|
||||
if self.oprops.ifc_definition_id not in VoidData.products:
|
||||
VoidData.load(self.oprops.ifc_definition_id)
|
||||
VoidData.load(IfcStore.get_file(), self.oprops.ifc_definition_id)
|
||||
for opening_id in VoidData.products[self.oprops.ifc_definition_id]:
|
||||
if opening_id in IfcStore.id_map:
|
||||
opening = IfcStore.id_map[opening_id]
|
||||
@@ -213,7 +212,6 @@ class RemoveRepresentation(bpy.types.Operator):
|
||||
self.file = IfcStore.get_file()
|
||||
representation = self.file.by_id(self.representation_id)
|
||||
obj = bpy.data.objects.get(self.obj) if self.obj else bpy.context.active_object
|
||||
product = self.file.by_id(obj.BIMObjectProperties.ifc_definition_id)
|
||||
is_mapped_representation = representation.RepresentationType == "MappedRepresentation"
|
||||
if is_mapped_representation:
|
||||
mesh_name = "{}/{}".format(
|
||||
@@ -232,9 +230,11 @@ class RemoveRepresentation(bpy.types.Operator):
|
||||
if not is_mapped_representation:
|
||||
bpy.data.meshes.remove(mesh)
|
||||
product = self.file.by_id(obj.BIMObjectProperties.ifc_definition_id)
|
||||
unassign_representation.Usecase(self.file, {"product": product, "representation": representation}).execute()
|
||||
remove_representation.Usecase(self.file, {"representation": representation}).execute()
|
||||
Data.load(product.id())
|
||||
ifcopenshell.api.run(
|
||||
"geometry.unassign_representation", self.file, **{"product": product, "representation": representation}
|
||||
)
|
||||
ifcopenshell.api.run("geometry.remove_representation", self.file, **{"representation": representation})
|
||||
Data.load(IfcStore.get_file(), product.id())
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
@@ -248,13 +248,13 @@ class MapRepresentations(bpy.types.Operator):
|
||||
related_object = IfcStore.id_map[self.product_id]
|
||||
|
||||
if self.product_id not in Data.products:
|
||||
Data.load(self.product_id)
|
||||
Data.load(IfcStore.get_file(), self.product_id)
|
||||
|
||||
for representation_id in Data.products[self.product_id]:
|
||||
bpy.ops.bim.remove_representation(obj=related_object.name, representation_id=representation_id)
|
||||
|
||||
if self.type_product_id not in Data.products:
|
||||
Data.load(self.type_product_id)
|
||||
Data.load(IfcStore.get_file(), self.type_product_id)
|
||||
|
||||
for representation_id in Data.products[self.type_product_id]:
|
||||
bpy.ops.bim.map_representation(
|
||||
@@ -283,11 +283,13 @@ class MapRepresentation(bpy.types.Operator):
|
||||
product = self.file.by_id(obj.BIMObjectProperties.ifc_definition_id)
|
||||
if obj_data:
|
||||
obj.data = obj_data
|
||||
result = map_representation.Usecase(
|
||||
self.file, {"representation": self.file.by_id(self.representation_id)}
|
||||
).execute()
|
||||
assign_representation.Usecase(self.file, {"product": product, "representation": result}).execute()
|
||||
Data.load(obj.BIMObjectProperties.ifc_definition_id)
|
||||
result = ifcopenshell.api.run(
|
||||
"geometry.map_representation", self.file, **{"representation": self.file.by_id(self.representation_id)}
|
||||
)
|
||||
ifcopenshell.api.run(
|
||||
"geometry.assign_representation", self.file, **{"product": product, "representation": result}
|
||||
)
|
||||
Data.load(IfcStore.get_file(), obj.BIMObjectProperties.ifc_definition_id)
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
@@ -299,7 +301,7 @@ class UpdateMeshRepresentation(bpy.types.Operator):
|
||||
|
||||
def execute(self, context):
|
||||
if not ContextData.is_loaded:
|
||||
ContextData.load()
|
||||
ContextData.load(IfcStore.get_file())
|
||||
|
||||
objs = [bpy.data.objects.get(self.obj)] if self.obj else bpy.context.selected_objects
|
||||
self.file = IfcStore.get_file()
|
||||
@@ -313,7 +315,7 @@ class UpdateMeshRepresentation(bpy.types.Operator):
|
||||
product = self.file.by_id(obj.BIMObjectProperties.ifc_definition_id)
|
||||
|
||||
if product.is_a("IfcGridAxis"):
|
||||
create_axis_curve.Usecase(self.file, {"AxisCurve": obj, "grid_axis": product}).execute()
|
||||
ifcopenshell.api.run("grid.create_axis_curve", self.file, **{"AxisCurve": obj, "grid_axis": product})
|
||||
return
|
||||
|
||||
bpy.ops.bim.edit_object_placement(obj=obj.name)
|
||||
@@ -340,12 +342,12 @@ class UpdateMeshRepresentation(bpy.types.Operator):
|
||||
"total_items": max(1, len(obj.material_slots)),
|
||||
"should_force_faceted_brep": context.scene.BIMGeometryProperties.should_force_faceted_brep,
|
||||
"should_force_triangulation": context.scene.BIMGeometryProperties.should_force_triangulation,
|
||||
"ifc_representation_class": self.ifc_representation_class
|
||||
"ifc_representation_class": self.ifc_representation_class,
|
||||
}
|
||||
|
||||
new_representation = add_representation.Usecase(self.file, representation_data).execute()
|
||||
new_representation = ifcopenshell.api.run("geometry.add_representation", self.file, **representation_data)
|
||||
|
||||
#if product.is_a("IfcWall"):
|
||||
# if product.is_a("IfcWall"):
|
||||
# # Generate axis representation
|
||||
# axis_context_id = get_context_id("Model", "Axis", "MODEL_VIEW")
|
||||
# old_axis = ifcopenshell.util.element.get_representation(product, "Model", "Axis", "MODEL_VIEW")
|
||||
@@ -372,13 +374,14 @@ class UpdateMeshRepresentation(bpy.types.Operator):
|
||||
and context_of_items.ContextIdentifier == "Body"
|
||||
):
|
||||
representation_data["context"] = self.file.by_id(box_context_id)
|
||||
new_box = add_representation.Usecase(self.file, representation_data).execute()
|
||||
new_box = ifcopenshell.api.run("geometry.add_representation", self.file, **representation_data)
|
||||
for inverse in self.file.get_inverse(old_box):
|
||||
ifcopenshell.util.element.replace_attribute(inverse, old_box, new_box)
|
||||
|
||||
assign_styles.Usecase(
|
||||
ifcopenshell.api.run(
|
||||
"geometry.assign_styles",
|
||||
self.file,
|
||||
{
|
||||
**{
|
||||
"shape_representation": new_representation,
|
||||
"styles": [
|
||||
self.file.by_id(s.material.BIMMaterialProperties.ifc_style_id)
|
||||
@@ -387,7 +390,7 @@ class UpdateMeshRepresentation(bpy.types.Operator):
|
||||
],
|
||||
"should_use_presentation_style_assignment": context.scene.BIMGeometryProperties.should_use_presentation_style_assignment,
|
||||
},
|
||||
).execute()
|
||||
)
|
||||
|
||||
# TODO: move this into a replace_representation usecase or something
|
||||
for inverse in self.file.get_inverse(old_representation):
|
||||
@@ -396,7 +399,7 @@ class UpdateMeshRepresentation(bpy.types.Operator):
|
||||
obj.data.BIMMeshProperties.ifc_definition_id = int(new_representation.id())
|
||||
obj.data.name = f"{old_representation.ContextOfItems.id()}/{new_representation.id()}"
|
||||
bpy.ops.bim.remove_representation(representation_id=old_representation.id())
|
||||
Data.load(obj.BIMObjectProperties.ifc_definition_id)
|
||||
Data.load(IfcStore.get_file(), obj.BIMObjectProperties.ifc_definition_id)
|
||||
|
||||
|
||||
class UpdateParametricRepresentation(bpy.types.Operator):
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
import bpy
|
||||
from bpy.types import Panel
|
||||
from blenderbim.bim.module.geometry.data import Data
|
||||
from ifcopenshell.api.geometry.data import Data
|
||||
from blenderbim.bim.ifc import IfcStore
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ class BIM_PT_representations(Panel):
|
||||
props = context.active_object.BIMObjectProperties
|
||||
|
||||
if props.ifc_definition_id not in Data.products:
|
||||
Data.load(props.ifc_definition_id)
|
||||
Data.load(IfcStore.get_file(), props.ifc_definition_id)
|
||||
|
||||
representations = Data.products[props.ifc_definition_id]
|
||||
if not representations:
|
||||
+14
-14
@@ -3,11 +3,9 @@ import json
|
||||
import ifcopenshell
|
||||
import ifcopenshell.util.unit
|
||||
import ifcopenshell.util.attribute
|
||||
import blenderbim.bim.module.georeference.add_georeferencing as add_georeferencing
|
||||
import blenderbim.bim.module.georeference.edit_georeferencing as edit_georeferencing
|
||||
import blenderbim.bim.module.georeference.remove_georeferencing as remove_georeferencing
|
||||
import ifcopenshell.api
|
||||
from blenderbim.bim.ifc import IfcStore
|
||||
from blenderbim.bim.module.georeference.data import Data
|
||||
from ifcopenshell.api.georeference.data import Data
|
||||
from math import radians, degrees, atan, tan, cos, sin
|
||||
|
||||
|
||||
@@ -131,10 +129,12 @@ class EditGeoreferencing(bpy.types.Operator):
|
||||
if not props.is_map_unit_null:
|
||||
map_unit = props.map_unit_si if props.map_unit_type == "IfcSIUnit" else props.map_unit_imperial
|
||||
|
||||
edit_georeferencing.Usecase(
|
||||
self.file, {"map_conversion": map_conversion, "projected_crs": projected_crs, "map_unit": map_unit}
|
||||
).execute()
|
||||
Data.load()
|
||||
ifcopenshell.api.run(
|
||||
"georeference.edit_georeferencing",
|
||||
self.file,
|
||||
**{"map_conversion": map_conversion, "projected_crs": projected_crs, "map_unit": map_unit}
|
||||
)
|
||||
Data.load(IfcStore.get_file())
|
||||
bpy.ops.bim.disable_editing_georeferencing()
|
||||
return {"FINISHED"}
|
||||
|
||||
@@ -169,8 +169,8 @@ class RemoveGeoreferencing(bpy.types.Operator):
|
||||
bl_label = "Remove Georeferencing"
|
||||
|
||||
def execute(self, context):
|
||||
remove_georeferencing.Usecase(IfcStore.get_file()).execute()
|
||||
Data.load()
|
||||
ifcopenshell.api.run("georeference.remove_georeferencing", IfcStore.get_file())
|
||||
Data.load(IfcStore.get_file())
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
@@ -179,8 +179,8 @@ class AddGeoreferencing(bpy.types.Operator):
|
||||
bl_label = "Add Georeferencing"
|
||||
|
||||
def execute(self, context):
|
||||
add_georeferencing.Usecase(IfcStore.get_file()).execute()
|
||||
Data.load()
|
||||
ifcopenshell.api.run("georeference.add_georeferencing", IfcStore.get_file())
|
||||
Data.load(IfcStore.get_file())
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
@@ -190,7 +190,7 @@ class ConvertLocalToGlobal(bpy.types.Operator):
|
||||
|
||||
def execute(self, context):
|
||||
if not Data.is_loaded:
|
||||
Data.load()
|
||||
Data.load(IfcStore.get_file())
|
||||
props = context.scene.BIMGeoreferenceProperties
|
||||
x, y, z = [float(co) for co in props.coordinate_input.split(",")]
|
||||
|
||||
@@ -240,7 +240,7 @@ class ConvertGlobalToLocal(bpy.types.Operator):
|
||||
|
||||
def execute(self, context):
|
||||
if not Data.is_loaded:
|
||||
Data.load()
|
||||
Data.load(IfcStore.get_file())
|
||||
props = context.scene.BIMGeoreferenceProperties
|
||||
x, y, z = [float(co) for co in props.coordinate_input.split(",")]
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
from bpy.types import Panel
|
||||
from blenderbim.bim.module.georeference.data import Data
|
||||
from ifcopenshell.api.georeference.data import Data
|
||||
from blenderbim.bim.ifc import IfcStore
|
||||
|
||||
class BIM_PT_gis(Panel):
|
||||
@@ -17,7 +17,7 @@ class BIM_PT_gis(Panel):
|
||||
def draw(self, context):
|
||||
props = context.scene.BIMGeoreferenceProperties
|
||||
if not Data.is_loaded:
|
||||
Data.load()
|
||||
Data.load(IfcStore.get_file())
|
||||
|
||||
if props.is_editing:
|
||||
return self.draw_editable_ui(context)
|
||||
+28
-24
@@ -1,12 +1,8 @@
|
||||
import bpy
|
||||
import ifcopenshell.util.attribute
|
||||
import blenderbim.bim.module.group.add_group as add_group
|
||||
import blenderbim.bim.module.group.edit_group as edit_group
|
||||
import blenderbim.bim.module.group.remove_group as remove_group
|
||||
import blenderbim.bim.module.group.assign_group as assign_group
|
||||
import blenderbim.bim.module.group.unassign_group as unassign_group
|
||||
import ifcopenshell.api
|
||||
from blenderbim.bim.ifc import IfcStore
|
||||
from blenderbim.bim.module.group.data import Data
|
||||
from ifcopenshell.api.group.data import Data
|
||||
|
||||
|
||||
class LoadGroups(bpy.types.Operator):
|
||||
@@ -40,8 +36,8 @@ class AddGroup(bpy.types.Operator):
|
||||
bl_label = "Add Group"
|
||||
|
||||
def execute(self, context):
|
||||
result = add_group.Usecase(IfcStore.get_file()).execute()
|
||||
Data.load()
|
||||
result = ifcopenshell.api.run("group.add_group", IfcStore.get_file())
|
||||
Data.load(IfcStore.get_file())
|
||||
bpy.ops.bim.load_groups()
|
||||
bpy.ops.bim.enable_editing_group(group=result.id())
|
||||
return {"FINISHED"}
|
||||
@@ -60,10 +56,10 @@ class EditGroup(bpy.types.Operator):
|
||||
else:
|
||||
attributes[attribute.name] = attribute.string_value
|
||||
self.file = IfcStore.get_file()
|
||||
edit_group.Usecase(
|
||||
self.file, {"group": self.file.by_id(props.active_group_id), "attributes": attributes}
|
||||
).execute()
|
||||
Data.load()
|
||||
ifcopenshell.api.run(
|
||||
"group.edit_group", self.file, **{"group": self.file.by_id(props.active_group_id), "attributes": attributes}
|
||||
)
|
||||
Data.load(IfcStore.get_file())
|
||||
bpy.ops.bim.load_groups()
|
||||
return {"FINISHED"}
|
||||
|
||||
@@ -76,8 +72,8 @@ class RemoveGroup(bpy.types.Operator):
|
||||
def execute(self, context):
|
||||
props = context.scene.BIMGroupProperties
|
||||
self.file = IfcStore.get_file()
|
||||
remove_group.Usecase(self.file, {"group": self.file.by_id(self.group)}).execute()
|
||||
Data.load()
|
||||
ifcopenshell.api.run("group.remove_group", self.file, **{"group": self.file.by_id(self.group)})
|
||||
Data.load(IfcStore.get_file())
|
||||
bpy.ops.bim.load_groups()
|
||||
return {"FINISHED"}
|
||||
|
||||
@@ -125,11 +121,15 @@ class AssignGroup(bpy.types.Operator):
|
||||
def execute(self, context):
|
||||
product = bpy.data.objects.get(self.product) if self.product else context.active_object
|
||||
self.file = IfcStore.get_file()
|
||||
assign_group.Usecase(self.file, {
|
||||
"product": self.file.by_id(product.BIMObjectProperties.ifc_definition_id),
|
||||
"group": self.file.by_id(self.group)
|
||||
}).execute()
|
||||
Data.load()
|
||||
ifcopenshell.api.run(
|
||||
"group.assign_group",
|
||||
self.file,
|
||||
**{
|
||||
"product": self.file.by_id(product.BIMObjectProperties.ifc_definition_id),
|
||||
"group": self.file.by_id(self.group),
|
||||
}
|
||||
)
|
||||
Data.load(IfcStore.get_file())
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
@@ -142,9 +142,13 @@ class UnassignGroup(bpy.types.Operator):
|
||||
def execute(self, context):
|
||||
product = bpy.data.objects.get(self.product) if self.product else context.active_object
|
||||
self.file = IfcStore.get_file()
|
||||
unassign_group.Usecase(self.file, {
|
||||
"product": self.file.by_id(product.BIMObjectProperties.ifc_definition_id),
|
||||
"group": self.file.by_id(self.group)
|
||||
}).execute()
|
||||
Data.load()
|
||||
ifcopenshell.api.run(
|
||||
"group.unassign_group",
|
||||
self.file,
|
||||
**{
|
||||
"product": self.file.by_id(product.BIMObjectProperties.ifc_definition_id),
|
||||
"group": self.file.by_id(self.group),
|
||||
}
|
||||
)
|
||||
Data.load(IfcStore.get_file())
|
||||
return {"FINISHED"}
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
from bpy.types import Panel, UIList
|
||||
from blenderbim.bim.ifc import IfcStore
|
||||
from blenderbim.bim.module.group.data import Data
|
||||
from ifcopenshell.api.group.data import Data
|
||||
|
||||
|
||||
class BIM_PT_groups(Panel):
|
||||
@@ -17,7 +17,7 @@ class BIM_PT_groups(Panel):
|
||||
|
||||
def draw(self, context):
|
||||
if not Data.is_loaded:
|
||||
Data.load()
|
||||
Data.load(IfcStore.get_file())
|
||||
self.props = context.scene.BIMGroupProperties
|
||||
|
||||
row = self.layout.row(align=True)
|
||||
+22
-24
@@ -1,13 +1,9 @@
|
||||
import bpy
|
||||
import json
|
||||
import ifcopenshell.util.attribute
|
||||
import blenderbim.bim.module.layer.add_layer as add_layer
|
||||
import blenderbim.bim.module.layer.edit_layer as edit_layer
|
||||
import blenderbim.bim.module.layer.remove_layer as remove_layer
|
||||
import blenderbim.bim.module.layer.assign_layer as assign_layer
|
||||
import blenderbim.bim.module.layer.unassign_layer as unassign_layer
|
||||
import ifcopenshell.api
|
||||
from blenderbim.bim.ifc import IfcStore
|
||||
from blenderbim.bim.module.layer.data import Data
|
||||
from ifcopenshell.api.layer.data import Data
|
||||
|
||||
|
||||
class LoadLayers(bpy.types.Operator):
|
||||
@@ -76,8 +72,8 @@ class AddPresentationLayer(bpy.types.Operator):
|
||||
bl_label = "Add Layer"
|
||||
|
||||
def execute(self, context):
|
||||
result = add_layer.Usecase(IfcStore.get_file()).execute()
|
||||
Data.load()
|
||||
result = ifcopenshell.api.run("layer.add_layer", IfcStore.get_file())
|
||||
Data.load(IfcStore.get_file())
|
||||
bpy.ops.bim.load_layers()
|
||||
bpy.ops.bim.enable_editing_layer(layer=result.id())
|
||||
return {"FINISHED"}
|
||||
@@ -96,10 +92,10 @@ class EditPresentationLayer(bpy.types.Operator):
|
||||
else:
|
||||
attributes[attribute.name] = attribute.string_value
|
||||
self.file = IfcStore.get_file()
|
||||
edit_layer.Usecase(
|
||||
self.file, {"layer": self.file.by_id(props.active_layer_id), "attributes": attributes}
|
||||
).execute()
|
||||
Data.load()
|
||||
ifcopenshell.api.run(
|
||||
"layer.edit_layer", self.file, **{"layer": self.file.by_id(props.active_layer_id), "attributes": attributes}
|
||||
)
|
||||
Data.load(IfcStore.get_file())
|
||||
bpy.ops.bim.load_layers()
|
||||
return {"FINISHED"}
|
||||
|
||||
@@ -112,8 +108,8 @@ class RemovePresentationLayer(bpy.types.Operator):
|
||||
def execute(self, context):
|
||||
props = context.scene.BIMLayerProperties
|
||||
self.file = IfcStore.get_file()
|
||||
remove_layer.Usecase(self.file, {"layer": self.file.by_id(self.layer)}).execute()
|
||||
Data.load()
|
||||
ifcopenshell.api.run("layer.remove_layer", self.file, **{"layer": self.file.by_id(self.layer)})
|
||||
Data.load(IfcStore.get_file())
|
||||
bpy.ops.bim.load_layers()
|
||||
return {"FINISHED"}
|
||||
|
||||
@@ -127,11 +123,12 @@ class AssignPresentationLayer(bpy.types.Operator):
|
||||
def execute(self, context):
|
||||
item = bpy.data.meshes.get(self.item) if self.item else context.active_object.data
|
||||
self.file = IfcStore.get_file()
|
||||
assign_layer.Usecase(self.file, {
|
||||
"item": self.file.by_id(item.BIMMeshProperties.ifc_definition_id),
|
||||
"layer": self.file.by_id(self.layer)
|
||||
}).execute()
|
||||
Data.load()
|
||||
ifcopenshell.api.run(
|
||||
"layer.assign_layer",
|
||||
self.file,
|
||||
**{"item": self.file.by_id(item.BIMMeshProperties.ifc_definition_id), "layer": self.file.by_id(self.layer)}
|
||||
)
|
||||
Data.load(IfcStore.get_file())
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
@@ -144,9 +141,10 @@ class UnassignPresentationLayer(bpy.types.Operator):
|
||||
def execute(self, context):
|
||||
item = bpy.data.meshes.get(self.item) if self.item else context.active_object.data
|
||||
self.file = IfcStore.get_file()
|
||||
unassign_layer.Usecase(self.file, {
|
||||
"item": self.file.by_id(item.BIMMeshProperties.ifc_definition_id),
|
||||
"layer": self.file.by_id(self.layer)
|
||||
}).execute()
|
||||
Data.load()
|
||||
ifcopenshell.api.run(
|
||||
"layer.unassign_layer",
|
||||
self.file,
|
||||
**{"item": self.file.by_id(item.BIMMeshProperties.ifc_definition_id), "layer": self.file.by_id(self.layer)}
|
||||
)
|
||||
Data.load(IfcStore.get_file())
|
||||
return {"FINISHED"}
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
from bpy.types import Panel, UIList, Mesh
|
||||
from blenderbim.bim.ifc import IfcStore
|
||||
from blenderbim.bim.module.layer.data import Data
|
||||
from ifcopenshell.api.layer.data import Data
|
||||
|
||||
|
||||
class BIM_PT_layers(Panel):
|
||||
@@ -17,7 +17,7 @@ class BIM_PT_layers(Panel):
|
||||
|
||||
def draw(self, context):
|
||||
if not Data.is_loaded:
|
||||
Data.load()
|
||||
Data.load(IfcStore.get_file())
|
||||
|
||||
self.props = context.scene.BIMLayerProperties
|
||||
|
||||
+64
-60
@@ -1,20 +1,8 @@
|
||||
import bpy
|
||||
import ifcopenshell.api
|
||||
import ifcopenshell.util.attribute
|
||||
import blenderbim.bim.module.material.add_material as add_material
|
||||
import blenderbim.bim.module.material.remove_material as remove_material
|
||||
import blenderbim.bim.module.material.assign_material as assign_material
|
||||
import blenderbim.bim.module.material.unassign_material as unassign_material
|
||||
import blenderbim.bim.module.material.add_constituent as add_constituent
|
||||
import blenderbim.bim.module.material.remove_constituent as remove_constituent
|
||||
import blenderbim.bim.module.material.add_layer as add_layer
|
||||
import blenderbim.bim.module.material.edit_layer as edit_layer
|
||||
import blenderbim.bim.module.material.remove_layer as remove_layer
|
||||
import blenderbim.bim.module.material.reorder_set_item as reorder_set_item
|
||||
import blenderbim.bim.module.material.add_list_item as add_list_item
|
||||
import blenderbim.bim.module.material.remove_list_item as remove_list_item
|
||||
import blenderbim.bim.module.material.edit_assigned_material as edit_assigned_material
|
||||
from blenderbim.bim.ifc import IfcStore
|
||||
from blenderbim.bim.module.material.data import Data
|
||||
from ifcopenshell.api.material.data import Data
|
||||
|
||||
|
||||
class AddMaterial(bpy.types.Operator):
|
||||
@@ -25,9 +13,9 @@ class AddMaterial(bpy.types.Operator):
|
||||
def execute(self, context):
|
||||
obj = bpy.data.materials.get(self.obj) if self.obj else bpy.context.active_object.active_material
|
||||
self.file = IfcStore.get_file()
|
||||
result = add_material.Usecase(self.file, {"Name": obj.name}).execute()
|
||||
result = ifcopenshell.api.run("material.add_material", self.file, **{"Name": obj.name})
|
||||
obj.BIMObjectProperties.ifc_definition_id = result.id()
|
||||
Data.load()
|
||||
Data.load(IfcStore.get_file())
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
@@ -39,11 +27,13 @@ class RemoveMaterial(bpy.types.Operator):
|
||||
def execute(self, context):
|
||||
obj = bpy.data.materials.get(self.obj) if self.obj else bpy.context.active_object.active_material
|
||||
self.file = IfcStore.get_file()
|
||||
result = remove_material.Usecase(
|
||||
self.file, {"material": self.file.by_id(obj.BIMObjectProperties.ifc_definition_id)}
|
||||
).execute()
|
||||
result = ifcopenshell.api.run(
|
||||
"material.remove_material",
|
||||
self.file,
|
||||
**{"material": self.file.by_id(obj.BIMObjectProperties.ifc_definition_id)},
|
||||
)
|
||||
obj.BIMObjectProperties.ifc_definition_id = 0
|
||||
Data.load()
|
||||
Data.load(IfcStore.get_file())
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
@@ -57,16 +47,17 @@ class AssignMaterial(bpy.types.Operator):
|
||||
obj = bpy.data.objects.get(self.obj) if self.obj else bpy.context.active_object
|
||||
material_type = self.material_type or obj.BIMObjectMaterialProperties.material_type
|
||||
self.file = IfcStore.get_file()
|
||||
assign_material.Usecase(
|
||||
ifcopenshell.api.run(
|
||||
"material.assign_material",
|
||||
self.file,
|
||||
{
|
||||
**{
|
||||
"product": self.file.by_id(obj.BIMObjectProperties.ifc_definition_id),
|
||||
"type": material_type,
|
||||
"material": self.file.by_id(int(obj.BIMObjectMaterialProperties.material)),
|
||||
},
|
||||
).execute()
|
||||
Data.load()
|
||||
Data.load(obj.BIMObjectProperties.ifc_definition_id)
|
||||
)
|
||||
Data.load(IfcStore.get_file())
|
||||
Data.load(IfcStore.get_file(), obj.BIMObjectProperties.ifc_definition_id)
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
@@ -78,10 +69,12 @@ class UnassignMaterial(bpy.types.Operator):
|
||||
def execute(self, context):
|
||||
obj = bpy.data.objects.get(self.obj) if self.obj else bpy.context.active_object
|
||||
self.file = IfcStore.get_file()
|
||||
unassign_material.Usecase(
|
||||
self.file, {"product": self.file.by_id(obj.BIMObjectProperties.ifc_definition_id)}
|
||||
).execute()
|
||||
Data.load(obj.BIMObjectProperties.ifc_definition_id)
|
||||
ifcopenshell.api.run(
|
||||
"material.unassign_material",
|
||||
self.file,
|
||||
**{"product": self.file.by_id(obj.BIMObjectProperties.ifc_definition_id)},
|
||||
)
|
||||
Data.load(IfcStore.get_file(), obj.BIMObjectProperties.ifc_definition_id)
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
@@ -94,13 +87,14 @@ class AddConstituent(bpy.types.Operator):
|
||||
def execute(self, context):
|
||||
obj = bpy.data.objects.get(self.obj) if self.obj else bpy.context.active_object
|
||||
self.file = IfcStore.get_file()
|
||||
add_constituent.Usecase(
|
||||
ifcopenshell.api.run(
|
||||
"material.add_constituent",
|
||||
self.file,
|
||||
{
|
||||
**{
|
||||
"constituent_set": self.file.by_id(self.constituent_set),
|
||||
"material": self.file.by_id(int(obj.BIMObjectMaterialProperties.material)),
|
||||
},
|
||||
).execute()
|
||||
)
|
||||
Data.load_constituents()
|
||||
return {"FINISHED"}
|
||||
|
||||
@@ -114,7 +108,9 @@ class RemoveConstituent(bpy.types.Operator):
|
||||
def execute(self, context):
|
||||
obj = bpy.data.objects.get(self.obj) if self.obj else bpy.context.active_object
|
||||
self.file = IfcStore.get_file()
|
||||
remove_constituent.Usecase(self.file, {"constituent": self.file.by_id(self.constituent)}).execute()
|
||||
ifcopenshell.api.run(
|
||||
"material.remove_constituent", self.file, **{"constituent": self.file.by_id(self.constituent)}
|
||||
)
|
||||
Data.load_constituents()
|
||||
return {"FINISHED"}
|
||||
|
||||
@@ -128,13 +124,14 @@ class AddLayer(bpy.types.Operator):
|
||||
def execute(self, context):
|
||||
obj = bpy.data.objects.get(self.obj) if self.obj else bpy.context.active_object
|
||||
self.file = IfcStore.get_file()
|
||||
add_layer.Usecase(
|
||||
ifcopenshell.api.run(
|
||||
"material.add_layer",
|
||||
self.file,
|
||||
{
|
||||
**{
|
||||
"layer_set": self.file.by_id(self.layer_set),
|
||||
"material": self.file.by_id(int(obj.BIMObjectMaterialProperties.material)),
|
||||
},
|
||||
).execute()
|
||||
)
|
||||
Data.load_layers()
|
||||
return {"FINISHED"}
|
||||
|
||||
@@ -151,14 +148,15 @@ class ReorderMaterialSetItem(bpy.types.Operator):
|
||||
obj = bpy.data.objects.get(self.obj) if self.obj else bpy.context.active_object
|
||||
self.file = IfcStore.get_file()
|
||||
material_set = self.file.by_id(self.material_set)
|
||||
reorder_set_item.Usecase(
|
||||
ifcopenshell.api.run(
|
||||
"material.reorder_set_item",
|
||||
self.file,
|
||||
{
|
||||
**{
|
||||
"material_set": material_set,
|
||||
"old_index": self.old_index,
|
||||
"new_index": self.new_index,
|
||||
},
|
||||
).execute()
|
||||
)
|
||||
if material_set.is_a("IfcMaterialConstituentSet"):
|
||||
Data.load_constituents()
|
||||
elif material_set.is_a("IfcMaterialLayerSet"):
|
||||
@@ -179,7 +177,7 @@ class RemoveLayer(bpy.types.Operator):
|
||||
def execute(self, context):
|
||||
obj = bpy.data.objects.get(self.obj) if self.obj else bpy.context.active_object
|
||||
self.file = IfcStore.get_file()
|
||||
remove_layer.Usecase(self.file, {"layer": self.file.by_id(self.layer)}).execute()
|
||||
ifcopenshell.api.run("material.remove_layer", self.file, **{"layer": self.file.by_id(self.layer)})
|
||||
Data.load_layers()
|
||||
return {"FINISHED"}
|
||||
|
||||
@@ -193,13 +191,14 @@ class AddListItem(bpy.types.Operator):
|
||||
def execute(self, context):
|
||||
obj = bpy.data.objects.get(self.obj) if self.obj else bpy.context.active_object
|
||||
self.file = IfcStore.get_file()
|
||||
add_list_item.Usecase(
|
||||
ifcopenshell.api.run(
|
||||
"material.add_list_item",
|
||||
self.file,
|
||||
{
|
||||
**{
|
||||
"material_list": self.file.by_id(self.list_item_set),
|
||||
"material": self.file.by_id(int(obj.BIMObjectMaterialProperties.material)),
|
||||
},
|
||||
).execute()
|
||||
)
|
||||
Data.load_lists()
|
||||
return {"FINISHED"}
|
||||
|
||||
@@ -214,13 +213,14 @@ class RemoveListItem(bpy.types.Operator):
|
||||
def execute(self, context):
|
||||
obj = bpy.data.objects.get(self.obj) if self.obj else bpy.context.active_object
|
||||
self.file = IfcStore.get_file()
|
||||
remove_list_item.Usecase(
|
||||
ifcopenshell.api.run(
|
||||
"material.remove_list_item",
|
||||
self.file,
|
||||
{
|
||||
**{
|
||||
"material_list": self.file.by_id(self.list_item_set),
|
||||
"material": self.file.by_id(self.list_item),
|
||||
},
|
||||
).execute()
|
||||
)
|
||||
Data.load_lists()
|
||||
return {"FINISHED"}
|
||||
|
||||
@@ -298,21 +298,22 @@ class EditAssignedMaterial(bpy.types.Operator):
|
||||
if product_data["type"] == "IfcMaterial":
|
||||
bpy.ops.bim.unassign_material(obj=obj.name)
|
||||
bpy.ops.bim.assign_material(obj=obj.name, material_type="IfcMaterial")
|
||||
Data.load(obj.BIMObjectProperties.ifc_definition_id)
|
||||
Data.load(IfcStore.get_file(), obj.BIMObjectProperties.ifc_definition_id)
|
||||
bpy.ops.bim.disable_editing_assigned_material(obj=obj.name)
|
||||
return {"FINISHED"}
|
||||
|
||||
attributes = {}
|
||||
for attribute in props.material_set_attributes:
|
||||
attributes[attribute.name] = None if attribute.is_null else attribute.string_value
|
||||
edit_assigned_material.Usecase(
|
||||
ifcopenshell.api.run(
|
||||
"material.edit_assigned_material",
|
||||
self.file,
|
||||
{
|
||||
**{
|
||||
"element": material_set,
|
||||
"attributes": attributes,
|
||||
},
|
||||
).execute()
|
||||
Data.load(obj.BIMObjectProperties.ifc_definition_id)
|
||||
)
|
||||
Data.load(IfcStore.get_file(), obj.BIMObjectProperties.ifc_definition_id)
|
||||
if material_set.is_a("IfcMaterialConstituentSet"):
|
||||
Data.load_constituents()
|
||||
elif material_set.is_a("IfcMaterialLayerSet"):
|
||||
@@ -408,34 +409,37 @@ class EditMaterialSetItem(bpy.types.Operator):
|
||||
attributes[attribute.name] = None if attribute.is_null else value
|
||||
|
||||
if product_data["type"] == "IfcMaterialConstituentSet":
|
||||
edit_constituent.Usecase(
|
||||
ifcopenshell.api.run(
|
||||
"material.edit_constituent",
|
||||
self.file,
|
||||
{
|
||||
**{
|
||||
"constituent": self.file.by_id(self.material_set_item),
|
||||
"attributes": attributes,
|
||||
"material": self.file.by_id(int(obj.BIMObjectMaterialProperties.material_set_item_material)),
|
||||
},
|
||||
).execute()
|
||||
)
|
||||
Data.load_constituents()
|
||||
elif product_data["type"] == "IfcMaterialLayerSet" or product_data["type"] == "IfcMaterialLayerSetUsage":
|
||||
edit_layer.Usecase(
|
||||
ifcopenshell.api.run(
|
||||
"material.edit_layer",
|
||||
self.file,
|
||||
{
|
||||
**{
|
||||
"layer": self.file.by_id(self.material_set_item),
|
||||
"attributes": attributes,
|
||||
"material": self.file.by_id(int(obj.BIMObjectMaterialProperties.material_set_item_material)),
|
||||
},
|
||||
).execute()
|
||||
)
|
||||
Data.load_layers()
|
||||
elif product_data["type"] == "IfcMaterialProfileSet":
|
||||
edit_profile.Usecase(
|
||||
ifcopenshell.api.run(
|
||||
"material.edit_profile",
|
||||
self.file,
|
||||
{
|
||||
**{
|
||||
"profile": self.file.by_id(self.material_set_item),
|
||||
"attributes": attributes,
|
||||
"material": self.file.by_id(int(obj.BIMObjectMaterialProperties.material_set_item_material)),
|
||||
},
|
||||
).execute()
|
||||
)
|
||||
Data.load_profiles()
|
||||
else:
|
||||
pass
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user