mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-23 14:26:30 +00:00
small refactor for Ifc.edit and tool.Ifc
1) replaced IfcStore.edited_objs.add with tool.Ifc.edit 2) updated interface in tool.py 3) removed unlink from tool.Ifc - it was declared there twice
This commit is contained in:
@@ -47,9 +47,9 @@ def mode_callback(obj, data):
|
|||||||
):
|
):
|
||||||
continue
|
continue
|
||||||
if obj.data.BIMMeshProperties.ifc_definition_id:
|
if obj.data.BIMMeshProperties.ifc_definition_id:
|
||||||
IfcStore.edited_objs.add(obj)
|
tool.Ifc.edit(obj)
|
||||||
elif IfcStore.get_file().by_id(obj.BIMObjectProperties.ifc_definition_id).is_a("IfcGridAxis"):
|
elif IfcStore.get_file().by_id(obj.BIMObjectProperties.ifc_definition_id).is_a("IfcGridAxis"):
|
||||||
IfcStore.edited_objs.add(obj)
|
tool.Ifc.edit(obj)
|
||||||
|
|
||||||
|
|
||||||
def name_callback(obj, data):
|
def name_callback(obj, data):
|
||||||
@@ -94,7 +94,7 @@ def name_callback(obj, data):
|
|||||||
|
|
||||||
def color_callback(obj, data):
|
def color_callback(obj, data):
|
||||||
if obj.BIMMaterialProperties.ifc_style_id:
|
if obj.BIMMaterialProperties.ifc_style_id:
|
||||||
IfcStore.edited_objs.add(obj)
|
tool.Ifc.edit(obj)
|
||||||
|
|
||||||
|
|
||||||
def active_object_callback():
|
def active_object_callback():
|
||||||
|
|||||||
@@ -17,19 +17,11 @@
|
|||||||
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
|
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import bpy
|
import bpy
|
||||||
from bpy.types import Operator
|
|
||||||
from bpy.props import FloatProperty, IntProperty, BoolProperty
|
|
||||||
from bpy_extras.object_utils import AddObjectHelper, object_data_add
|
|
||||||
import bmesh
|
import bmesh
|
||||||
|
|
||||||
import ifcopenshell
|
import ifcopenshell
|
||||||
import blenderbim
|
|
||||||
import blenderbim.tool as tool
|
import blenderbim.tool as tool
|
||||||
from blenderbim.bim.module.model.prop import BIMStairProperties
|
|
||||||
from blenderbim.bim.ifc import IfcStore
|
|
||||||
|
|
||||||
from mathutils import Vector
|
|
||||||
from pprint import pprint
|
|
||||||
import json
|
import json
|
||||||
import zipfile
|
import zipfile
|
||||||
import os.path
|
import os.path
|
||||||
@@ -65,7 +57,7 @@ def update_sverchok_modifier(context):
|
|||||||
bm.to_mesh(obj.data)
|
bm.to_mesh(obj.data)
|
||||||
bm.free()
|
bm.free()
|
||||||
obj.data.update()
|
obj.data.update()
|
||||||
IfcStore.edited_objs.add(obj)
|
tool.Ifc.edit(obj)
|
||||||
|
|
||||||
|
|
||||||
# UI operators
|
# UI operators
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ def mode_callback(obj, data):
|
|||||||
if not parametric or parametric["Engine"] != "BlenderBIM.DumbLayer2":
|
if not parametric or parametric["Engine"] != "BlenderBIM.DumbLayer2":
|
||||||
return
|
return
|
||||||
if obj.mode == "EDIT":
|
if obj.mode == "EDIT":
|
||||||
IfcStore.edited_objs.add(obj)
|
tool.Ifc.edit(obj)
|
||||||
bm = bmesh.from_edit_mesh(obj.data)
|
bm = bmesh.from_edit_mesh(obj.data)
|
||||||
bmesh.ops.dissolve_limit(bm, angle_limit=pi / 180 * 1, verts=bm.verts, edges=bm.edges)
|
bmesh.ops.dissolve_limit(bm, angle_limit=pi / 180 * 1, verts=bm.verts, edges=bm.edges)
|
||||||
bmesh.update_edit_mesh(obj.data)
|
bmesh.update_edit_mesh(obj.data)
|
||||||
@@ -155,7 +155,7 @@ class AlignWall(bpy.types.Operator):
|
|||||||
aligner.align_first_layer()
|
aligner.align_first_layer()
|
||||||
elif self.align_type == "INTERIOR":
|
elif self.align_type == "INTERIOR":
|
||||||
aligner.align_last_layer()
|
aligner.align_last_layer()
|
||||||
IfcStore.edited_objs.add(obj)
|
tool.Ifc.edit(obj)
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -349,11 +349,16 @@ class Ifc:
|
|||||||
def get(cls): pass
|
def get(cls): pass
|
||||||
def get_entity(cls, obj): pass
|
def get_entity(cls, obj): pass
|
||||||
def get_object(cls, entity): pass
|
def get_object(cls, entity): pass
|
||||||
|
def get_path(cls): pass
|
||||||
def get_schema(cls): pass
|
def get_schema(cls): pass
|
||||||
def is_deleted(cls, element): pass
|
def is_deleted(cls, element): pass
|
||||||
def is_edited(cls, obj): pass
|
def is_edited(cls, obj): pass
|
||||||
def is_moved(cls, obj): pass
|
def is_moved(cls, obj): pass
|
||||||
def link(cls, element, obj): pass
|
def link(cls, element, obj): pass
|
||||||
|
def schema(cls): pass
|
||||||
|
def edit(cls, obj): pass
|
||||||
|
def delete(cls, element): pass
|
||||||
|
def resolve_uri(cls, uri): pass
|
||||||
def run(cls, command, **kwargs): pass
|
def run(cls, command, **kwargs): pass
|
||||||
def set(cls, ifc): pass
|
def set(cls, ifc): pass
|
||||||
def unlink(cls, element=None, obj=None): pass
|
def unlink(cls, element=None, obj=None): pass
|
||||||
|
|||||||
@@ -117,10 +117,6 @@ class Ifc(blenderbim.core.tool.Ifc):
|
|||||||
occurences = [element]
|
occurences = [element]
|
||||||
return occurences
|
return occurences
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def unlink(cls, element=None, obj=None):
|
|
||||||
IfcStore.unlink_element(element, obj)
|
|
||||||
|
|
||||||
class Operator:
|
class Operator:
|
||||||
def execute(self, context):
|
def execute(self, context):
|
||||||
IfcStore.execute_ifc_operator(self, context)
|
IfcStore.execute_ifc_operator(self, context)
|
||||||
|
|||||||
@@ -19,7 +19,6 @@
|
|||||||
|
|
||||||
import ifcopenshell
|
import ifcopenshell
|
||||||
import blenderbim.tool as tool
|
import blenderbim.tool as tool
|
||||||
from blenderbim.bim.ifc import IfcStore
|
|
||||||
|
|
||||||
import bpy
|
import bpy
|
||||||
import bmesh
|
import bmesh
|
||||||
@@ -113,7 +112,7 @@ def update_geonodes_modifier():
|
|||||||
bm.to_mesh(obj.data)
|
bm.to_mesh(obj.data)
|
||||||
bm.free()
|
bm.free()
|
||||||
obj.data.update()
|
obj.data.update()
|
||||||
IfcStore.edited_objs.add(obj)
|
tool.Ifc.edit(obj)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ import blenderbim.tool as tool
|
|||||||
from mathutils import Vector
|
from mathutils import Vector
|
||||||
from test.bim.bootstrap import NewFile
|
from test.bim.bootstrap import NewFile
|
||||||
from blenderbim.tool.geometry import Geometry as subject
|
from blenderbim.tool.geometry import Geometry as subject
|
||||||
from blenderbim.bim.ifc import IfcStore
|
|
||||||
|
|
||||||
|
|
||||||
class TestImplementsTool(NewFile):
|
class TestImplementsTool(NewFile):
|
||||||
@@ -308,7 +307,7 @@ class TestIsEdited(NewFile):
|
|||||||
assert subject.is_edited(obj) is True
|
assert subject.is_edited(obj) is True
|
||||||
obj.scale[0] = 1
|
obj.scale[0] = 1
|
||||||
assert subject.is_edited(obj) is False
|
assert subject.is_edited(obj) is False
|
||||||
IfcStore.edited_objs.add(obj)
|
tool.Ifc.edit(obj)
|
||||||
assert subject.is_edited(obj) is True
|
assert subject.is_edited(obj) is True
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user