Skip to content

some ocaf stuff #202

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

some ocaf stuff #202

wants to merge 2 commits into from

Conversation

ericsink
Copy link

I added some OCAF stuff to the lower layer. This is my first PR to this repo, so I'm not confident I am following existing patterns. Feedback welcome.

@ericsink
Copy link
Author

I'm not sure I like the naming I chose for TDF_Label_Displace as a way to call TNaming::Displace.

@bschwind
Copy link
Owner

Hi @ericsink, thanks for the PR!

Out of curiosity, what functionality do you want from OCAF? Up until now I've been focused mostly on the geometric processing of OCCT, while writing my own stuff when I need 3D visualizations or other things.

Additionally, as I'm sure you have learned, the organization of these bindings is quite a mess, and involves a lot of manual work. I'm currently working on an approach to automatically generate bindings for opencascade so that you can simply point the build to a list of OCCT packages and the binding generator does the rest. That could allow for some interesting things, like using cargo feature flags to selectively include or exclude modules so that you don't end up building and linking things you don't need.

@ericsink
Copy link
Author

Out of curiosity, what functionality do you want from OCAF?

I need (or think I need) a way to reference solids and their faces by names. I find the OCAF API to be ... extremely unintuitive, but it does seem designed to solve my problem.

@bschwind
Copy link
Owner

I need (or think I need) a way to reference solids and their faces by names

Might be naive of me, depending on the specifics, but could you store a HashMap<String, Shape>? Or do you need something that tracks features even if the topology has changed? From a brief skim it seems like the OCAF labeling stuff handles the latter case well.

@ericsink
Copy link
Author

Or do you need something that tracks features even if the topology has changed?

I think the answer to this is "yes", but I'm not too familiar with OpenCascade, so I'm still figuring all that out. I was originally hoping that HashMap<String, Shape> would work, but I got the impression it would not, so I started down the OCAF path.

Example: Suppose I have a box B, a shape I got from Shape::box_with_dimensions(). Then I obtain a Shape reference F to one of the faces. If I translate or rotate B, is F still valid? How about if I do a boolean operation, like constructing a cylinder a drilling a hole through B?

I don't have clear answers, but I figure it makes sense to assume that any operation might cause the face reference to become invalid, so I needed a way to work with names, as a form of indirection.

@bschwind
Copy link
Owner

@ericsink makes sense, and in that case the OCAF functionality might be what you need. I'm pretty sure if you modify a face like that (drilling a hole, for example), then that F and the face with a hole drilled in it, would be different. Translating or rotating might be fine though, I've never tried that.

For most of the CAD stuff I've been doing with this library, after an operation that changes the shape, I then query it in some way to get a particular face I want. So if I drilled a hole in the face of a box, I would find that face again by requesting the farthest face along the direction the drill was made. That's not going to be fun to do in all cases, so I wonder how well the OCAF equivalent works.

@ericsink
Copy link
Author

Those remarks raise my confidence that I'm on the right track with OCAF.

Anyway... based on what you've said about your new approach to the bindings, I'm guessing you can just close this PR? I can keep an eye on this repo and later figure out how to appropriately submit any changes if needed.

@bschwind
Copy link
Owner

@ericsink yes, the automated bindings are the next thing I hope to complete, so I'd recommend giving OCAF a try on your fork and revisiting this when that's done. I'll try to remember to update you on this PR once it's done. I'd be interested to hear what you discover with OCAF, too.

@ericsink
Copy link
Author

I'd be interested to hear what you discover with OCAF, too.

I've been experimenting with non-OCAF approaches for keeping track of things, and I'm getting much better traction. OCAF seems like it was designed to solve the kinds of problems I have, but I just don't get along with its API very well.

@bschwind
Copy link
Owner

Yeah I've been skeptical of it from what I've seen so far. Thanks for the update on it!

…uff. net actual change from upstream should now be minimal.
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