Questions about reshape stepfiles with colors remaining

Azuki

Looking around for some CAD
Hi I'm Azuki and I'm new to OCC studies.
After learning lesson 12 to 15 on youtube, I tried to make some small step files by imitating the code of Lesson 15.
Then I read the step files and visualize it. After that I want to make some changes, such as, I want to make difference to the shape
like making slicing of it while maintaining the color label of it. The step files is as below and the result I want to get is like the picture.


16766159343335.png

I tried to get some demos from occ samples while official samples are all about TDF_labels, and I cannot understand them.
Is there are some methods to solve the problem? Thanks a lot!
 

Attachments

  • test6.step
    183 KB · Views: 4

JSlyadne

Administrator
Staff member
Hello Azuki, welcome here!

I wonder whether the slicing you're talking about should be pure a visualization feature, like a clipping plane, or this should be a modeling operator changing a shape itself and which result can be stored in a document so that be permanent?
 

Azuki

Looking around for some CAD
Hello Azuki, welcome here!

I wonder whether the slicing you're talking about should be pure a visualization feature, like a clipping plane, or this should be a modeling operator changing a shape itself and which result can be stored in a document so that be permanent?
Very sorry for bad presentation.
What I want to do is to load the step file and change the shape itself, then export the new step files. The picture above is the case I want to get, where all shapes get a cross-section and their color labels are still there. For example, the green part of the picture comes from the green part of the step file. I want to make changes to the shape part and make the link of the colorlabel remaining.
I wonder if I've explained it clearly...
 
Last edited:

JSlyadne

Administrator
Staff member
Yeah, your target is absolutely clear now. Thanks for clarification.

As for creation a slicing, likely, \src\BRepAlgoAPI\BRepAlgoAPI_Section.hxx is what you're looking for. It's a boolean operator which lets you construct a section as a set of vertices and edges out of shape(s).

After slicing, you'll need to create a new shape(s) (TopoDS_Shape) from the result of BRepAlgoAPI_Section algorithm and put them to a document (TDocStd_Document) instance instead of old ones. How to do that see asiAsm_XdeDoc::UpdatePartShape(...) of AnalysisSitus's code-base.
 

Azuki

Looking around for some CAD
Yeah, your target is absolutely clear now. Thanks for clarification.

As for creation a slicing, likely, \src\BRepAlgoAPI\BRepAlgoAPI_Section.hxx is what you're looking for. It's a boolean operator which lets you construct a section as a set of vertices and edges out of shape(s).

After slicing, you'll need to create a new shape(s) (TopoDS_Shape) from the result of BRepAlgoAPI_Section algorithm and put them to a document (TDocStd_Document) instance instead of old ones. How to do that see asiAsm_XdeDoc::UpdatePartShape(...) of AnalysisSitus's code-base.
Thanks a lot! I'll try to learn that.
 
Top