Constructing a Modified Solid
The function
MbResultType ModifiedSolid( MbSolid & solid,
MbeCopyMode sameShell,
const MbModifiedSolidParams & params,
MbModifiedSolidResults & results );
Depending on the modification parameters MbModifiedSolidParams the function performs one of the following actions:
Removal of the selected faces from the solid without adjacent fillets (dmm_RemoveFaces).
Removal of the selected faces together with adjacent fillets (dmm_RemoveFacesWithAdjacentFillets).
Removal of closed cylindrical, conical, toroidal, spherical faces, revolution and extrusion faces whose radius is less than a given value and without adjacent fillets (dmm_RemoveBelowRadius).
Removal of closed cylindrical, conical, toroidal, spherical faces, revolution and extrusion faces whose radius is less than a given value together with adjacent fillets (dmm_RemoveBelowRadiusWithAdjacentFillets).
Creation of a solid from selected faces with an environment (dmm_Create).
Translation of the selected faces with an environment relative to the remaining faces of the solid (dmm_MoveFacesByVector) or without adaptation of adjacent fillets (dmm_MoveFacesByVectorNoAdaptation). The translation direction and distance are defined by the vector direction.
Replacement of the selected faces of the solid with offset faces (translation along the normal, radius change) (dmm_OffsetFaces). The offset distance is defined by the parameter value.
Change of the radius of the selected fillet faces by a given value (dmm_FilletsRadiusChange). The value of the radius change is defined by the parameter value.
Replacement of the selected faces of the solid with deformable faces (conversion to NURBS) for editing (dmm_ConvertFacesToNurbs).
Removal of the selected fillet faces of the solid (dmm_PurifyFillets).
Removal of the selected fillet faces together with all smoothly connected fillets (dmm_PurifyFilletsChains).
Removal of all fillets of the solid whose radius is less than a given value (dmm_PurifyFilletsBelowRadius).
Merging of edge vertices and removal of edges (dmm_DeleteEdges).
Replacement of smoothly joined faces with a single face (dmm_UniteFaces).
Rotation of the selected faces with adaptation of adjacent fillets (dmm_RotateFaces) or without it (dmm_RotateFacesNoFilletAdaptation). The rotation angle is defined by the parameter angle, the rotation axis is defined by the axis axis.
Replacement of the selected faces of the solid (dmm_ReplaceFaces).
Setting the radii of the selected fillet faces for a chain of smoothly joined fillets (dmm_FilletsRadiusSet) and setting the radii of the selected fillet faces (dmm_FilletsRadiusSetSingle). The new radius is defined by the parameter value.
The input parameters of the function are:
solid – the initial solid;
sameShell – the mode of copying of the initial solid;
params – the modification parameters.
The output parameter of the function is the modification results structure results, which contains the modified solid and additional information about the operation.
If successful, the function returns rt_Success; otherwise it returns an error code from the enumeration MbResultType (see mb_operation_result.h).
Possible error codes:
rt_Success – no errors;
rt_Error – unknown error;
rt_IncorrectData – incorrect data;
rt_ParameterError – wrong parameter.
The function is declared in the file action_direct.h.
When the object params with modification parameters is created, one of the following constructors is used (see op_direct_mod_parameter.h).
Constructors without a faces set
type – the modification type. The following types are available for this constructor: dmm_OffsetFaces, dmm_FilletsRadiusChange;
value – the offset distance for dmm_OffsetFaces or the radius change value for dmm_FilletsRadiusChange;
names – the name maker of the operation.
MbModifiedSolidParams( MbeModifyingMode type,
const MbSNameMaker & names,
double value );
type – the modification type. The following types are available for this constructor: dmm_RotateFaces, dmm_RotateFacesNoFilletAdaptation;
axis – the rotation axis;
angle – the rotation angle;
names – the name maker of the operation.
MbModifiedSolidParams( MbeModifyingMode type,
const MbSNameMaker & names,
const MbAxis3D & axis,
double angle );
type – the modification type. The following types are available for this constructor: dmm_MoveFacesByVector, dmm_MoveFacesByVectorNoAdaptation;
direction – the translation direction;
names – the name maker of the operation.
MbModifiedSolidParams( MbeModifyingMode type,
const MbSNameMaker & names,
const MbVector3D & direction );
Constructors with a faces set
modType – the modification type. The following types are available for this constructor: dmm_UniteFaces, dmm_Create, dmm_ConvertFacesToNurbs, dmm_PurifyFillets;
names – the name maker of the operation;
faces – the list of faces to be modified.
MbModifiedSolidParams( MbeModifyingMode modType,
const MbSNameMaker & names,
const c3d::ItemIndices & faces );
type – the modification type. The following types are available for this constructor: dmm_OffsetFaces, dmm_FilletsRadiusChange, dmm_RemoveBelowRadius, dmm_RemoveBelowRadiusWithAdjacentFillets, dmm_PurifyFilletsBelowRadius;
names – the name maker of the operation;
faces – the list of faces to be modified;
value – the offset distance for dmm_OffsetFaces, the radius change value for dmm_FilletsRadiusChange, the maximum radius value for dmm_Remove and dmm_Purify.
MbModifiedSolidParams( MbeModifyingMode type,
const MbSNameMaker & names,
const c3d::ItemIndices & faces,
double value )
: MbModifiedSolidParams( type, names, value )
{
AddFaces( faces );
}
type – the modification type. The following types are available for this constructor: dmm_RotateFaces, dmm_RotateFacesNoFilletAdaptation;
names – the name maker of the operation;
faces – the list of faces to be modified;
axis – the rotation axis;
angle – the rotation angle.
MbModifiedSolidParams( MbeModifyingMode type,
const MbSNameMaker & names,
const c3d::ItemIndices & faces,
const MbAxis3D & axis,
double angle )
: MbModifiedSolidParams( type, names, axis, angle )
{
AddFaces( faces );
}
type – the modification type. The following types are available for this constructor: dmm_MoveFacesByVector;
names – the name maker of the operation;
faces – the list of faces to be modified;
direction – the shift direction.
MbModifiedSolidParams( MbeModifyingMode type,
const MbSNameMaker & names,
const c3d::ItemIndices & faces,
const MbVector3D & direction )
: MbModifiedSolidParams( type, names, direction )
{
AddFaces( faces );
}
type – the modification type. The following types are available for this constructor: dmm_ConvertFacesToNurbs;
names – the name maker of the operation;
faces – the list of faces to be modified;
surfaces – the replacement surfaces (may be an empty array).
template<class SurfArray>
MbModifiedSolidParams( MbeModifyingMode type,
const MbSNameMaker & names,
const c3d::ItemIndices & faces,
const SurfArray & surfaces )
: MbModifiedSolidParams( type, names )
{
AddFaces( faces );
AddSurfaces( surfaces );
}
type – the modification type. The following types are available for this constructor: dmm_ReplaceFaces;
names – the name maker of the operation;
replacedFaces - the list of faces to be replaced;
replacementSurfaces – the list of replacement surfaces;
surfaceParts – the list of surface part numbers that are used when several replacement options are possible;
sameSurfaces – whether to use the source surfaces (true) or their copies (false);
offsets – the list of offsets from the replacement surfaces.
template<class SurfArray> MATH_FUNC_EX
MbModifiedSolidParams( MbeModifyingMode type,
const MbSNameMaker & names,
const c3d::ItemIndices & replacedFaces,
const SurfArray & replacementSurfaces,
bool sameSurfaces,
const c3d::NumbersVector & surfaceParts,
const c3d::DoubleVector & offsets );
modType – the modification type. The following types are available for this constructor: dmm_DeleteEdges;
names – the name maker of the operation;
edges – the list of edges to be modified;
beginOrEnd – the flag specifying whether the beginning or the end of the corresponding edge is to be deleted.
MbModifiedSolidParams( MbeModifyingMode modType,
const MbSNameMaker & names,
const c3d::EdgeFacesIndices & edges,
const c3d::BoolVector & beginOrEnd )
: MbModifiedSolidParams( modType, names )
{
AddEdges( edges, beginOrEnd );
}
The parameter solid contains the initial solid to be processed.
The parameter sameShell controls the data transfer from the initial solid solid to the constructed solid results and can take one of four values:
cm_Same = 0 (the solid is not copied);
cm_KeepHistory (the initial solid and its copy share base surfaces, vertices and faces that are not changed by the operation);
cm_KeepSurface (the initial solid and its copy share base surfaces);
cm_Copy (the initial solid and its copy do not share any data).
The enumeration MbeCopyMode is described in detail in Copying a Set of Faces.
The parameter params describes the modification parameters that are defined by the modification type and by additional parameters depending on the constructor used.
The modification type is defined by the parameter _modificationType, which can take one of the values of the enumeration MbeModifyingMode (see op_direct_mod_parameter.h).
For the modification types dmm_RemoveFaces and dmm_RemoveFacesWithAdjacentFillets the function removes the faces faces from a copy of the solid solid and, using the environment, processes the place of the removed faces while keeping the solid closed. If the faces faces are connected to the other faces by fillets, then in the dmm_RemoveFacesWithAdjacentFillets mode the adjacent fillet faces are automatically added to the set of faces to be removed.
For the modification types dmm_RemoveBelowRadius and dmm_RemoveBelowRadiusWithAdjacentFillets the function removes closed cylindrical, conical, toroidal, spherical faces as well as revolution and extrusion faces whose radius is less than or equal to the given radius value. In the dmm_RemoveBelowRadiusWithAdjacentFillets mode these faces are removed together with adjacent fillets. Such a setting allows to remove small through or blind holes automatically without explicitly listing all corresponding faces.
Fig. 1 shows an initial solid, and Fig. 2 shows the solid obtained by removing the specified faces of the initial solid:
Fig. 1
Fig. 2
The same result can be obtained by selecting all the specified faces together with the adjacent fillets and using the dmm_RemoveFaces type.
For the modification type dmm_Create the function creates a new solid from copies of the faces faces. If the faces faces are connected to other faces by fillets, the adjacent fillets are removed first and then a new solid is created from the faces faces. The new solid is closed because it contains both the original faces faces and faces constructed on the base surfaces that are adjacent to the faces faces. Additional faces are required to eliminate boundary edges.
Fig. 3 shows an initial solid, and Fig. 4 shows the solid constructed from the specified faces of the initial solid. The solid in Fig. 3 consists of five faces: three faces from the set faces and two faces based on the cylindrical surface that supported the two removed fillets:
Fig. 3
Fig. 4
For the modification types dmm_MoveFacesByVector and dmm_MoveFacesByVectorNoAdaptation the function translates the faces faces relative to the remaining faces in a copy of the solid solid. The translation is performed in the direction of the vector direction by a distance equal to its length. In the dmm_MoveFacesByVector mode the adjacent fillets are adapted; in the dmm_MoveFacesByVectorNoAdaptation mode the fillets are not rebuilt.
If the faces faces are connected to other faces by fillets, then in the mode with adaptation the fillets are removed first, then the faces faces are translated, and finally the fillets are restored in their new positions.
Fig. 5 and Fig. 6 present solids obtained by translating the specified faces of the initial solids shown in Fig. 1 and Fig. 3, respectively:
Fig. 5
Fig. 6
For the modification type dmm_OffsetFaces the function replaces the faces faces in a copy of the solid solid with offset faces. The offset faces are translated along the normal by a distance defined by the parameter value. If value is positive, the translation is performed towards the outer normals; if it is negative, the translation is performed in the opposite direction.
If the faces faces are connected to other faces by fillets, the fillets are removed first, then the faces faces are replaced with offset faces, and finally the fillets are restored in their new positions.
Fig. 7 and Fig. 8 present solids obtained by replacing the specified faces with offset faces. The initial solids are shown in Fig. 1 and Fig. 3, respectively:
Fig. 7
Fig. 8
If the parameter value is negative, the offset faces are translated by a negative distance. Fig. 9 and Fig. 10 present solids obtained by replacing the specified faces with offset faces with negative offset. The initial solids are shown in Fig. 5 and Fig. 6, respectively:
Fig. 9
Fig. 10
For the modification type dmm_FilletsRadiusChange the function changes the radii of the fillet faces faces in a copy of the solid solid. The radius of each fillet face is increased or decreased by the value defined by the parameter value.
A positive value of value increases the fillet radius, a negative value decreases it. At the same time, the solid remains closed and the continuity of connection with adjacent faces is preserved as far as possible for the given geometry.
Fig. 11 and Fig. 12 show solids obtained by changing the radius of the specified fillet faces. The initial solids are shown in Fig. 1 and Fig. 3, respectively:
Fig. 11
Fig. 12
For the modification type dmm_ConvertFacesToNurbs the function replaces the faces faces in a copy of the solid solid with deformable faces (NURBS-surfaces), which makes it possible to edit these faces by control points.
If the faces faces are connected to other faces by fillets, the adjacent fillets are removed first, then the faces faces are replaced with deformable faces based on the corresponding NURBS-surfaces, and finally the fillets are restored in their new positions.
In Fig. 13 an initial solid is shown, and in Fig. 14 the solid obtained by replacing the specified face of the initial solid with a deformable face is shown; the control points of the deformable face are also shown. The deformable face is constructed on the basis of a NURBS-surface:
Fig. 13
Fig. 14
Fig. 15 shows a deformable solid with moved control points of the deformable face. Fig. 16 presents the result of deforming the solid:
Fig. 15
Fig. 16
For the modification types dmm_PurifyFillets and dmm_PurifyFilletsChains the function removes the fillet faces faces in a copy of the solid solid and, using the environment, processes the place of the removed faces while keeping the solid closed. In the dmm_PurifyFilletsChains mode all fillets that are smoothly connected to the selected faces are additionally removed.
Fig. 17 and Fig. 18 present solids obtained by removing the specified fillet faces. The initial solids are shown in Fig. 1 and Fig. 3, respectively:
Fig. 17
Fig. 18
The function ModifiedSolid() operates under the condition that the topology of the edited solid remains unchanged.
The function ModifiedSolid() adds to the history of the constructed solid the builder MbFaceModifiedSolid, which contains all data required to perform the operation. The builder MbFaceModifiedSolid is declared in the file cr_modified_solid.h.
The test application test.exe constructs a modified solid by using the menu commands “Create → Solid → By direct editing”.