mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-04 13:13:25 +03:00
0029604: Uniform mechanism providing History of shape's modifications for OCCT algorithms in DRAW
Implementation of the mechanism for unification of the history commands for all OCCT algorithms. The following Draw commands should be used to track the history of shapes modifications of any operation: - modified - to find the shapes modified from the given shape in the given history. - generated - to find the shapes generated from the given shape in the given history. - isdeleted - to check if the given shape has been deleted during operation. The mechanism allows fast & easy enabling of the DRAW history support for the algorithms supporting the history on the API level (i.e. the algorithm should have the methods Modified(), Generated() and IsDeleted()). To enable the draw history support it is necessary to store the history of the algorithm into the session. For instance: TopTools_ListOfShape Objects = ...; // Objects TopTools_ListOfShape Tools = ...; // Tools BRepAlgoAPI_Cut aCut(Objects, Tools); // Boolean cut operation BRepTest_Objects::SetHistory(Objects, aCut); // Store the history for the Objects (overwrites the history in the session) BRepTest_Objects::AddHistory(Tools, aCut); // Add the history for the Tools To get the stored history in draw the command "savehistory" should be used. It saves the history kept in session into a Drawable object with the given name: # perform cut bcut r s1 s2 # save history of cut savehistory cut_history explode s1 f modified m cut_history s1_1 The Draw History commands of the following algorithms have been removed: - Boolean Operations; - Defeaturing; - Unify same domain; - Sweep; - Thrusections; All these algorithms have been switched to support the new Draw history mechanism. The Fillet and Blend algorithms have been also enabled to support history commands.
This commit is contained in:
@@ -2931,28 +2931,30 @@ Warning: The positioning of the shapes leads to creation of small edges without
|
||||
|
||||
@section occt_algorithms_history History Information
|
||||
|
||||
The chapter describes the rules for filling the History Information (or just History) for the arguments of the operations in Boolean Component.
|
||||
The History is available only for the VERTICES, EDGES, FACES and SOLIDS from the input arguments.
|
||||
All operations in Boolean Component support @ref occt_modalg_hist "History information". This chapter describes how the History is filled for these operations.
|
||||
|
||||
The History allows tracking the modification of the input shapes during the operation. It consists of the following information:
|
||||
* Information about Deleted shapes;
|
||||
* Information about Modified shapes;
|
||||
* Information about Generated shapes;
|
||||
Additionally to Vertices, Edges and Faces the history is also available for the Solids.
|
||||
|
||||
All History information is filled basing on the result of current operation. History cannot return any shapes not contained in the result.
|
||||
Thus if the result of the operation is empty shape, all input shapes will be considered as Deleted and none will have Modified and Generated shapes.
|
||||
The rules for filling the History information about Deleted and Modified shapes are the same as for the API algorithms.
|
||||
|
||||
@subsection occt_algorithms_history_del Deleted shapes
|
||||
Only the rules for Generated shapes require clarification.
|
||||
In terms of the algorithms in Boolean Component the shape from the arguments can have Generated shapes only if these new shapes
|
||||
have been obtained as a result of pure intersection (not overlapping) of this shape with any other shapes from arguments. Thus, the Generated shapes are always:
|
||||
* VERTICES created from the intersection points and may be Generated from edges and faces only;
|
||||
* EDGES created from the intersection edges and may be Generated from faces only.
|
||||
|
||||
The shape is considered as Deleted if the result shape do not contain the shape itself and none of its splits.
|
||||
For example, the result of CUT operation of two overlapping planar faces (see the example below) does not contain any parts from the tool face. Thus, the tool faces is considered as Deleted.
|
||||
So, only EDGES and FACES could have information about Generated shapes. For all other types of shapes the list of Generated shapes will be empty.
|
||||
|
||||
@subsection occt_algorithms_history_ex Examples
|
||||
|
||||
Here are some examples illustrating the History information.
|
||||
|
||||
@subsubsection occt_algorithms_history_ex_del Deleted shapes
|
||||
|
||||
The result of CUT operation of two overlapping planar faces (see the example below) does not contain any parts from the tool face. Thus, the tool face is considered as Deleted.
|
||||
If the faces are not fully coinciding, the result must contain some parts of the object face. In this case object face will be considered as not deleted.
|
||||
But if the faces are fully coinciding, the result must be empty, and both faces will be considered as Deleted.
|
||||
|
||||
To get the information about Deleted shapes it is necessary to use the method *Standard_Boolean IsDeleted(const TopoDS_Shape& theS)*.
|
||||
|
||||
To get the information about Deleted shapes in DRAW it is necessary to use the command *bisdeleted shape*.
|
||||
|
||||
Example of the overlapping faces:
|
||||
|
||||
~~~~
|
||||
@@ -2967,29 +2969,21 @@ baddtools f2
|
||||
bfillds
|
||||
bbop r 2
|
||||
|
||||
bisdeleted f1
|
||||
savehistory cut_hist
|
||||
isdeleted cut_hist f1
|
||||
# Not deleted
|
||||
|
||||
bisdeleted f2
|
||||
isdeleted cut_hist f2
|
||||
# Deleted
|
||||
~~~~
|
||||
|
||||
@subsection occt_algorithms_history_modif Modified shapes
|
||||
@subsubsection occt_algorithms_history_ex_modif Modified shapes
|
||||
|
||||
The shape is considered as Modified if the result shape contains any of the splits of the shape, not the shape itself. The shape can be modified only into the shapes with same dimension.
|
||||
The splits of the shape contained in the result shape are Modified from the shape.
|
||||
|
||||
For example, in the FUSE operation of two edges intersecting in one point (see the example below), both edges will be split by the intersection point. All these splits will be contained in the result.
|
||||
In the FUSE operation of two edges intersecting in one point (see the example below), both edges will be split by the intersection point. All these splits will be contained in the result.
|
||||
Thus, each of the input edges will be Modified into its two splits.
|
||||
But in the CUT operation on the same edges, the tool edge will be Deleted from the result and, thus, will not have any Modified shapes.
|
||||
|
||||
To get the information about Modified shapes it is necessary to use the method *const TopTools_ListOfShape& Modified(const TopoDS_Shape& theS)*.
|
||||
The list of Modified elements will contain only those which are contained in the result of the operation. If the list is empty the shape has not been modified and it is necessary to check if it has been Deleted.
|
||||
|
||||
To get the information about Modified shapes in DRAW it is necessary to use the command *bmodified modif shape*.
|
||||
|
||||
Example of the intersecting edges:
|
||||
|
||||
~~~~
|
||||
line l1 0 0 0 1 0 0
|
||||
mkedge e1 l1 -10 10
|
||||
@@ -3006,44 +3000,35 @@ bfillds
|
||||
# fuse operation
|
||||
bbop r 1
|
||||
|
||||
bmodified m1 e1
|
||||
savehistory fuse_hist
|
||||
|
||||
modified m1 fuse_hist e1
|
||||
nbshapes m1
|
||||
# EDGES: 2
|
||||
|
||||
bmodified m2 e2
|
||||
modified m2 fuse_hist e2
|
||||
nbshapes m2
|
||||
# EDGES: 2
|
||||
|
||||
# cut operation
|
||||
bbop r 2
|
||||
|
||||
bmodified m1 e1
|
||||
savehistory cut_hist
|
||||
|
||||
modified m1 cut_hist e1
|
||||
nbshapes m1
|
||||
# EDGES: 2
|
||||
|
||||
bmodified m2 e2
|
||||
modified m2 cut_hist e2
|
||||
# The shape has not been modified
|
||||
|
||||
~~~~
|
||||
|
||||
|
||||
@subsection occt_algorithms_history_gen Generated shapes
|
||||
@subsubsection occt_algorithms_history_gen Generated shapes
|
||||
|
||||
In terms of the algorithms in Boolean Component the shape from the arguments can have Generated shapes only if these new shapes have been obtained as a result of pure intersection (not overlapping)
|
||||
of this shape with any other shapes from arguments. Thus, the Generated shapes are always:
|
||||
* VERTICES created from the intersection points and may be Generated from edges and faces only;
|
||||
* EDGES created from the intersection edges and may be Generated from faces only.
|
||||
The two intersecting edges will both have the intersection vertices Generated from them.
|
||||
|
||||
So, only EDGES and FACES could have information about Generated shapes. For all other types of shapes the list of Generated shapes will be empty.
|
||||
|
||||
For example, the two intersecting edges will both have the intersection vertices Generated from them.
|
||||
|
||||
To get the information about Generated shapes it is necessary to use the method *const TopTools_ListOfShape& Generated(const TopoDS_Shape& theS)*.
|
||||
The list of Generated elements will contain only those which are contained in the result of the operation. If the list is empty no new shapes have been Generated from the shape.
|
||||
|
||||
To get the information about Generated shapes in DRAW it is necessary to use the command *bgenerated gen shape*.
|
||||
|
||||
Example of interfering faces
|
||||
As for the operation with intersecting faces, consider the following example:
|
||||
|
||||
~~~~
|
||||
plane p1 0 0 0 0 0 1
|
||||
@@ -3061,11 +3046,13 @@ bfillds
|
||||
# fuse operation
|
||||
bbop r 1
|
||||
|
||||
bgenerated gf1 f1
|
||||
savehistory fuse_hist
|
||||
|
||||
generated gf1 fuse_hist f1
|
||||
nbshapes gf1
|
||||
# EDGES: 1
|
||||
|
||||
bgenerated gf2 f2
|
||||
generated gf2 fuse_hist f2
|
||||
nbshapes gf2
|
||||
# EDGES: 1
|
||||
|
||||
@@ -3073,10 +3060,12 @@ nbshapes gf2
|
||||
# common operation - result is empty
|
||||
bbop r 0
|
||||
|
||||
bgenerated gf1 f1
|
||||
savehistory com_hist
|
||||
|
||||
generated gf1 com_hist f1
|
||||
# No shapes were generated from the shape
|
||||
|
||||
bgenerated gf2 f2
|
||||
generated gf2 com_hist f2
|
||||
# No shapes were generated from the shape
|
||||
|
||||
~~~~
|
||||
|
Reference in New Issue
Block a user