Skip to content

Conversation

@tymokvo
Copy link
Contributor

@tymokvo tymokvo commented May 6, 2025

Summary

  • Add wrapper around BRepAlgoAPI_Section class
  • Add casting function to wrapper.hxx
  • Add tests
  • Add section example

Description

Hello,

I have been evaluating CAD libraries in the rust ecosystem for a project at work. In order to test out some of the capabilities of opencascade-rs, I took a stab at implementing a simple wrapper around the BRepAlgoAPI_Section class.

The most complicated aspect was dealing with the inherited methods from the BRepAlgoAPI class hierarchy. I followed the advice from an issue on cxx on how to deal with this, hence the addition to wrapper.hxx.

Would this be a useful addition? I know that it's a bit rough right now, I haven't used cxx before! Would love to hear any feedback on this direction, though.

@bschwind
Copy link
Owner

bschwind commented May 9, 2025

Hi @tymokvo, thanks for the PR! And sorry for the late response on it.

I skimmed through the PR and it's looking good, thanks for adding an example as well!

Just FYI, the next thing I hope to accomplish in this repo is to have a more systematic approach to generating the bindings.

This includes logically organizing the OpenCascade modules into equivalently named Rust modules. You can see a manual example of that process in this PR:

#199

But obviously manually creating those are a pain, so I'm also working on generating them by parsing the C++ headers with tree-sitter and writing out the Rust code automatically. That work is happening in the tree-sitter branch.

I just wanted to give you an idea of what I hope this crate will turn into in the future. I'll try to give this a closer review soon.

@tymokvo
Copy link
Contributor Author

tymokvo commented May 12, 2025

The work on the tree-sitter branch is looking cool, happy to see that! Writing the bindings manually in one giant file is definitely not super fun.

Copy link
Owner

@bschwind bschwind left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall this looks great! I left a few comments, and I have one tiny preference to have literal floating point numbers have leading and trailing zeroes:

0. -> 0.0
.1 -> 0.1
etc.

Copy link
Owner

@bschwind bschwind left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! I'll merge this once CI passes. Thanks for the PR and thanks for waiting :)

@bschwind bschwind merged commit d1db1bf into bschwind:main May 31, 2025
4 checks passed
@tymokvo
Copy link
Contributor Author

tymokvo commented Jun 2, 2025

Thanks for the help and for making a great library!

@tymokvo tymokvo deleted the add-section-api branch June 2, 2025 14:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants