python-wrapped function to return engine position #1014
-
Dear tigl-folks, is there a python-wrapped function to return the engine positions in global coordinates? If not, is there a python exposed methodology to convert a point-like to global coordinates? Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Sorry for the very late reply. I don't think we have any convenience functions for this in TiGL. You can use the UID Manager to follow the chain of transformations relative to the parents (under the assumptions that the translations are all defined in CPACS to be relative to the parent) Here is some code to get you started in the right direction: tixi_handle = tixi3wrapper.Tixi3()
tixi_handle.open("simpletest-simplenacelle.cpacs.xml")
config_handle = tigl3wrapper.Tigl3()
config_handle.open(tixi_handle, "")
config_mgr = tigl3.configuration.CCPACSConfigurationManager_get_instance()
config = config_mgr.get_configuration(config_handle._handle.value)
uid_mgr = config.get_uidmanager()
engine_position = config.get_engine_positions().get_engine_position(1)
trafo = engine_position.get_transformation()
p = gp_Pnt(0., 0., 0.)
parent_uid = engine_position.get_parent_uid()
parent = uid_mgr.get_geometric_component(parent_uid)
while parent_uid:
dp = trafo.get_translation().as_point().get_gp_pnt()
p.Translate(gp_Vec(dp.XYZ()))
print(f"Position relative to {parent_uid}: ({p.X()}, {p.Y()}, {p.Z()})")
parent = uid_mgr.get_geometric_component(parent_uid)
parent_uid = parent.get_parent_uid()
trafo = parent.get_transformation() Output: Position relative to Pylon: (-0.1, 0.0, -0.41)
Position relative to Wing: (-0.55, 1.0, -0.53)
Position relative to SimpleFuselage: (-0.55, 1.0, -0.53) Let me know if you have any further questions. |
Beta Was this translation helpful? Give feedback.
Sorry for the very late reply. I don't think we have any convenience functions for this in TiGL. You can use the UID Manager to follow the chain of transformations relative to the parents (under the assumptions that the translations are all defined in CPACS to be relative to the parent)
Here is some code to get you started in the right direction: