mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-23 21:58:46 +00:00
Fixed all unit.add_si_unit uses after fd87747
Now they were causing `TypeError: Usecase.__init__() got an unexpected keyword argument 'name'`
This commit is contained in:
@@ -42,7 +42,7 @@ class LibraryGenerator:
|
|||||||
ifcopenshell.api.run(
|
ifcopenshell.api.run(
|
||||||
"project.assign_declaration", self.file, definition=self.library, relating_context=self.project
|
"project.assign_declaration", self.file, definition=self.library, relating_context=self.project
|
||||||
)
|
)
|
||||||
unit = ifcopenshell.api.run("unit.add_si_unit", self.file, unit_type="LENGTHUNIT", name="METRE", prefix="MILLI")
|
unit = ifcopenshell.api.run("unit.add_si_unit", self.file, unit_type="LENGTHUNIT", prefix="MILLI")
|
||||||
ifcopenshell.api.run("unit.assign_unit", self.file, units=[unit])
|
ifcopenshell.api.run("unit.assign_unit", self.file, units=[unit])
|
||||||
|
|
||||||
model = ifcopenshell.api.run("context.add_context", self.file, context_type="Model")
|
model = ifcopenshell.api.run("context.add_context", self.file, context_type="Model")
|
||||||
|
|||||||
@@ -56,7 +56,6 @@ def get_simple_2dcurve_data(coords, fillets=[], fillet_radius=[], closed=True, i
|
|||||||
for co_i, co in enumerate(coords, 0):
|
for co_i, co in enumerate(coords, 0):
|
||||||
current_point = len(points)
|
current_point = len(points)
|
||||||
if co_i in fillets:
|
if co_i in fillets:
|
||||||
|
|
||||||
r = fillets[co_i]
|
r = fillets[co_i]
|
||||||
rsb = r * cos(pi / 4) # radius shift big
|
rsb = r * cos(pi / 4) # radius shift big
|
||||||
rss = r - rsb # radius shift small
|
rss = r - rsb # radius shift small
|
||||||
@@ -230,7 +229,7 @@ class LibraryGenerator:
|
|||||||
ifcopenshell.api.run(
|
ifcopenshell.api.run(
|
||||||
"project.assign_declaration", self.file, definition=self.library, relating_context=self.project
|
"project.assign_declaration", self.file, definition=self.library, relating_context=self.project
|
||||||
)
|
)
|
||||||
unit = ifcopenshell.api.run("unit.add_si_unit", self.file, unit_type="LENGTHUNIT", name="METRE", prefix="MILLI")
|
unit = ifcopenshell.api.run("unit.add_si_unit", self.file, unit_type="LENGTHUNIT", prefix="MILLI")
|
||||||
ifcopenshell.api.run("unit.assign_unit", self.file, units=[unit])
|
ifcopenshell.api.run("unit.assign_unit", self.file, units=[unit])
|
||||||
|
|
||||||
model = ifcopenshell.api.run("context.add_context", self.file, context_type="Model")
|
model = ifcopenshell.api.run("context.add_context", self.file, context_type="Model")
|
||||||
|
|||||||
@@ -152,7 +152,7 @@ class LibraryGenerator:
|
|||||||
ifcopenshell.api.run(
|
ifcopenshell.api.run(
|
||||||
"project.assign_declaration", self.file, definition=self.library, relating_context=self.project
|
"project.assign_declaration", self.file, definition=self.library, relating_context=self.project
|
||||||
)
|
)
|
||||||
unit = ifcopenshell.api.run("unit.add_si_unit", self.file, unit_type="LENGTHUNIT", name="METRE", prefix="MILLI")
|
unit = ifcopenshell.api.run("unit.add_si_unit", self.file, unit_type="LENGTHUNIT", prefix="MILLI")
|
||||||
ifcopenshell.api.run("unit.assign_unit", self.file, units=[unit])
|
ifcopenshell.api.run("unit.assign_unit", self.file, units=[unit])
|
||||||
|
|
||||||
model = ifcopenshell.api.run("context.add_context", self.file, context_type="Model")
|
model = ifcopenshell.api.run("context.add_context", self.file, context_type="Model")
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ from mathutils import Vector
|
|||||||
|
|
||||||
V = lambda *x: Vector([float(i) for i in x])
|
V = lambda *x: Vector([float(i) for i in x])
|
||||||
|
|
||||||
|
|
||||||
# TODO: move examples to more suitable place
|
# TODO: move examples to more suitable place
|
||||||
def simple_uses():
|
def simple_uses():
|
||||||
ifc_file = ifcopenshell.file()
|
ifc_file = ifcopenshell.file()
|
||||||
@@ -91,7 +92,7 @@ def mirror_placement_test():
|
|||||||
"root.create_entity", ifc_file, ifc_class="IfcProjectLibrary", name=f"Non-structural assets library"
|
"root.create_entity", ifc_file, ifc_class="IfcProjectLibrary", name=f"Non-structural assets library"
|
||||||
)
|
)
|
||||||
ifcopenshell.api.run("project.assign_declaration", ifc_file, definition=library, relating_context=project)
|
ifcopenshell.api.run("project.assign_declaration", ifc_file, definition=library, relating_context=project)
|
||||||
unit = ifcopenshell.api.run("unit.add_si_unit", ifc_file, unit_type="LENGTHUNIT", name="METRE", prefix="MILLI")
|
unit = ifcopenshell.api.run("unit.add_si_unit", ifc_file, unit_type="LENGTHUNIT", prefix="MILLI")
|
||||||
ifcopenshell.api.run("unit.assign_unit", ifc_file, units=[unit])
|
ifcopenshell.api.run("unit.assign_unit", ifc_file, units=[unit])
|
||||||
model = ifcopenshell.api.run("context.add_context", ifc_file, context_type="Model")
|
model = ifcopenshell.api.run("context.add_context", ifc_file, context_type="Model")
|
||||||
plan = ifcopenshell.api.run("context.add_context", ifc_file, context_type="Plan")
|
plan = ifcopenshell.api.run("context.add_context", ifc_file, context_type="Plan")
|
||||||
@@ -165,7 +166,7 @@ def curve_between_two_points_test():
|
|||||||
"root.create_entity", ifc_file, ifc_class="IfcProjectLibrary", name=f"Non-structural assets library"
|
"root.create_entity", ifc_file, ifc_class="IfcProjectLibrary", name=f"Non-structural assets library"
|
||||||
)
|
)
|
||||||
ifcopenshell.api.run("project.assign_declaration", ifc_file, definition=library, relating_context=project)
|
ifcopenshell.api.run("project.assign_declaration", ifc_file, definition=library, relating_context=project)
|
||||||
unit = ifcopenshell.api.run("unit.add_si_unit", ifc_file, unit_type="LENGTHUNIT", name="METRE", prefix="MILLI")
|
unit = ifcopenshell.api.run("unit.add_si_unit", ifc_file, unit_type="LENGTHUNIT", prefix="MILLI")
|
||||||
ifcopenshell.api.run("unit.assign_unit", ifc_file, units=[unit])
|
ifcopenshell.api.run("unit.assign_unit", ifc_file, units=[unit])
|
||||||
model = ifcopenshell.api.run("context.add_context", ifc_file, context_type="Model")
|
model = ifcopenshell.api.run("context.add_context", ifc_file, context_type="Model")
|
||||||
plan = ifcopenshell.api.run("context.add_context", ifc_file, context_type="Plan")
|
plan = ifcopenshell.api.run("context.add_context", ifc_file, context_type="Plan")
|
||||||
|
|||||||
@@ -138,7 +138,7 @@ class Csv2Ifc:
|
|||||||
if unit:
|
if unit:
|
||||||
return unit
|
return unit
|
||||||
else:
|
else:
|
||||||
unit = ifcopenshell.api.run("unit.add_si_unit", self.file, unit_type=unit_type, name=ifcopenshell.util.unit.si_type_names.get(unit_type, None))
|
unit = ifcopenshell.api.run("unit.add_si_unit", self.file, unit_type=unit_type)
|
||||||
# unit = self.file.createIfcContextDependentUnit(
|
# unit = self.file.createIfcContextDependentUnit(
|
||||||
# self.file.createIfcDimensionalExponents(0, 0, 0, 0, 0, 0, 0), "USERDEFINED", symbol
|
# self.file.createIfcDimensionalExponents(0, 0, 0, 0, 0, 0, 0), "USERDEFINED", symbol
|
||||||
# )
|
# )
|
||||||
|
|||||||
@@ -52,10 +52,9 @@ class SvIfcCreateProject(bpy.types.Node, SverchCustomTreeNode, ifcsverchok.helpe
|
|||||||
self.process_ifc(file, project_name)
|
self.process_ifc(file, project_name)
|
||||||
|
|
||||||
def process_ifc(self, file, project_name):
|
def process_ifc(self, file, project_name):
|
||||||
|
|
||||||
# create project
|
# create project
|
||||||
project = ifcopenshell.api.run("root.create_entity", file, ifc_class="IfcProject", name=str(project_name))
|
project = ifcopenshell.api.run("root.create_entity", file, ifc_class="IfcProject", name=str(project_name))
|
||||||
lengthunit = ifcopenshell.api.run("unit.add_si_unit", file, unit_type="LENGTHUNIT", name="METRE")
|
lengthunit = ifcopenshell.api.run("unit.add_si_unit", file, unit_type="LENGTHUNIT")
|
||||||
ifcopenshell.api.run("unit.assign_unit", file, units=[lengthunit])
|
ifcopenshell.api.run("unit.assign_unit", file, units=[lengthunit])
|
||||||
model = ifcopenshell.api.run("context.add_context", file, context_type="Model")
|
model = ifcopenshell.api.run("context.add_context", file, context_type="Model")
|
||||||
context = ifcopenshell.api.run(
|
context = ifcopenshell.api.run(
|
||||||
|
|||||||
@@ -652,7 +652,7 @@ class TestAttribute:
|
|||||||
expected=True,
|
expected=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
restriction = Restriction(options={"minInclusive": 42, "maxInclusive": 42}, base="decimal")
|
restriction = Restriction(options={"minInclusive": 42, "maxInclusive": 42}, base="decimal")
|
||||||
facet = Attribute(name="RefractionIndex", value=restriction)
|
facet = Attribute(name="RefractionIndex", value=restriction)
|
||||||
ifc = ifcopenshell.file()
|
ifc = ifcopenshell.file()
|
||||||
run(
|
run(
|
||||||
@@ -1231,14 +1231,10 @@ class TestProperty:
|
|||||||
ifc = ifcopenshell.file()
|
ifc = ifcopenshell.file()
|
||||||
ifc.createIfcProject()
|
ifc.createIfcProject()
|
||||||
# Milli prefix used to check measurement conversions
|
# Milli prefix used to check measurement conversions
|
||||||
lengthunit = ifcopenshell.api.run("unit.add_si_unit", ifc, unit_type="LENGTHUNIT", name="METRE", prefix="MILLI")
|
lengthunit = ifcopenshell.api.run("unit.add_si_unit", ifc, unit_type="LENGTHUNIT", prefix="MILLI")
|
||||||
areaunit = ifcopenshell.api.run(
|
areaunit = ifcopenshell.api.run("unit.add_si_unit", ifc, unit_type="AREAUNIT", prefix="MILLI")
|
||||||
"unit.add_si_unit", ifc, unit_type="AREAUNIT", name="SQUARE_METRE", prefix="MILLI"
|
volumeunit = ifcopenshell.api.run("unit.add_si_unit", ifc, unit_type="VOLUMEUNIT", prefix="MILLI")
|
||||||
)
|
timeunit = ifcopenshell.api.run("unit.add_si_unit", ifc, unit_type="TIMEUNIT")
|
||||||
volumeunit = ifcopenshell.api.run(
|
|
||||||
"unit.add_si_unit", ifc, unit_type="VOLUMEUNIT", name="CUBIC_METRE", prefix="MILLI"
|
|
||||||
)
|
|
||||||
timeunit = ifcopenshell.api.run("unit.add_si_unit", ifc, unit_type="TIMEUNIT", name="SECOND")
|
|
||||||
ifcopenshell.api.run("unit.assign_unit", ifc, units=[lengthunit, areaunit, volumeunit, timeunit])
|
ifcopenshell.api.run("unit.assign_unit", ifc, units=[lengthunit, areaunit, volumeunit, timeunit])
|
||||||
return ifc
|
return ifc
|
||||||
|
|
||||||
@@ -1455,9 +1451,16 @@ class TestPartOf:
|
|||||||
|
|
||||||
element.PredefinedType = "BASESLAB"
|
element.PredefinedType = "BASESLAB"
|
||||||
facet = PartOf(entity="IFCSLAB", predefinedType="BASESLAB", relation="IfcRelAggregates")
|
facet = PartOf(entity="IFCSLAB", predefinedType="BASESLAB", relation="IfcRelAggregates")
|
||||||
run("An aggregate may specify the predefined type of the whole 1/2", facet=facet, inst=subelement, expected=True)
|
run(
|
||||||
|
"An aggregate may specify the predefined type of the whole 1/2", facet=facet, inst=subelement, expected=True
|
||||||
|
)
|
||||||
facet = PartOf(entity="IFCSLAB", predefinedType="SLABRADOR", relation="IfcRelAggregates")
|
facet = PartOf(entity="IFCSLAB", predefinedType="SLABRADOR", relation="IfcRelAggregates")
|
||||||
run("An aggregate may specify the predefined type of the whole 2/2", facet=facet, inst=subelement, expected=False)
|
run(
|
||||||
|
"An aggregate may specify the predefined type of the whole 2/2",
|
||||||
|
facet=facet,
|
||||||
|
inst=subelement,
|
||||||
|
expected=False,
|
||||||
|
)
|
||||||
|
|
||||||
ifc = ifcopenshell.file()
|
ifc = ifcopenshell.file()
|
||||||
element = ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcElementAssembly")
|
element = ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcElementAssembly")
|
||||||
|
|||||||
Reference in New Issue
Block a user