Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash in python bindings and TiGL 3.2.0 #823

Closed
joergbrech opened this issue Aug 6, 2021 · 0 comments · Fixed by #825
Closed

Crash in python bindings and TiGL 3.2.0 #823

joergbrech opened this issue Aug 6, 2021 · 0 comments · Fixed by #825

Comments

@joergbrech
Copy link
Contributor

joergbrech commented Aug 6, 2021

The following code crashes both on Windows and Linux (with this CPACS file, though it would likely cras with any other CPACS file that has wing guide curves defined):

import os

from OCC.Extend.TopologyUtils import TopologyExplorer
from OCC.Core.TopoDS import topods
from OCC.Core.BRep import BRep_Tool_Curve
from OCC.Core.GeomConvert import geomconvert_CurveToBSplineCurve

from tixi3 import tixi3wrapper
from tigl3 import tigl3wrapper, surface_factories, configuration
from tigl3.geometry import CWireToCurve
from tigl3.occ_helpers.topology import iter_edges

tixi_h = tixi3wrapper.Tixi3()
tigl_h = tigl3wrapper.Tigl3()

dir_path = os.path.dirname(os.path.realpath(__file__))
tixi_h.open(dir_path + "/D150_8_guides_8_profiles.xml")
tigl_h.open(tixi_h, "")

# get the configuration manager
mgr = configuration.CCPACSConfigurationManager_get_instance()

# get the CPACS configuration, defined by the tigl handle
# we need to access the underlying tigl handle (that is used in the C/C++ API)
config = mgr.get_configuration(tigl_h._handle.value)

# get the wing
wing = config.get_wing(1)
Nsegments = wing.get_segment_count()

# get profile wires
profileWire_list = []
for i in range(1, Nsegments+1):
    segment = wing.get_segment(i)
    profileWire_list.append(segment.get_inner_wire())
profileWire_list.append(wing.get_segment(Nsegments).get_outer_wire())

prof_splines_1 = []
for w in profileWire_list:
    e = list(iter_edges(w))
    curve, _, _ = BRep_Tool_Curve(e[0])
    curve = geomconvert_CurveToBSplineCurve(curve)
    prof_splines_1.append(curve)

# Get Guide Curve wires
guideCurve_list = []
guideCurveWire_list = []
guide_curves = wing.get_guide_curve_wires()
t = TopologyExplorer(guide_curves)
for iwire in t.wires():
    guideCurve_list.append(CWireToCurve(topods.Wire(iwire)).curve())
    guideCurveWire_list.append(iwire)

# interpolate profiles and guides
wing_loft = surface_factories.interpolate_curve_network(prof_splines_1, guideCurve_list, 1e-4)

Output:

Traceback (most recent call last):
  File "C:/data/sandbox/tigl_playground/debug.py", line 57, in <module>
    wing_loft = surface_factories.interpolate_curve_network(prof_splines_1, guideCurve_list, 1e-4)
  File "C:\ProgramData\Miniforge3\envs\tigl3\lib\site-packages\tigl3\surface_factories.py", line 46, in interpolate_curve_network
    interpolator = CTiglInterpolateCurveNetwork(profiles, guides, tolerance)
  File "C:\ProgramData\Miniforge3\envs\tigl3\lib\site-packages\tigl3\geometry.py", line 2972, in __init__
    _geometry.CTiglInterpolateCurveNetwork_swiginit(self, _geometry.new_CTiglInterpolateCurveNetwork(profiles, guides, spatialTolerance))
TypeError: in method 'new_CTiglInterpolateCurveNetwork', argument 1 of type 'std::vector< opencascade::handle< Geom_Curve >,std::allocator< opencascade::handle< Geom_Curve > > > const &'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants