GithubHelp home page GithubHelp logo

Comments (20)

rainman110 avatar rainman110 commented on May 27, 2024 1

@tpaviot I think I know, why the downcasting is not working anymore.

Under the hood, swig manages all references to objects via their handles. When downcasting one object to another type, we were exploiting the inheritance chain of the handles. For example Handle(Geom_BSplineCurve) is inherited from Handle(Geom_Curve). Swig uses the inheritance type information to check, what handle types are allowed for the downcasting arguments.

In OCCT 7, handles are standalone classes that don't use inheritance. Still, Geom_BSplineCurve is inherited from Geom_Curve, but their handles aren't. This is the reason, why swig does not accept anything else for downcasting other than Handle_Standard_Transients!

We need to make swig aware of the underlying inheritance chain of the non-handle objects. I suppose, we ca use the typecheck typemaps of swig somehow.

from pythonocc-generator.

tpaviot avatar tpaviot commented on May 27, 2024 1

@rainman110 No, it's this line:

typedef opencascade::handle <Standard_Transient> Handle_Standard_Transient;

If I remove it, everything goes right. It appeared after a change to generate_wrapper.py

I really have difficulties to work with SWIG warnings. They're not documented, not easy to know what to do to avoid them.

from pythonocc-generator.

trelau avatar trelau commented on May 27, 2024

awesome work. moving forward do you intend to keep OCE up-to-date or are you planning on just using the OCCT releases?

from pythonocc-generator.

jf--- avatar jf--- commented on May 27, 2024

A screenshot including an AIS_Manipulator

WOW! That's wonderful! So eager to delve into the generalized fused goodness!

from pythonocc-generator.

rainman110 avatar rainman110 commented on May 27, 2024

Wow... Great progress! Congratulations for this achievement.

@tpaviot I'll have a look at the handle wrapper and try to fix downcasting. I suppose, we just need some small adaptations.

from pythonocc-generator.

tpaviot avatar tpaviot commented on May 27, 2024

@trelau I plan to keep OCE up to date

Thank you @rainman110 maybe you should read the migration guide that contains information about handles https://dev.opencascade.org/doc/overview/html/occt_dev_guides__upgrade.html#upgrade_700

from pythonocc-generator.

rainman110 avatar rainman110 commented on May 27, 2024

I think a narrowed down the problem and have a potential fix.

@tpaviot I cannot completely build you branch 7.x. There are still a couple of errors ( i am building on windows). So, can you already build it completely with your generated files?

from pythonocc-generator.

tpaviot avatar tpaviot commented on May 27, 2024

@rainman110 I only tested on Linux so far, still did not try on Windows. Usually, Windows comes with its bunch of compilation errors, and I have to remove failing classes/methods from the Modules.py file. There are much less differences between Linux and osx

from pythonocc-generator.

rainman110 avatar rainman110 commented on May 27, 2024

@tpaviot I found one of the main culprits! In Standard.i you define

/* rttiext only ojects wrapped as handles */
%define Handle_Standard_Persistent Handle(Standard_Persistent)
%enddef
typedef Standard_Persistent Standard_Transient;
/* end rttiext only declaration */

This breaks the whole inheritance chain, such that Standard_Transient becomes defacto unknown for all deriving classes. This on the other hand breaks DownCasting.

I really suggest turning the swig warnings on for development since then it is much more clear, what is going on. With the default settings, all these valuable informations are hidden.

from pythonocc-generator.

rainman110 avatar rainman110 commented on May 27, 2024

@tpaviot Really? Everything works?

Then, windows is still an issue. Here we have the problem, that Handle(Something) is a different class than Handle_Something and swig won't convert between them right now. This is a visual c only thing and intended by the occt devs (see standard_handle.hxx). I am still looking into this.

from pythonocc-generator.

tpaviot avatar tpaviot commented on May 27, 2024

ok I see, indeed Handle(Class) and Handle_* are different for msvc

from pythonocc-generator.

jf--- avatar jf--- commented on May 27, 2024

I really have difficulties to work with SWIG warnings. They're not documented, not easy to know what to do to avoid them

Would it be straightfwd that the warnings bubble up depending on a environment variable?

from pythonocc-generator.

adam-urbanczyk avatar adam-urbanczyk commented on May 27, 2024

@tpaviot great work! Can't wait to try it out.

from pythonocc-generator.

tpaviot avatar tpaviot commented on May 27, 2024

@rainman110 I updated both the generator and the wrapper, in a simpler way. There's no need to modify the OccHandle.i script anymore, and Downcasting works as expected (on Linux)

from pythonocc-generator.

rainman110 avatar rainman110 commented on May 27, 2024

@tpaviot Great! Well done.

I'll see, what I can do for Windows. Unfortunately, It might take a while until I find the time.

from pythonocc-generator.

rainman110 avatar rainman110 commented on May 27, 2024

@tpaviot Can you please commit the changed code to pythonocc-core to branch wip/occt7x-support?

from pythonocc-generator.

tpaviot avatar tpaviot commented on May 27, 2024

@rainman110 I already did it. I use to push -force to this branch. fetch your local copy and reset the wip/occtx-support to origin/wip/occt7x-support to have latest changes.

from pythonocc-generator.

rainman110 avatar rainman110 commented on May 27, 2024

@tpaviot Ah okay... did not see that!

from pythonocc-generator.

Trophime avatar Trophime commented on May 27, 2024

Any update on this?

from pythonocc-generator.

tpaviot avatar tpaviot commented on May 27, 2024

Outdated. pythonocc-core now targets opencascade 7.4.0

from pythonocc-generator.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.