DLR-SC / tigl

The TiGL Geometry Library to process aircraft geometries in pre-design.
https://dlr-sc.github.io/tigl/
Apache License 2.0
235 stars 60 forks source link

Python wrapper returns SwigPyObject instead of CPACSWalls #1012

Open MarAlder opened 3 months ago

MarAlder commented 3 months ago

I still can't figure out why the walls (CPACSWalls.h) are not being exported correctly with the Python bindings. Does anyone have an idea?

Minimal test code:

from tixi3.tixi3wrapper import Tixi3
from tigl3.tigl3wrapper import Tigl3
import tigl3.configuration

tixi_h = Tixi3()
tigl_h = Tigl3()

tixi_h.open("test_fuselage_walls_ex1.xml")
tigl_h.open(tixi_h, "")

mgr = tigl3.configuration.CCPACSConfigurationManager_get_instance()
aircraft_config = mgr.get_configuration(tigl_h._handle.value)
walls = aircraft_config.get_fuselage("fuselage").get_structure().get_walls()

help(walls)

Test data: test_fuselage_walls_ex1.zip

Output:

class SwigPyObject(object)
 |  Swig object carries a C/C++ instance pointer
 |
 |  Methods defined here:
 |
 |  __eq__(self, value, /)
 |      Return self==value.
 |
 |  __ge__(self, value, /)
 |      Return self>=value.
 |
 |  __getattribute__(self, name, /)
 |      Return getattr(self, name).
[...]

https://github.com/DLR-SC/tigl/blob/f1e1bc31633a0bed05f3d6c45963d5048320e5df/bindings/python_internal/configuration.i#L190-L191

joergbrech commented 3 months ago

Is there an #include "generated/CPACSWalls.h" missing in configuration.i? Note the # instead of the %.

MarAlder commented 3 months ago

I also thought so, but no effect (see 2e43950)

joergbrech commented 3 months ago

Sorry, could you try CCPACSWalls instead of generated/CPACSWalls.h?