mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 01:41:57 +00:00
typing
This commit is contained in:
@@ -56,20 +56,18 @@ def add_cost_item(
|
||||
# Alternatively you may add them as subitems
|
||||
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 settings["cost_schedule"]:
|
||||
if cost_schedule:
|
||||
file.create_entity(
|
||||
"IfcRelAssignsToControl",
|
||||
**{
|
||||
"GlobalId": ifcopenshell.guid.new(),
|
||||
"OwnerHistory": ifcopenshell.api.owner.create_owner_history(file),
|
||||
"RelatedObjects": [cost_item],
|
||||
"RelatingControl": settings["cost_schedule"],
|
||||
"RelatedObjects": [cost_item_],
|
||||
"RelatingControl": cost_schedule,
|
||||
},
|
||||
)
|
||||
elif settings["cost_item"]:
|
||||
ifcopenshell.api.nest.assign_object(file, related_objects=[cost_item], relating_object=settings["cost_item"])
|
||||
return cost_item
|
||||
elif cost_item:
|
||||
ifcopenshell.api.nest.assign_object(file, related_objects=[cost_item_], relating_object=cost_item)
|
||||
return cost_item_
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import ifcopenshell
|
||||
from typing import Any, Union, Literal
|
||||
from typing import Any, Union, Literal, Self
|
||||
|
||||
# `std::vector<xxx>` usually translated to `tuple[xxx, ...]`.
|
||||
|
||||
@@ -731,14 +731,17 @@ class collection:
|
||||
def matrix(self): ...
|
||||
|
||||
class colour(item):
|
||||
def b(self): ...
|
||||
def calc_hash(self): ...
|
||||
def clone_(self): ...
|
||||
def r(self) -> float: ...
|
||||
def g(self) -> float: ...
|
||||
def b(self) -> float: ...
|
||||
def calc_hash(self) -> int: ...
|
||||
def clone_(self) -> Self: ...
|
||||
@property
|
||||
def components(self): ...
|
||||
def g(self): ...
|
||||
def kind(self): ...
|
||||
def r(self): ...
|
||||
def components(self) -> tuple[float, float, float]:
|
||||
"""RGB tuple."""
|
||||
...
|
||||
|
||||
def kind(self) -> int: ...
|
||||
|
||||
class context:
|
||||
def add(self, segments): ...
|
||||
@@ -1087,11 +1090,14 @@ class item:
|
||||
instance: Any
|
||||
orientation: Any
|
||||
def calc_hash(self): ...
|
||||
def clone_(self): ...
|
||||
# TODO: hide from the wrapper?
|
||||
def clone_(self) -> Self: ...
|
||||
def hash(self): ...
|
||||
def identity(self): ...
|
||||
def kind(self): ...
|
||||
def reverse(self): ...
|
||||
# TODO: hide from the wrapper?
|
||||
def kind(self):
|
||||
"""Internal enum item index."""
|
||||
|
||||
class less_functor: ...
|
||||
|
||||
@@ -1329,18 +1335,25 @@ class sphere(surface):
|
||||
def matrix(self): ...
|
||||
|
||||
class style(item):
|
||||
diffuse: Any
|
||||
name: Any
|
||||
specular: Any
|
||||
specularity: Any
|
||||
surface: Any
|
||||
transparency: Any
|
||||
use_surface_color: Any
|
||||
def calc_hash(self): ...
|
||||
def clone_(self): ...
|
||||
def get_color(self): ...
|
||||
def has_specularity(self): ...
|
||||
def has_transparency(self): ...
|
||||
diffuse: colour
|
||||
name: str
|
||||
"""E.g. 'IfcSurfaceStyleShading-218', where 218 is style's STEP id."""
|
||||
specular: colour
|
||||
specularity: float
|
||||
"""Can be `float('nan')`"""
|
||||
surface: colour
|
||||
transparency: float
|
||||
"""Can be `float('nan')`"""
|
||||
use_surface_color: bool
|
||||
|
||||
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:
|
||||
"""
|
||||
Possible values for `instance_id`:
|
||||
@@ -1354,7 +1367,7 @@ class style(item):
|
||||
"""
|
||||
...
|
||||
|
||||
def kind(self): ...
|
||||
def kind(self) -> int: ...
|
||||
|
||||
class surface(geom_item): ...
|
||||
|
||||
|
||||
Reference in New Issue
Block a user