mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-20 23:36:20 +00:00
Updated alignment stationing to account for stationing being defined on a parent alignment
This commit is contained in:
@@ -163,6 +163,12 @@ def _add_segment_to_layout(file: ifcopenshell.file, layout: entity_instance, seg
|
|||||||
end_referent.ObjectPlacement.CartesianPosition.Axis.DirectionRatios = (ax, ay, az)
|
end_referent.ObjectPlacement.CartesianPosition.Axis.DirectionRatios = (ax, ay, az)
|
||||||
end_referent.ObjectPlacement.CartesianPosition.RefDirection.DirectionRatios = (rx, ry, rz)
|
end_referent.ObjectPlacement.CartesianPosition.RefDirection.DirectionRatios = (rx, ry, rz)
|
||||||
|
|
||||||
|
start_station = ifcopenshell.api.alignment.get_alignment_station(file,alignment)
|
||||||
|
end_referent_station = start_station + start_dist_along
|
||||||
|
pset_stationing = ifcopenshell.api.pset.add_pset(file, product=end_referent, name="Pset_Stationing")
|
||||||
|
ifcopenshell.api.pset.edit_pset(file, pset=pset_stationing, properties={"Station": end_referent_station})
|
||||||
|
|
||||||
|
|
||||||
# create the start of segment referent
|
# create the start of segment referent
|
||||||
|
|
||||||
# get the previous segment. Working from the end of the basis curve, -1 is zero length segment
|
# get the previous segment. Working from the end of the basis curve, -1 is zero length segment
|
||||||
|
|||||||
@@ -17,6 +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
|
||||||
|
import ifcopenshell.api.alignment
|
||||||
import ifcopenshell.util.element
|
import ifcopenshell.util.element
|
||||||
from ifcopenshell import entity_instance
|
from ifcopenshell import entity_instance
|
||||||
|
|
||||||
@@ -32,10 +33,16 @@ def get_alignment_station(file: ifcopenshell.file, alignment: entity_instance) -
|
|||||||
raise TypeError(f"Expected entity type to be IfcAlignment, instead received {alignment.is_a()}")
|
raise TypeError(f"Expected entity type to be IfcAlignment, instead received {alignment.is_a()}")
|
||||||
|
|
||||||
start_station = 0.0
|
start_station = 0.0
|
||||||
components = ifcopenshell.util.element.get_components(alignment)
|
|
||||||
for c in components:
|
parent_alignment = ifcopenshell.api.alignment.get_parent_alignment(alignment)
|
||||||
if c.is_a("IfcReferent") and ifcopenshell.util.element.get_predefined_type(c) == "STATION":
|
if parent_alignment:
|
||||||
start_station = ifcopenshell.util.element.get_pset(c, name="Pset_Stationing", prop="Station")
|
start_station = ifcopenshell.api.alignment.get_alignment_station(file,parent_alignment)
|
||||||
break
|
else:
|
||||||
|
components = ifcopenshell.util.element.get_components(alignment)
|
||||||
|
for c in components:
|
||||||
|
if c.is_a("IfcReferent") and ifcopenshell.util.element.get_predefined_type(c) == "STATION":
|
||||||
|
start_station = ifcopenshell.util.element.get_pset(c, name="Pset_Stationing", prop="Station")
|
||||||
|
break
|
||||||
|
|
||||||
|
|
||||||
return start_station
|
return start_station
|
||||||
|
|||||||
Reference in New Issue
Block a user