This commit is contained in:
Andrej730
2024-05-28 11:09:05 +05:00
parent 6035683492
commit a09cb5dee4
4 changed files with 21 additions and 5 deletions
@@ -19,6 +19,7 @@
import bpy import bpy
import ifcopenshell import ifcopenshell
import ifcopenshell.util.doc import ifcopenshell.util.doc
import ifcopenshell.util.element
import blenderbim.tool as tool import blenderbim.tool as tool
import blenderbim.bim.schema import blenderbim.bim.schema
@@ -20,6 +20,7 @@ import bpy
import blenderbim.bim.schema import blenderbim.bim.schema
import ifcopenshell import ifcopenshell
import ifcopenshell.util.attribute import ifcopenshell.util.attribute
import ifcopenshell.util.doc
import ifcopenshell.util.element import ifcopenshell.util.element
import blenderbim.tool as tool import blenderbim.tool as tool
from blenderbim.bim.prop import Attribute, StrProperty from blenderbim.bim.prop import Attribute, StrProperty
+18 -5
View File
@@ -16,19 +16,28 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# 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/>.
from __future__ import annotations
from typing import TYPE_CHECKING, Optional
def calculate_circle_radius(qto, obj=None): if TYPE_CHECKING:
import bpy
import ifcopenshell
import blenderbim.tool as tool
from blenderbim.bim.module.pset.qto_calculator import QtoCalculator
def calculate_circle_radius(qto: tool.Qto, obj: bpy.types.Object) -> float:
result = qto.get_radius_of_selected_vertices(obj) result = qto.get_radius_of_selected_vertices(obj)
qto.set_qto_result(result) qto.set_qto_result(result)
return result return result
def assign_objects_base_qto(ifc, qto, selected_objects): def assign_objects_base_qto(ifc: tool.Ifc, qto: tool.Qto, selected_objects: list[bpy.types.Object]) -> None:
for obj in selected_objects: for obj in selected_objects:
assign_object_base_qto(ifc, qto, obj) assign_object_base_qto(ifc, qto, obj)
def assign_object_base_qto(ifc, qto, obj): def assign_object_base_qto(ifc: tool.Ifc, qto: tool.Qto, obj: bpy.types.Object) -> None:
product = ifc.get_entity(obj) product = ifc.get_entity(obj)
if not product: if not product:
return return
@@ -42,13 +51,17 @@ def assign_object_base_qto(ifc, qto, obj):
) )
def calculate_all_quantities(ifc, cost, qto, calculator, selected_objects): def calculate_all_quantities(
ifc: tool.Ifc, cost: tool.Cost, qto: tool.Qto, calculator: QtoCalculator, selected_objects: list[bpy.types.Object]
) -> None:
if selected_objects: if selected_objects:
for obj in selected_objects: for obj in selected_objects:
calculate_object_base_quantities(ifc, cost, qto, calculator, obj) calculate_object_base_quantities(ifc, cost, qto, calculator, obj)
def calculate_object_base_quantities(ifc, cost, qto, calculator, obj): def calculate_object_base_quantities(
ifc: tool.Ifc, cost: tool.Cost, qto: tool.Qto, calculator: QtoCalculator, obj: bpy.types.Object
) -> None:
product = ifc.get_entity(obj) product = ifc.get_entity(obj)
if not product: if not product:
return return
+1
View File
@@ -19,6 +19,7 @@
import bpy import bpy
import ifcopenshell import ifcopenshell
import ifcopenshell.api import ifcopenshell.api
import ifcopenshell.util.pset
import test.bim.bootstrap import test.bim.bootstrap
import blenderbim.core.tool import blenderbim.core.tool
import blenderbim.core.root import blenderbim.core.root