BRepBuilderAPI_GTransform bug?

Hello,

I tried to use BRepBuilderAPI_GTransform to scale a solid with 3 different scale factors in x,y,z direction. I found it internally copied the TopoDS_Shape, and used the copy to scale. Later, when ModifiedShapes() are called, the used the original TopoDS_Shape, and it is not in the map of shape-changedshape.

I made following code change, and it worked to give me correct scaled volume, can someone in the OCC team look at it and see if it's proper to check in for better performance?

Thanks.

--- /src/BRepBuilderAPI/BRepBuilderAPI_Collect.cxx 2011-05-27 13:14:09.000000000 -0500
+++ BRepBuilderAPI_Collect.cxx 2011-05-27 13:15:36.000000000 -0500
@@ -201,9 +201,18 @@
BuildBack (myGen, GenBack); // Vraiment pas optimum a Revoir
BuildBack (myMod, ModBack);

- Update (myMod,myGen,ModBack,GenBack,SI,MKS,TopAbs_FACE);
- Update (myMod,myGen,ModBack,GenBack,SI,MKS,TopAbs_EDGE);
- Update (myMod,myGen,ModBack,GenBack,SI,MKS,TopAbs_VERTEX);
+ TopAbs_ShapeEnum type = SI.ShapeType();
+ Update (myMod,myGen,ModBack,GenBack,SI,MKS,type);
+ if(type + Update (myMod,myGen,ModBack,GenBack,SI,MKS,TopAbs_SHELL);
+ if(type + Update (myMod,myGen,ModBack,GenBack,SI,MKS,TopAbs_FACE);
+ if(type + Update (myMod,myGen,ModBack,GenBack,SI,MKS,TopAbs_WIRE);
+ if(type + Update (myMod,myGen,ModBack,GenBack,SI,MKS,TopAbs_EDGE);
+ if(type + Update (myMod,myGen,ModBack,GenBack,SI,MKS,TopAbs_VERTEX);

#ifdef DEB
if (Affich) {

Forum supervisor's picture

Dear Jane,
Just some remarks to your post.
The mentioned algorithm provides not only topological result,
but also a history of modifications (myHist : Collect from BRepBuilderAPI).
History of modifications is used by Topological naming algorithm (presented in TNaming package)
and should satisfy definitive rules expected by naming algorithm (dedicated for usage in parametric CAD systems). It was the reason why only modifications of Faces, Edges and Vertexes are collected. All other types of entities (shells, wires ...) usually are regenerated by naming algorithm.
Regards

Jane Hu's picture

Dear forum supervisor:

Sorry for not coming back to this issue early enough. Do you mean when I do a scale operation, I need to use the TNaming package to keep track of changed shell and wire, and even the solids if they are in a Compound? I am not currently using this package for this yet.

My understanding and usage here is:

When I do scale for a compound of 2 solids,

gp_GTrsf gTrsf;
gTrsf.SetValue(1,1, scale_factor_x);
gTrsf.SetValue(2,2, scale_factor_y);
gTrsf.SetValue(3,3, scale_factor_z);
BRepBuilderAPI_GTransform gBRepTrsf(gTrsf);
gBRepTrsf.Perform(*myTopoDSShape);

I can call
TopoDS_Shape shape = aBRepTrsf->Shape();

to get the scaled compound. Then I need to update the solids individually. then their shells, faces, wires, edges and vertices.

To do this, I need to call aBRepTrsf->ModifiedShape(orig_Solid) etc.
At this point I couldn't get the Modified solids, shells and wires if BRepBuilderAPI_Collect.cxx doesn't update for them.

Is there any drawbacks if we add those updates in the file?

Thanks.

Jane

Forum supervisor's picture

Dear Jane Hu,
It depends on the goals of your application.
If it is not parametric one you can forget it.
If you suppose parametrization you will be forced to use topological naming.
Topological naming will allow you to track topological entities through the steps in the modeling process. I would suggested you to overlook the "Application Framework User’s Guide".
Pay your attention to chapters "5. OCAF Shape Attributes" and "8. Function Services"
Regards

Jane Hu's picture

Dear forum supervisor:

Thank you for your message, I'll find time to study the materials.

Jane