mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-25 17:57:02 +00:00
typing
This commit is contained in:
@@ -38,6 +38,8 @@ class BIM_PT_cost_schedules(Panel):
|
|||||||
bl_parent_id = "BIM_PT_tab_cost"
|
bl_parent_id = "BIM_PT_tab_cost"
|
||||||
bl_options = {"HIDE_HEADER"}
|
bl_options = {"HIDE_HEADER"}
|
||||||
|
|
||||||
|
layout: bpy.types.UILayout
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def poll(cls, context):
|
def poll(cls, context):
|
||||||
file = tool.Ifc.get()
|
file = tool.Ifc.get()
|
||||||
@@ -138,13 +140,13 @@ class BIM_PT_cost_schedules(Panel):
|
|||||||
self.draw_currency_ui()
|
self.draw_currency_ui()
|
||||||
self.draw_editable_cost_item_ui()
|
self.draw_editable_cost_item_ui()
|
||||||
|
|
||||||
def draw_column_ui(self):
|
def draw_column_ui(self) -> None:
|
||||||
row = self.layout.row(align=True)
|
row = self.layout.row(align=True)
|
||||||
row.prop(self.props, "cost_column", text="")
|
row.prop(self.props, "cost_column", text="")
|
||||||
row.operator("bim.add_cost_column", text="", icon="ADD").name = self.props.cost_column
|
row.operator("bim.add_cost_column", text="", icon="ADD").name = self.props.cost_column
|
||||||
self.layout.template_list("BIM_UL_cost_columns", "", self.props, "columns", self.props, "active_column_index")
|
self.layout.template_list("BIM_UL_cost_columns", "", self.props, "columns", self.props, "active_column_index")
|
||||||
|
|
||||||
def draw_currency_ui(self):
|
def draw_currency_ui(self) -> None:
|
||||||
row = self.layout.row(align=True)
|
row = self.layout.row(align=True)
|
||||||
if CostSchedulesData.data["currency"]:
|
if CostSchedulesData.data["currency"]:
|
||||||
text = "Currency used: {}".format(CostSchedulesData.data["currency"]["name"])
|
text = "Currency used: {}".format(CostSchedulesData.data["currency"]["name"])
|
||||||
@@ -161,7 +163,7 @@ class BIM_PT_cost_schedules(Panel):
|
|||||||
def draw_editable_cost_schedule_ui(self):
|
def draw_editable_cost_schedule_ui(self):
|
||||||
bonsai.bim.helper.draw_attributes(self.props.cost_schedule_attributes, self.layout)
|
bonsai.bim.helper.draw_attributes(self.props.cost_schedule_attributes, self.layout)
|
||||||
|
|
||||||
def draw_editable_cost_item_ui(self):
|
def draw_editable_cost_item_ui(self) -> None:
|
||||||
row = self.layout.row(align=True)
|
row = self.layout.row(align=True)
|
||||||
row.alignment = "RIGHT"
|
row.alignment = "RIGHT"
|
||||||
ifc_definition_id = None
|
ifc_definition_id = None
|
||||||
@@ -217,7 +219,7 @@ class BIM_PT_cost_schedules(Panel):
|
|||||||
elif self.props.cost_item_editing_type == "VALUES":
|
elif self.props.cost_item_editing_type == "VALUES":
|
||||||
self.draw_editable_cost_item_values_ui()
|
self.draw_editable_cost_item_values_ui()
|
||||||
|
|
||||||
def draw_editable_cost_item_attributes_ui(self):
|
def draw_editable_cost_item_attributes_ui(self) -> None:
|
||||||
bonsai.bim.helper.draw_attributes(self.props.cost_item_attributes, self.layout)
|
bonsai.bim.helper.draw_attributes(self.props.cost_item_attributes, self.layout)
|
||||||
|
|
||||||
def draw_editable_cost_item_quantities_ui(self, cost_item: dict[str, Any]):
|
def draw_editable_cost_item_quantities_ui(self, cost_item: dict[str, Any]):
|
||||||
|
|||||||
@@ -56,20 +56,18 @@ def add_cost_item(
|
|||||||
# Alternatively you may add them as subitems
|
# Alternatively you may add them as subitems
|
||||||
item2 = ifcopenshell.api.cost.add_cost_item(model, cost_item=item1)
|
item2 = ifcopenshell.api.cost.add_cost_item(model, cost_item=item1)
|
||||||
"""
|
"""
|
||||||
settings = {"cost_schedule": cost_schedule, "cost_item": cost_item}
|
cost_item_ = ifcopenshell.api.root.create_entity(file, ifc_class="IfcCostItem")
|
||||||
|
|
||||||
cost_item = ifcopenshell.api.root.create_entity(file, ifc_class="IfcCostItem")
|
if cost_schedule:
|
||||||
|
|
||||||
if settings["cost_schedule"]:
|
|
||||||
file.create_entity(
|
file.create_entity(
|
||||||
"IfcRelAssignsToControl",
|
"IfcRelAssignsToControl",
|
||||||
**{
|
**{
|
||||||
"GlobalId": ifcopenshell.guid.new(),
|
"GlobalId": ifcopenshell.guid.new(),
|
||||||
"OwnerHistory": ifcopenshell.api.owner.create_owner_history(file),
|
"OwnerHistory": ifcopenshell.api.owner.create_owner_history(file),
|
||||||
"RelatedObjects": [cost_item],
|
"RelatedObjects": [cost_item_],
|
||||||
"RelatingControl": settings["cost_schedule"],
|
"RelatingControl": cost_schedule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
elif settings["cost_item"]:
|
elif cost_item:
|
||||||
ifcopenshell.api.nest.assign_object(file, related_objects=[cost_item], relating_object=settings["cost_item"])
|
ifcopenshell.api.nest.assign_object(file, related_objects=[cost_item_], relating_object=cost_item)
|
||||||
return cost_item
|
return cost_item_
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import ifcopenshell
|
import ifcopenshell
|
||||||
from typing import Any, Union, Literal
|
from typing import Any, Union, Literal, Self
|
||||||
|
|
||||||
# `std::vector<xxx>` usually translated to `tuple[xxx, ...]`.
|
# `std::vector<xxx>` usually translated to `tuple[xxx, ...]`.
|
||||||
|
|
||||||
@@ -731,14 +731,17 @@ class collection:
|
|||||||
def matrix(self): ...
|
def matrix(self): ...
|
||||||
|
|
||||||
class colour(item):
|
class colour(item):
|
||||||
def b(self): ...
|
def r(self) -> float: ...
|
||||||
def calc_hash(self): ...
|
def g(self) -> float: ...
|
||||||
def clone_(self): ...
|
def b(self) -> float: ...
|
||||||
|
def calc_hash(self) -> int: ...
|
||||||
|
def clone_(self) -> Self: ...
|
||||||
@property
|
@property
|
||||||
def components(self): ...
|
def components(self) -> tuple[float, float, float]:
|
||||||
def g(self): ...
|
"""RGB tuple."""
|
||||||
def kind(self): ...
|
...
|
||||||
def r(self): ...
|
|
||||||
|
def kind(self) -> int: ...
|
||||||
|
|
||||||
class context:
|
class context:
|
||||||
def add(self, segments): ...
|
def add(self, segments): ...
|
||||||
@@ -1087,11 +1090,14 @@ class item:
|
|||||||
instance: Any
|
instance: Any
|
||||||
orientation: Any
|
orientation: Any
|
||||||
def calc_hash(self): ...
|
def calc_hash(self): ...
|
||||||
def clone_(self): ...
|
# TODO: hide from the wrapper?
|
||||||
|
def clone_(self) -> Self: ...
|
||||||
def hash(self): ...
|
def hash(self): ...
|
||||||
def identity(self): ...
|
def identity(self): ...
|
||||||
def kind(self): ...
|
|
||||||
def reverse(self): ...
|
def reverse(self): ...
|
||||||
|
# TODO: hide from the wrapper?
|
||||||
|
def kind(self):
|
||||||
|
"""Internal enum item index."""
|
||||||
|
|
||||||
class less_functor: ...
|
class less_functor: ...
|
||||||
|
|
||||||
@@ -1329,18 +1335,25 @@ class sphere(surface):
|
|||||||
def matrix(self): ...
|
def matrix(self): ...
|
||||||
|
|
||||||
class style(item):
|
class style(item):
|
||||||
diffuse: Any
|
diffuse: colour
|
||||||
name: Any
|
name: str
|
||||||
specular: Any
|
"""E.g. 'IfcSurfaceStyleShading-218', where 218 is style's STEP id."""
|
||||||
specularity: Any
|
specular: colour
|
||||||
surface: Any
|
specularity: float
|
||||||
transparency: Any
|
"""Can be `float('nan')`"""
|
||||||
use_surface_color: Any
|
surface: colour
|
||||||
def calc_hash(self): ...
|
transparency: float
|
||||||
def clone_(self): ...
|
"""Can be `float('nan')`"""
|
||||||
def get_color(self): ...
|
use_surface_color: bool
|
||||||
def has_specularity(self): ...
|
|
||||||
def has_transparency(self): ...
|
def calc_hash(self) -> int: ...
|
||||||
|
def clone_(self) -> Self: ...
|
||||||
|
def get_color(self) -> colour:
|
||||||
|
""" "Return surface color if it's used, otherwise return diffuse color."""
|
||||||
|
...
|
||||||
|
|
||||||
|
def has_specularity(self) -> bool: ...
|
||||||
|
def has_transparency(self) -> bool: ...
|
||||||
def instance_id(self) -> int:
|
def instance_id(self) -> int:
|
||||||
"""
|
"""
|
||||||
Possible values for `instance_id`:
|
Possible values for `instance_id`:
|
||||||
@@ -1354,7 +1367,7 @@ class style(item):
|
|||||||
"""
|
"""
|
||||||
...
|
...
|
||||||
|
|
||||||
def kind(self): ...
|
def kind(self) -> int: ...
|
||||||
|
|
||||||
class surface(geom_item): ...
|
class surface(geom_item): ...
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user