in double AngleInRadians,
in long NbOfSteps,
in double Tolerance);
+ /*!
+ * \brief Genarate dim+1 elements by rotation of the object around axis
+ * \param theObject - object containing elements to ratate
+ * \param Axix - rotation axis
+ * \param AngleInRadians - rotation angle
+ * \param NbOfSteps - number of elements to generate from one element
+ */
+ void RotationSweepObject1D(in SMESH_IDSource theObject,
+ in AxisStruct Axix,
+ in double AngleInRadians,
+ in long NbOfSteps,
+ in double Tolerance);
+ /*!
+ * \brief Same as previous but additionally create groups of elements
+ * generated from elements belonging to preexisting groups
+ */
+ ListOfGroups RotationSweepObject1DMakeGroups(in SMESH_IDSource theObject,
+ in AxisStruct Axix,
+ in double AngleInRadians,
+ in long NbOfSteps,
+ in double Tolerance);
+ /*!
+ * \brief Genarate dim+1 elements by rotation of the object around axis
+ * \param theObject - object containing elements to ratate
+ * \param Axix - rotation axis
+ * \param AngleInRadians - rotation angle
+ * \param NbOfSteps - number of elements to generate from one element
+ */
+ void RotationSweepObject2D(in SMESH_IDSource theObject,
+ in AxisStruct Axix,
+ in double AngleInRadians,
+ in long NbOfSteps,
+ in double Tolerance);
+ /*!
+ * \brief Same as previous but additionally create groups of elements
+ * generated from elements belonging to preexisting groups
+ */
+ ListOfGroups RotationSweepObject2DMakeGroups(in SMESH_IDSource theObject,
+ in AxisStruct Axix,
+ in double AngleInRadians,
+ in long NbOfSteps,
+ in double Tolerance);
/*!
* \brief Genarate dim+1 elements by extrusion of elements along vector
* \param IDsOfElements - elements to sweep
in PointStruct RefPoint,
out Extrusion_Error Error);
+ Extrusion_Error ExtrusionAlongPathObject1D(in SMESH_IDSource theObject,
+ in SMESH_Mesh PathMesh,
+ in GEOM::GEOM_Object PathShape,
+ in long NodeStart,
+ in boolean HasAngles,
+ in double_array Angles,
+ in boolean HasRefPoint,
+ in PointStruct RefPoint);
+ ListOfGroups ExtrusionAlongPathObject1DMakeGroups(in SMESH_IDSource theObject,
+ in SMESH_Mesh PathMesh,
+ in GEOM::GEOM_Object PathShape,
+ in long NodeStart,
+ in boolean HasAngles,
+ in double_array Angles,
+ in boolean HasRefPoint,
+ in PointStruct RefPoint,
+ out Extrusion_Error Error);
+
+ Extrusion_Error ExtrusionAlongPathObject2D(in SMESH_IDSource theObject,
+ in SMESH_Mesh PathMesh,
+ in GEOM::GEOM_Object PathShape,
+ in long NodeStart,
+ in boolean HasAngles,
+ in double_array Angles,
+ in boolean HasRefPoint,
+ in PointStruct RefPoint);
+ ListOfGroups ExtrusionAlongPathObject2DMakeGroups(in SMESH_IDSource theObject,
+ in SMESH_Mesh PathMesh,
+ in GEOM::GEOM_Object PathShape,
+ in long NodeStart,
+ in boolean HasAngles,
+ in double_array Angles,
+ in boolean HasRefPoint,
+ in PointStruct RefPoint,
+ out Extrusion_Error Error);
+
/*!
* Compute rotation angles for ExtrusionAlongPath as linear variation
* of given angles along path steps
SMESH::long_array_var anElementsId = new SMESH::long_array;
- if (MeshCheck->isChecked()) {
- // If "Select whole mesh, submesh or group" check box is on ->
- // get all elements of the required type from the object selected
-
- // if MESH object is selected
- if (!CORBA::is_nil(SMESH::SMESH_Mesh::_narrow(myIDSource))) {
- // get mesh
- SMESH::SMESH_Mesh_var aMesh = SMESH::SMESH_Mesh::_narrow(myIDSource);
- // get IDs from mesh...
- if (Elements1dRB->isChecked())
- // 1d elements
- anElementsId = aMesh->GetElementsByType(SMESH::EDGE);
- else if (Elements2dRB->isChecked()) {
- anElementsId = aMesh->GetElementsByType(SMESH::FACE);
- }
- }
- // SUBMESH is selected
- if (!CORBA::is_nil(SMESH::SMESH_subMesh::_narrow(myIDSource))) {
- // get submesh
- SMESH::SMESH_subMesh_var aSubMesh = SMESH::SMESH_subMesh::_narrow(myIDSource);
- // get IDs from submesh
- if (Elements1dRB->isChecked())
- // 1d elements
- anElementsId = aSubMesh->GetElementsByType(SMESH::EDGE);
- else if (Elements2dRB->isChecked())
- // 2d elements
- anElementsId = aSubMesh->GetElementsByType(SMESH::FACE);
- }
- // GROUP is selected
- if (!CORBA::is_nil(SMESH::SMESH_GroupBase::_narrow(myIDSource))) {
- // get smesh group
- SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow(myIDSource);
- // get IDs from group
- // 1d elements or 2d elements
- if (Elements1dRB->isChecked() && aGroup->GetType() == SMESH::EDGE ||
- Elements2dRB->isChecked() && aGroup->GetType() == SMESH::FACE)
- anElementsId = aGroup->GetListOfID();
- }
- } else {
+ if (!MeshCheck->isChecked()) {
// If "Select whole mesh, submesh or group" check box is off ->
// use only elements of given type selected by user
}
anElementsId->length(j);
}
- }
- if (anElementsId->length() <= 0) {
- return false;
+ if (anElementsId->length() <= 0) {
+ return false;
+ }
}
if (StartPointLineEdit->text().trimmed().isEmpty()) {
anAngles = aMeshEditor->LinearAnglesVariation( myPathMesh, myPathShape, anAngles );
SMESH::SMESH_MeshEditor::Extrusion_Error retVal;
- if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() )
- SMESH::ListOfGroups_var groups =
- aMeshEditor->ExtrusionAlongPathMakeGroups(anElementsId, myPathMesh,
- myPathShape, aNodeStart,
- AnglesGrp->isChecked(), anAngles,
- BasePointGrp->isChecked(), aBasePoint, retVal);
- else
- retVal = aMeshEditor->ExtrusionAlongPath(anElementsId, myPathMesh,
- myPathShape, aNodeStart,
- AnglesGrp->isChecked(), anAngles,
- BasePointGrp->isChecked(), aBasePoint);
+ if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() ) {
+ if( MeshCheck->isChecked() ) {
+ if( GetConstructorId() == 0 )
+ SMESH::ListOfGroups_var groups =
+ aMeshEditor->ExtrusionAlongPathObject1DMakeGroups(myIDSource, myPathMesh,
+ myPathShape, aNodeStart,
+ AnglesGrp->isChecked(), anAngles,
+ BasePointGrp->isChecked(), aBasePoint, retVal);
+ else
+ SMESH::ListOfGroups_var groups =
+ aMeshEditor->ExtrusionAlongPathObject2DMakeGroups(myIDSource, myPathMesh,
+ myPathShape, aNodeStart,
+ AnglesGrp->isChecked(), anAngles,
+ BasePointGrp->isChecked(), aBasePoint, retVal);
+ }
+ else
+ SMESH::ListOfGroups_var groups =
+ aMeshEditor->ExtrusionAlongPathMakeGroups(anElementsId, myPathMesh,
+ myPathShape, aNodeStart,
+ AnglesGrp->isChecked(), anAngles,
+ BasePointGrp->isChecked(), aBasePoint, retVal);
+ }
+ else {
+ if( MeshCheck->isChecked() ) {
+ if( GetConstructorId() == 0 )
+ retVal = aMeshEditor->ExtrusionAlongPathObject1D(myIDSource, myPathMesh,
+ myPathShape, aNodeStart,
+ AnglesGrp->isChecked(), anAngles,
+ BasePointGrp->isChecked(), aBasePoint);
+ else
+ retVal = aMeshEditor->ExtrusionAlongPathObject2D(myIDSource, myPathMesh,
+ myPathShape, aNodeStart,
+ AnglesGrp->isChecked(), anAngles,
+ BasePointGrp->isChecked(), aBasePoint);
+ }
+ else
+ retVal = aMeshEditor->ExtrusionAlongPath(anElementsId, myPathMesh,
+ myPathShape, aNodeStart,
+ AnglesGrp->isChecked(), anAngles,
+ BasePointGrp->isChecked(), aBasePoint);
+ }
if( retVal == SMESH::SMESH_MeshEditor::EXTR_OK )
myMesh->SetParameters( SMESHGUI::JoinObjectParameters(aParameters) );
SMESHGUI_ExtrusionDlg::SMESHGUI_ExtrusionDlg (SMESHGUI* theModule)
: QDialog( SMESH::GetDesktop( theModule ) ),
mySMESHGUI( theModule ),
- mySelectionMgr( SMESH::GetSelectionMgr( theModule ) )
+ mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
+ mySelectedObject(SMESH::SMESH_IDSource::_nil())
{
QPixmap image0 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_DLG_EDGE")));
QPixmap image1 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_DLG_TRIANGLE")));
SUIT_OverrideCursor aWaitCursor;
SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
- if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() )
- SMESH::ListOfGroups_var groups =
- aMeshEditor->ExtrusionSweepMakeGroups(myElementsId.inout(), aVector, aNbSteps);
- else
- aMeshEditor->ExtrusionSweep(myElementsId.inout(), aVector, aNbSteps);
+ if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() ) {
+ if( CheckBoxMesh->isChecked() ) {
+ if( GetConstructorId() == 0 )
+ SMESH::ListOfGroups_var groups =
+ aMeshEditor->ExtrusionSweepObject1DMakeGroups(mySelectedObject, aVector, aNbSteps);
+ else
+ SMESH::ListOfGroups_var groups =
+ aMeshEditor->ExtrusionSweepObject2DMakeGroups(mySelectedObject, aVector, aNbSteps);
+ }
+ else
+ SMESH::ListOfGroups_var groups =
+ aMeshEditor->ExtrusionSweepMakeGroups(myElementsId.inout(), aVector, aNbSteps);
+ }
+ else {
+ if( CheckBoxMesh->isChecked() ) {
+ if( GetConstructorId() == 0 )
+ aMeshEditor->ExtrusionSweepObject1D(mySelectedObject, aVector, aNbSteps);
+ else
+ aMeshEditor->ExtrusionSweepObject2D(mySelectedObject, aVector, aNbSteps);
+ }
+ else
+ aMeshEditor->ExtrusionSweep(myElementsId.inout(), aVector, aNbSteps);
+ }
myMesh->SetParameters( SMESHGUI::JoinObjectParameters(aParameters) );
mySMESHGUI->updateObjBrowser(true); // new groups may appear
Init(false);
ConstructorsClicked(GetConstructorId());
+ mySelectedObject = SMESH::SMESH_IDSource::_nil();
SelectionIntoArgument();
}
return true;
}
if (CheckBoxMesh->isChecked()) {
- SMESH::ElementType neededType = GetConstructorId() ? SMESH::FACE : SMESH::EDGE;
-
SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aString);
- SMESH::SMESH_Mesh_var mesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IO);
-
- if (!mesh->_is_nil()) { //MESH
- // get elements from mesh
- myElementsId = mesh->GetElementsByType(neededType);
- aNbElements = myElementsId->length();
- } else {
- SMESH::SMESH_subMesh_var aSubMesh =
- SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO);
-
- if (!aSubMesh->_is_nil()) { //SUBMESH
- // get IDs from submesh
- myElementsId = aSubMesh->GetElementsByType(neededType);
- aNbElements = myElementsId->length();
- } else {
- SMESH::SMESH_GroupBase_var aGroup =
- SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(IO);
-
- if (!aGroup->_is_nil() && aGroup->GetType() == neededType) { // GROUP
- // get IDs from smesh group
- myElementsId = aGroup->GetListOfID();
- aNbElements = myElementsId->length();
- }
- }
- }
+ if (!SMESH::IObjectToInterface<SMESH::SMESH_IDSource>(IO)->_is_nil())
+ mySelectedObject = SMESH::IObjectToInterface<SMESH::SMESH_IDSource>(IO);
+ else
+ return;
} else {
// get indices of selcted elements
TColStd_IndexedMapOfInteger aMapIndex;
mySelector->GetIndex(IO,aMapIndex);
aNbElements = aMapIndex.Extent();
+ if (aNbElements < 1)
+ return;
+
myElementsId = new SMESH::long_array;
myElementsId->length( aNbElements );
aString = "";
aString += QString(" %1").arg( myElementsId[ i ] = aMapIndex( i+1 ) );
}
- if (aNbElements < 1)
- return;
-
myNbOkElements = true;
}
int myNbOkElements; /* to check when elements are defined */
SVTK_Selector* mySelector;
+ SMESH::SMESH_IDSource_var mySelectedObject;
+
bool myBusy;
SMESH::SMESH_Mesh_var myMesh;
SMESH::long_array_var myElementsId;
SMESHGUI_RevolutionDlg::SMESHGUI_RevolutionDlg( SMESHGUI* theModule )
: QDialog( SMESH::GetDesktop( theModule ) ),
mySMESHGUI( theModule ),
- mySelectionMgr( SMESH::GetSelectionMgr( theModule ) )
+ mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
+ mySelectedObject(SMESH::SMESH_IDSource::_nil())
{
mySimulation = new SMESHGUI_MeshEditPreview(SMESH::GetViewWindow( mySMESHGUI ));
SUIT_OverrideCursor aWaitCursor;
SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
- if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() )
- SMESH::ListOfGroups_var groups =
- aMeshEditor->RotationSweepMakeGroups(anElementsId.inout(), anAxis,
- anAngle, aNbSteps, aTolerance);
- else
+ if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() ) {
+ if( CheckBoxMesh->isChecked() ) {
+ if( GetConstructorId() == 0 )
+ SMESH::ListOfGroups_var groups =
+ aMeshEditor->RotationSweepObject1DMakeGroups(mySelectedObject, anAxis,
+ anAngle, aNbSteps, aTolerance);
+ else
+ SMESH::ListOfGroups_var groups =
+ aMeshEditor->RotationSweepObject2DMakeGroups(mySelectedObject, anAxis,
+ anAngle, aNbSteps, aTolerance);
+ }
+ else
+ SMESH::ListOfGroups_var groups =
+ aMeshEditor->RotationSweepMakeGroups(anElementsId.inout(), anAxis,
+ anAngle, aNbSteps, aTolerance);
+ }
+ else {
+ if( CheckBoxMesh->isChecked() ) {
+ if( GetConstructorId() == 0 )
+ aMeshEditor->RotationSweepObject1D(mySelectedObject, anAxis, anAngle, aNbSteps, aTolerance);
+ else
+ aMeshEditor->RotationSweepObject2D(mySelectedObject, anAxis, anAngle, aNbSteps, aTolerance);
+ }
aMeshEditor->RotationSweep(anElementsId.inout(), anAxis, anAngle, aNbSteps, aTolerance);
+ }
myMesh->SetParameters( SMESHGUI::JoinObjectParameters(aParameters) );
} catch (...) {
mySMESHGUI->updateObjBrowser(true); // new groups may appear
Init(false);
ConstructorsClicked(GetConstructorId());
+ mySelectedObject = SMESH::SMESH_IDSource::_nil();
SelectionIntoArgument();
}
}
if (CheckBoxMesh->isChecked()) {
- int aConstructorId = GetConstructorId();
-
SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aString);
- if (!SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IO)->_is_nil()) { //MESH
- // get IDs from mesh
- SMDS_Mesh* aSMDSMesh = myActor->GetObject()->GetMesh();
- if (!aSMDSMesh)
- return;
-
- if (aConstructorId == 0) {
- SMDS_EdgeIteratorPtr anIter = aSMDSMesh->edgesIterator();
-
- while (anIter->more()) {
- const SMDS_MeshEdge * edge = anIter->next();
- if (edge) {
- myElementsId += QString(" %1").arg(edge->GetID());
- aNbUnits++;
- }
- }
- } else if (aConstructorId == 1) {
- SMDS_FaceIteratorPtr anIter = aSMDSMesh->facesIterator();
- while (anIter->more()) {
- const SMDS_MeshFace * face = anIter->next();
- if (face) {
- myElementsId += QString(" %1").arg(face->GetID());
- aNbUnits++;
- }
- }
- }
- } else if (!SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO)->_is_nil()) { //SUBMESH
- // get submesh
- SMESH::SMESH_subMesh_var aSubMesh = SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO);
-
- // get IDs from submesh
- SMESH::long_array_var anElementsIds = new SMESH::long_array;
- if (aConstructorId == 0)
- anElementsIds = aSubMesh->GetElementsByType(SMESH::EDGE);
- else if (aConstructorId == 1)
- anElementsIds = aSubMesh->GetElementsByType(SMESH::FACE);
-
- for (int i = 0; i < anElementsIds->length(); i++)
- myElementsId += QString(" %1").arg(anElementsIds[i]);
- aNbUnits = anElementsIds->length();
- } else { // GROUP
- // get smesh group
- SMESH::SMESH_GroupBase_var aGroup =
- SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(IO);
- if (aGroup->_is_nil())
- return;
-
- if ((aConstructorId == 0 && aGroup->GetType()!= SMESH::EDGE) ||
- (aConstructorId == 1 && aGroup->GetType()!= SMESH::FACE))
- return;
-
- // get IDs from smesh group
- SMESH::long_array_var anElementsIds = new SMESH::long_array;
- anElementsIds = aGroup->GetListOfID();
- for (int i = 0; i < anElementsIds->length(); i++) {
- myElementsId += QString(" %1").arg(anElementsIds[i]);
- }
- aNbUnits = anElementsIds->length();
- }
+ if (!SMESH::IObjectToInterface<SMESH::SMESH_IDSource>(IO)->_is_nil())
+ mySelectedObject = SMESH::IObjectToInterface<SMESH::SMESH_IDSource>(IO);
+ else
+ return;
} else {
aNbUnits = SMESH::GetNameOfSelectedElements(mySelector, IO, aString);
myElementsId = aString;
+ if (aNbUnits < 1)
+ return;
}
-
- if (aNbUnits < 1)
- return;
-
myNbOkElements = true;
} else {
aNbUnits = SMESH::GetNameOfSelectedNodes(mySelector, IO, aString);
try {
SUIT_OverrideCursor aWaitCursor;
SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditPreviewer();
- aMeshEditor->RotationSweep(anElementsId.inout(),
- anAxis,
- anAngle,
- aNbSteps,
- aTolerance);
+ if( CheckBoxMesh->isChecked() ) {
+ if( GetConstructorId() == 0 )
+ aMeshEditor->RotationSweepObject1D(mySelectedObject, anAxis,
+ anAngle, aNbSteps, aTolerance);
+ else
+ aMeshEditor->RotationSweepObject2D(mySelectedObject, anAxis,
+ anAngle, aNbSteps, aTolerance);
+ }
+ else
+ aMeshEditor->RotationSweep(anElementsId.inout(),
+ anAxis,
+ anAngle,
+ aNbSteps,
+ aTolerance);
SMESH::MeshPreviewStruct_var aMeshPreviewStruct = aMeshEditor->GetPreviewData();
mySimulation->SetData(aMeshPreviewStruct._retn());
} catch (...) {}
QWidget* myEditCurrentArgument; /* Current argument */
SVTK_Selector* mySelector;
+ SMESH::SMESH_IDSource_var mySelectedObject;
+
bool myBusy;
SMESH::SMESH_Mesh_var myMesh;
SMESH_Actor* myActor;
SMESHGUI_SmoothingDlg::SMESHGUI_SmoothingDlg( SMESHGUI* theModule )
: QDialog( SMESH::GetDesktop( theModule ) ),
mySMESHGUI( theModule ),
- mySelectionMgr( SMESH::GetSelectionMgr( theModule ) )
+ mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
+ mySelectedObject(SMESH::SMESH_IDSource::_nil())
{
QPixmap image0 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_DLG_SMOOTHING")));
QPixmap image1 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT")));
SUIT_OverrideCursor aWaitCursor;
SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
- if ( CheckBoxParametric->isChecked() )
- aResult = aMeshEditor->SmoothParametric(anElementsId.inout(), aNodesId.inout(),
- anIterationLimit, aMaxAspectRatio, aMethod);
- else
- aResult = aMeshEditor->Smooth(anElementsId.inout(), aNodesId.inout(),
- anIterationLimit, aMaxAspectRatio, aMethod);
+ if ( CheckBoxParametric->isChecked() ) {
+ if(CheckBoxMesh->isChecked())
+ aResult = aMeshEditor->SmoothParametricObject(mySelectedObject, aNodesId.inout(),
+ anIterationLimit, aMaxAspectRatio, aMethod);
+ else
+ aResult = aMeshEditor->SmoothParametric(anElementsId.inout(), aNodesId.inout(),
+ anIterationLimit, aMaxAspectRatio, aMethod);
+ }
+ else {
+ if(CheckBoxMesh->isChecked())
+ aResult = aMeshEditor->SmoothObject(mySelectedObject, aNodesId.inout(),
+ anIterationLimit, aMaxAspectRatio, aMethod);
+ else
+ aResult = aMeshEditor->Smooth(anElementsId.inout(), aNodesId.inout(),
+ anIterationLimit, aMaxAspectRatio, aMethod);
+ }
myMesh->SetParameters( SMESHGUI::JoinObjectParameters(aParameters) );
mySelectionMgr->setSelectedObjects(aList, false);
SMESH::UpdateView();
Init();
+
+ mySelectedObject = SMESH::SMESH_IDSource::_nil();
}
}
if (CheckBoxMesh->isChecked()) {
SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aString);
- if (!SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IO)->_is_nil()) { //MESH
- // get IDs from mesh
- SMDS_Mesh* aSMDSMesh = myActor->GetObject()->GetMesh();
- if (!aSMDSMesh)
- return;
-
- for (int i = aSMDSMesh->MinElementID(); i <= aSMDSMesh->MaxElementID(); i++ ) {
- const SMDS_MeshElement * e = aSMDSMesh->FindElement(i);
- if (e) {
- myElementsId += QString(" %1").arg(i);
- aNbUnits++;
- }
- }
- } else if (!SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO)->_is_nil()) { //SUBMESH
- // get submesh
- SMESH::SMESH_subMesh_var aSubMesh = SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO);
-
- // get IDs from submesh
- SMESH::long_array_var anElementsIds = new SMESH::long_array;
- anElementsIds = aSubMesh->GetElementsId();
- for (int i = 0; i < anElementsIds->length(); i++) {
- myElementsId += QString(" %1").arg(anElementsIds[i]);
- }
- aNbUnits = anElementsIds->length();
- } else { // GROUP
- // get smesh group
- SMESH::SMESH_GroupBase_var aGroup =
- SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(IO);
- if (aGroup->_is_nil())
- return;
-
- // get IDs from smesh group
- SMESH::long_array_var anElementsIds = new SMESH::long_array;
- anElementsIds = aGroup->GetListOfID();
- for (int i = 0; i < anElementsIds->length(); i++) {
- myElementsId += QString(" %1").arg(anElementsIds[i]);
- }
- aNbUnits = anElementsIds->length();
- }
+ if (!SMESH::IObjectToInterface<SMESH::SMESH_IDSource>(IO)->_is_nil())
+ mySelectedObject = SMESH::IObjectToInterface<SMESH::SMESH_IDSource>(IO);
+ else
+ return;
} else {
aNbUnits = SMESH::GetNameOfSelectedElements(mySelector, IO, aString);
myElementsId = aString;
+ if (aNbUnits < 1)
+ return;
}
} else if (myEditCurrentArgument == LineEditNodes && !myMesh->_is_nil() && myActor) {
myNbOkNodes = 0;
} else {
}
- if (aNbUnits < 1)
- return;
-
myBusy = true;
myEditCurrentArgument->setText(aString);
myBusy = false;
QLineEdit* myEditCurrentArgument; /* Current LineEdit */
SVTK_Selector* mySelector;
+ SMESH::SMESH_IDSource_var mySelectedObject;
+
bool myBusy;
SMESH::SMESH_Mesh_var myMesh;
SMESH_Actor* myActor;
map< _pyID, Handle(_pyMeshEditor) >::iterator id_editor = myMeshEditors.find( objID );
if ( id_editor != myMeshEditors.end() ) {
id_editor->second->Process( aCommand );
+ TCollection_AsciiString processedCommand = aCommand->GetString();
+ // some commands of SMESH_MeshEditor create meshes
+ if ( aCommand->GetMethod().Search("MakeMesh") != -1 ) {
+ Handle(_pyMesh) mesh = new _pyMesh( aCommand, aCommand->GetResultValue() );
+ aCommand->GetString() = processedCommand; // discard changes made by _pyMesh
+ myMeshes.insert( make_pair( mesh->GetID(), mesh ));
+ }
return aCommand;
}
// SMESH_Hypothesis method?
// CreateHypothesis( theHypType, theLibName )
// Compute( mesh, geom )
// mesh creation
- if ( theCommand->GetMethod() == "CreateMesh" ||
- theCommand->GetMethod() == "CreateEmptyMesh" ||
- theCommand->GetMethod() == "CreateMeshesFromUNV" ||
- theCommand->GetMethod() == "CreateMeshesFromSTL")
+ TCollection_AsciiString method = theCommand->GetMethod();
+ if ( method == "CreateMesh" || method == "CreateEmptyMesh")
{
Handle(_pyMesh) mesh = new _pyMesh( theCommand );
myMeshes.insert( make_pair( mesh->GetID(), mesh ));
return;
}
-
- if(theCommand->GetMethod() == "CreateMeshesFromMED")
+ if ( method == "CreateMeshesFromUNV" || method == "CreateMeshesFromSTL")
+ {
+ Handle(_pyMesh) mesh = new _pyMesh( theCommand, theCommand->GetResultValue() );
+ myMeshes.insert( make_pair( mesh->GetID(), mesh ));
+ return;
+ }
+ if( method == "CreateMeshesFromMED")
{
for(int ind = 0;ind<theCommand->GetNbResultValues();ind++)
{
}
// CreateHypothesis()
- if ( theCommand->GetMethod() == "CreateHypothesis" )
+ if ( method == "CreateHypothesis" )
{
myHypos.push_back( _pyHypothesis::NewHypothesis( theCommand ));
return;
}
// smeshgen.Compute( mesh, geom ) --> mesh.Compute()
- if ( theCommand->GetMethod() == "Compute" )
+ if ( method == "Compute" )
{
const _pyID& meshID = theCommand->GetArg( 1 );
map< _pyID, Handle(_pyMesh) >::iterator id_mesh = myMeshes.find( meshID );
}
// leave only one smeshgen.GetPattern() in the script
- if ( theCommand->GetMethod() == "GetPattern" ) {
+ if ( method == "GetPattern" ) {
if ( myHasPattern ) {
theCommand->Clear();
return;
}
// Concatenate( [mesh1, ...], ... )
- if ( theCommand->GetMethod() == "Concatenate" ||
- theCommand->GetMethod() == "ConcatenateWithGroups")
+ if ( method == "Concatenate" || method == "ConcatenateWithGroups")
{
+ if ( method == "ConcatenateWithGroups" ) {
+ theCommand->SetMethod( "Concatenate" );
+ theCommand->SetArg( theCommand->GetNbArgs() + 1, "True" );
+ }
+ Handle(_pyMesh) mesh = new _pyMesh( theCommand, theCommand->GetResultValue() );
+ myMeshes.insert( make_pair( mesh->GetID(), mesh ));
AddMeshAccessorMethod( theCommand );
}
*/
//================================================================================
-_pyMesh::_pyMesh(const Handle(_pyCommand) theCreationCmd):
- _pyObject(theCreationCmd), myHasEditor(false)
+_pyMesh::_pyMesh(const Handle(_pyCommand) theCreationCmd)
+ : _pyObject(theCreationCmd), myHasEditor(false)
{
// convert my creation command
Handle(_pyCommand) creationCmd = GetCreationCmd();
- TCollection_AsciiString str = creationCmd->GetMethod();
-
+ //TCollection_AsciiString str = creationCmd->GetMethod();
+// if(str != "CreateMeshesFromUNV" &&
+// str != "CreateMeshesFromMED" &&
+// str != "CreateMeshesFromSTL")
creationCmd->SetObject( SMESH_2smeshpy::SmeshpyName() );
- if(str != "CreateMeshesFromUNV" &&
- str != "CreateMeshesFromMED" &&
- str != "CreateMeshesFromSTL")
- creationCmd->SetMethod( "Mesh" );
+ creationCmd->SetMethod( "Mesh" );
theGen->SetAccessorMethod( GetID(), "GetMesh()" );
}
"InverseDiag","DeleteDiag","Reorient","ReorientObject","TriToQuad","SplitQuad","SplitQuadObject",
"BestSplit","Smooth","SmoothObject","SmoothParametric","SmoothParametricObject",
"ConvertToQuadratic","ConvertFromQuadratic","RenumberNodes","RenumberElements",
- "RotationSweep","RotationSweepObject","ExtrusionSweep","AdvancedExtrusion",
- "ExtrusionSweepObject","ExtrusionSweepObject1D","ExtrusionSweepObject2D","ExtrusionAlongPath",
+ "RotationSweep","RotationSweepObject","RotationSweepObject1D","RotationSweepObject2D",
+ "ExtrusionSweep","AdvancedExtrusion","ExtrusionSweepObject","ExtrusionSweepObject1D","ExtrusionSweepObject2D",
+ "ExtrusionAlongPath","ExtrusionAlongPathObject","ExtrusionAlongPathObject1D","ExtrusionAlongPathObject2D",
"Mirror","MirrorObject","Translate","TranslateObject","Rotate","RotateObject",
"FindCoincidentNodes","FindCoincidentNodesOnPart","MergeNodes","FindEqualElements",
"MergeElements","MergeEqualElements","SewFreeBorders","SewConformFreeBorders",
// meshes made by *MakeMesh() methods are not wrapped by _pyMesh,
// so let _pyMesh care of it (TMP?)
- if ( theCommand->GetMethod().Search("MakeMesh") != -1 )
- _pyMesh( new _pyCommand( theCommand->GetString(), 0 )); // for theGen->SetAccessorMethod()
+// if ( theCommand->GetMethod().Search("MakeMesh") != -1 )
+// _pyMesh( new _pyCommand( theCommand->GetString(), 0 )); // for theGen->SetAccessorMethod()
}
else {
{
// beginning
int begPos = GetBegPos( RESULT_IND ) + myRes.Length();
- if ( begPos < 1 )
+ if ( begPos < 1 ) {
begPos = myString.Location( "=", 1, Length() ) + 1;
+ // is '=' in the string argument (for example, name) or not
+ int nb1 = 0; // number of ' character at the left of =
+ int nb2 = 0; // number of " character at the left of =
+ for ( int i = 1; i < begPos-1; i++ ) {
+ if ( IsEqual(myString.Value( i ), "'" ) )
+ nb1 += 1;
+ else if ( IsEqual( myString.Value( i ), '"' ) )
+ nb2 += 1;
+ }
+ // if number of ' or " is not divisible by 2,
+ // then get an object at the start of the command
+ if ( nb1 % 2 != 0 || nb2 % 2 != 0 )
+ begPos = 1;
+ }
// store
myObj = GetWord( myString, begPos, true );
SetBegPos( OBJECT_IND, begPos );
CORBA::Double theAngleInRadians,
CORBA::Long theNbOfSteps,
CORBA::Double theTolerance,
- const bool theMakeGroups)
+ const bool theMakeGroups,
+ const SMDSAbs_ElementType theElementType)
{
initData();
TIDSortedElemSet inElements, copyElements;
- arrayToSet(theIDsOfElements, GetMeshDS(), inElements);
+ arrayToSet(theIDsOfElements, GetMeshDS(), inElements, theElementType);
TIDSortedElemSet* workElements = & inElements;
TPreviewMesh tmpMesh( SMDSAbs_Face );
CORBA::Double theTolerance)
{
if ( !myPreviewMode ) {
- TPythonDump() << "axis = " << theAxis;
TPythonDump() << this << ".RotationSweepObject( "
- << theObject
- << ", axis, "
+ << theObject << ", "
+ << theAxis << ", "
<< theAngleInRadians << ", "
<< theNbOfSteps << ", "
<< theTolerance << " )";
false);
}
+//=======================================================================
+//function : RotationSweepObject1D
+//purpose :
+//=======================================================================
+
+void SMESH_MeshEditor_i::RotationSweepObject1D(SMESH::SMESH_IDSource_ptr theObject,
+ const SMESH::AxisStruct & theAxis,
+ CORBA::Double theAngleInRadians,
+ CORBA::Long theNbOfSteps,
+ CORBA::Double theTolerance)
+{
+ if ( !myPreviewMode ) {
+ TPythonDump() << this << ".RotationSweepObject1D( "
+ << theObject << ", "
+ << theAxis << ", "
+ << theAngleInRadians << ", "
+ << theNbOfSteps << ", "
+ << theTolerance << " )";
+ }
+ SMESH::long_array_var anElementsId = theObject->GetIDs();
+ rotationSweep(anElementsId,
+ theAxis,
+ theAngleInRadians,
+ theNbOfSteps,
+ theTolerance,
+ false,
+ SMDSAbs_Edge);
+}
+
+//=======================================================================
+//function : RotationSweepObject2D
+//purpose :
+//=======================================================================
+
+void SMESH_MeshEditor_i::RotationSweepObject2D(SMESH::SMESH_IDSource_ptr theObject,
+ const SMESH::AxisStruct & theAxis,
+ CORBA::Double theAngleInRadians,
+ CORBA::Long theNbOfSteps,
+ CORBA::Double theTolerance)
+{
+ if ( !myPreviewMode ) {
+ TPythonDump() << this << ".RotationSweepObject2D( "
+ << theObject << ", "
+ << theAxis << ", "
+ << theAngleInRadians << ", "
+ << theNbOfSteps << ", "
+ << theTolerance << " )";
+ }
+ SMESH::long_array_var anElementsId = theObject->GetIDs();
+ rotationSweep(anElementsId,
+ theAxis,
+ theAngleInRadians,
+ theNbOfSteps,
+ theTolerance,
+ false,
+ SMDSAbs_Face);
+}
+
//=======================================================================
//function : RotationSweepObjectMakeGroups
//purpose :
theTolerance,
true);
if ( !myPreviewMode ) {
- TPythonDump() << "axis = " << theAxis;
TPythonDump aPythonDump;
DumpGroupsList(aPythonDump,aGroups);
aPythonDump<< this << ".RotationSweepObjectMakeGroups( "
- << theObject
- << ", axis, "
+ << theObject << ", "
+ << theAxis << ", "
+ << theAngleInRadians << ", "
+ << theNbOfSteps << ", "
+ << theTolerance << " )";
+ }
+ return aGroups;
+}
+
+//=======================================================================
+//function : RotationSweepObject1DMakeGroups
+//purpose :
+//=======================================================================
+
+SMESH::ListOfGroups*
+SMESH_MeshEditor_i::RotationSweepObject1DMakeGroups(SMESH::SMESH_IDSource_ptr theObject,
+ const SMESH::AxisStruct& theAxis,
+ CORBA::Double theAngleInRadians,
+ CORBA::Long theNbOfSteps,
+ CORBA::Double theTolerance)
+{
+ SMESH::long_array_var anElementsId = theObject->GetIDs();
+ SMESH::ListOfGroups *aGroups = rotationSweep(anElementsId,
+ theAxis,
+ theAngleInRadians,
+ theNbOfSteps,
+ theTolerance,
+ true,
+ SMDSAbs_Edge);
+ if ( !myPreviewMode ) {
+ TPythonDump aPythonDump;
+ DumpGroupsList(aPythonDump,aGroups);
+ aPythonDump<< this << ".RotationSweepObject1DMakeGroups( "
+ << theObject << ", "
+ << theAxis << ", "
+ << theAngleInRadians << ", "
+ << theNbOfSteps << ", "
+ << theTolerance << " )";
+ }
+ return aGroups;
+}
+
+//=======================================================================
+//function : RotationSweepObject2DMakeGroups
+//purpose :
+//=======================================================================
+
+SMESH::ListOfGroups*
+SMESH_MeshEditor_i::RotationSweepObject2DMakeGroups(SMESH::SMESH_IDSource_ptr theObject,
+ const SMESH::AxisStruct& theAxis,
+ CORBA::Double theAngleInRadians,
+ CORBA::Long theNbOfSteps,
+ CORBA::Double theTolerance)
+{
+ SMESH::long_array_var anElementsId = theObject->GetIDs();
+ SMESH::ListOfGroups *aGroups = rotationSweep(anElementsId,
+ theAxis,
+ theAngleInRadians,
+ theNbOfSteps,
+ theTolerance,
+ true,
+ SMDSAbs_Face);
+ if ( !myPreviewMode ) {
+ TPythonDump aPythonDump;
+ DumpGroupsList(aPythonDump,aGroups);
+ aPythonDump<< this << ".RotationSweepObject2DMakeGroups( "
+ << theObject << ", "
+ << theAxis << ", "
<< theAngleInRadians << ", "
<< theNbOfSteps << ", "
<< theTolerance << " )";
SMESH::long_array_var anElementsId = theObject->GetIDs();
extrusionSweep (anElementsId, theStepVector, theNbOfSteps, false );
if ( !myPreviewMode ) {
- TPythonDump() << "stepVector = " << theStepVector;
TPythonDump() << this << ".ExtrusionSweepObject( "
- << theObject << ", stepVector, " << theNbOfSteps << " )";
+ << theObject << ", " << theStepVector << ", " << theNbOfSteps << " )";
}
}
SMESH::long_array_var anElementsId = theObject->GetIDs();
extrusionSweep (anElementsId, theStepVector, theNbOfSteps, false, SMDSAbs_Edge );
if ( !myPreviewMode ) {
- TPythonDump() << "stepVector = " << theStepVector;
TPythonDump() << this << ".ExtrusionSweepObject1D( "
- << theObject << ", stepVector, " << theNbOfSteps << " )";
+ << theObject << ", " << theStepVector << ", " << theNbOfSteps << " )";
}
}
SMESH::long_array_var anElementsId = theObject->GetIDs();
extrusionSweep (anElementsId, theStepVector, theNbOfSteps, false, SMDSAbs_Face );
if ( !myPreviewMode ) {
- TPythonDump() << "stepVector = " << theStepVector;
TPythonDump() << this << ".ExtrusionSweepObject2D( "
- << theObject << ", stepVector, " << theNbOfSteps << " )";
+ << theObject << ", " << theStepVector << ", " << theNbOfSteps << " )";
}
}
SMESH::ListOfGroups * aGroups = extrusionSweep (anElementsId, theStepVector, theNbOfSteps, true );
if ( !myPreviewMode ) {
- TPythonDump() << "stepVector = " << theStepVector;
TPythonDump aPythonDump;
DumpGroupsList(aPythonDump,aGroups);
aPythonDump<< this << ".ExtrusionSweepObjectMakeGroups( "
- << theObject << ", stepVector, " << theNbOfSteps << " )";
+ << theObject << ", " << theStepVector << ", " << theNbOfSteps << " )";
}
return aGroups;
}
SMESH::long_array_var anElementsId = theObject->GetIDs();
SMESH::ListOfGroups * aGroups = extrusionSweep (anElementsId, theStepVector, theNbOfSteps, true, SMDSAbs_Edge );
if ( !myPreviewMode ) {
- TPythonDump() << "stepVector = " << theStepVector;
TPythonDump aPythonDump;
DumpGroupsList(aPythonDump,aGroups);
aPythonDump << this << ".ExtrusionSweepObject1DMakeGroups( "
- << theObject << ", stepVector, " << theNbOfSteps << " )";
+ << theObject << ", " << theStepVector << ", " << theNbOfSteps << " )";
}
return aGroups;
}
SMESH::long_array_var anElementsId = theObject->GetIDs();
SMESH::ListOfGroups * aGroups = extrusionSweep (anElementsId, theStepVector, theNbOfSteps, true, SMDSAbs_Face );
if ( !myPreviewMode ) {
- TPythonDump() << "stepVector = " << theStepVector;
TPythonDump aPythonDump;
DumpGroupsList(aPythonDump,aGroups);
aPythonDump << this << ".ExtrusionSweepObject2DMakeGroups( "
- << theObject << ", stepVector, " << theNbOfSteps << " )";
+ << theObject << ", " << theStepVector << ", " << theNbOfSteps << " )";
}
return aGroups;
}
CORBA::Boolean theHasRefPoint,
const SMESH::PointStruct & theRefPoint,
const bool theMakeGroups,
- SMESH::SMESH_MeshEditor::Extrusion_Error & theError)
+ SMESH::SMESH_MeshEditor::Extrusion_Error & theError,
+ const SMDSAbs_ElementType theElementType)
{
initData();
}
TIDSortedElemSet elements;
- arrayToSet(theIDsOfElements, GetMeshDS(), elements);
+ arrayToSet(theIDsOfElements, GetMeshDS(), elements, theElementType);
list<double> angles;
for (int i = 0; i < theAngles.length(); i++) {
const SMESH::PointStruct & theRefPoint)
{
if ( !myPreviewMode ) {
- TPythonDump() << "rotAngles = " << theAngles;
-
- if ( theHasRefPoint )
- TPythonDump() << "refPoint = SMESH.PointStruct( "
- << theRefPoint.x << ", "
- << theRefPoint.y << ", "
- << theRefPoint.z << " )";
- else
- TPythonDump() << "refPoint = SMESH.PointStruct( 0,0,0 )";
-
TPythonDump() << "error = " << this << ".ExtrusionAlongPathObject( "
<< theObject << ", "
<< thePathMesh << ", "
<< thePathShape << ", "
<< theNodeStart << ", "
<< theHasAngles << ", "
- << "rotAngles" << ", "
- << theHasRefPoint << ", refPoint )";
+ << theAngles << ", "
+ << theHasRefPoint << ", "
+ << "SMESH.PointStruct( "
+ << ( theHasRefPoint ? theRefPoint.x : 0 ) << ", "
+ << ( theHasRefPoint ? theRefPoint.y : 0 ) << ", "
+ << ( theHasRefPoint ? theRefPoint.z : 0 ) << " ) )";
}
SMESH::SMESH_MeshEditor::Extrusion_Error anError;
SMESH::long_array_var anElementsId = theObject->GetIDs();
return anError;
}
+//=======================================================================
+//function : ExtrusionAlongPathObject1D
+//purpose :
+//=======================================================================
+
+SMESH::SMESH_MeshEditor::Extrusion_Error
+SMESH_MeshEditor_i::ExtrusionAlongPathObject1D(SMESH::SMESH_IDSource_ptr theObject,
+ SMESH::SMESH_Mesh_ptr thePathMesh,
+ GEOM::GEOM_Object_ptr thePathShape,
+ CORBA::Long theNodeStart,
+ CORBA::Boolean theHasAngles,
+ const SMESH::double_array & theAngles,
+ CORBA::Boolean theHasRefPoint,
+ const SMESH::PointStruct & theRefPoint)
+{
+ if ( !myPreviewMode ) {
+ TPythonDump() << "error = " << this << ".ExtrusionAlongPathObject1D( "
+ << theObject << ", "
+ << thePathMesh << ", "
+ << thePathShape << ", "
+ << theNodeStart << ", "
+ << theHasAngles << ", "
+ << theAngles << ", "
+ << theHasRefPoint << ", "
+ << "SMESH.PointStruct( "
+ << ( theHasRefPoint ? theRefPoint.x : 0 ) << ", "
+ << ( theHasRefPoint ? theRefPoint.y : 0 ) << ", "
+ << ( theHasRefPoint ? theRefPoint.z : 0 ) << " ) )";
+ }
+ SMESH::SMESH_MeshEditor::Extrusion_Error anError;
+ SMESH::long_array_var anElementsId = theObject->GetIDs();
+ extrusionAlongPath( anElementsId,
+ thePathMesh,
+ thePathShape,
+ theNodeStart,
+ theHasAngles,
+ theAngles,
+ theHasRefPoint,
+ theRefPoint,
+ false,
+ anError,
+ SMDSAbs_Edge);
+ return anError;
+}
+
+//=======================================================================
+//function : ExtrusionAlongPathObject2D
+//purpose :
+//=======================================================================
+
+SMESH::SMESH_MeshEditor::Extrusion_Error
+SMESH_MeshEditor_i::ExtrusionAlongPathObject2D(SMESH::SMESH_IDSource_ptr theObject,
+ SMESH::SMESH_Mesh_ptr thePathMesh,
+ GEOM::GEOM_Object_ptr thePathShape,
+ CORBA::Long theNodeStart,
+ CORBA::Boolean theHasAngles,
+ const SMESH::double_array & theAngles,
+ CORBA::Boolean theHasRefPoint,
+ const SMESH::PointStruct & theRefPoint)
+{
+ if ( !myPreviewMode ) {
+ TPythonDump() << "error = " << this << ".ExtrusionAlongPathObject2D( "
+ << theObject << ", "
+ << thePathMesh << ", "
+ << thePathShape << ", "
+ << theNodeStart << ", "
+ << theHasAngles << ", "
+ << theAngles << ", "
+ << theHasRefPoint << ", "
+ << "SMESH.PointStruct( "
+ << ( theHasRefPoint ? theRefPoint.x : 0 ) << ", "
+ << ( theHasRefPoint ? theRefPoint.y : 0 ) << ", "
+ << ( theHasRefPoint ? theRefPoint.z : 0 ) << " ) )";
+ }
+ SMESH::SMESH_MeshEditor::Extrusion_Error anError;
+ SMESH::long_array_var anElementsId = theObject->GetIDs();
+ extrusionAlongPath( anElementsId,
+ thePathMesh,
+ thePathShape,
+ theNodeStart,
+ theHasAngles,
+ theAngles,
+ theHasRefPoint,
+ theRefPoint,
+ false,
+ anError,
+ SMDSAbs_Face);
+ return anError;
+}
+
//=======================================================================
//function : ExtrusionAlongPathMakeGroups
Error);
if ( !myPreviewMode ) {
- TPythonDump() << "rotAngles = " << theAngles;
+ bool isDumpGroups = aGroups && aGroups->length() > 0;
+ TPythonDump aPythonDump;
+ if(isDumpGroups) {
+ aPythonDump << "("<<aGroups;
+ }
+ if(isDumpGroups)
+ aPythonDump << ", error)";
+ else
+ aPythonDump <<"error";
- if ( theHasRefPoint )
- TPythonDump() << "refPoint = SMESH.PointStruct( "
- << theRefPoint.x << ", "
- << theRefPoint.y << ", "
- << theRefPoint.z << " )";
+ aPythonDump << " = " << this << ".ExtrusionAlongPathObjectMakeGroups( "
+ << theObject << ", "
+ << thePathMesh << ", "
+ << thePathShape << ", "
+ << theNodeStart << ", "
+ << theHasAngles << ", "
+ << theAngles << ", "
+ << theHasRefPoint << ", "
+ << "SMESH.PointStruct( "
+ << ( theHasRefPoint ? theRefPoint.x : 0 ) << ", "
+ << ( theHasRefPoint ? theRefPoint.y : 0 ) << ", "
+ << ( theHasRefPoint ? theRefPoint.z : 0 ) << " ) )";
+ }
+ return aGroups;
+}
+
+//=======================================================================
+//function : ExtrusionAlongPathObject1DMakeGroups
+//purpose :
+//=======================================================================
+
+SMESH::ListOfGroups* SMESH_MeshEditor_i::
+ExtrusionAlongPathObject1DMakeGroups(SMESH::SMESH_IDSource_ptr theObject,
+ SMESH::SMESH_Mesh_ptr thePathMesh,
+ GEOM::GEOM_Object_ptr thePathShape,
+ CORBA::Long theNodeStart,
+ CORBA::Boolean theHasAngles,
+ const SMESH::double_array& theAngles,
+ CORBA::Boolean theHasRefPoint,
+ const SMESH::PointStruct& theRefPoint,
+ SMESH::SMESH_MeshEditor::Extrusion_Error& Error)
+{
+ SMESH::long_array_var anElementsId = theObject->GetIDs();
+ SMESH::ListOfGroups * aGroups = extrusionAlongPath( anElementsId,
+ thePathMesh,
+ thePathShape,
+ theNodeStart,
+ theHasAngles,
+ theAngles,
+ theHasRefPoint,
+ theRefPoint,
+ true,
+ Error,
+ SMDSAbs_Edge);
+
+ if ( !myPreviewMode ) {
+ bool isDumpGroups = aGroups && aGroups->length() > 0;
+ TPythonDump aPythonDump;
+ if(isDumpGroups) {
+ aPythonDump << "("<<aGroups;
+ }
+ if(isDumpGroups)
+ aPythonDump << ", error)";
else
- TPythonDump() << "refPoint = SMESH.PointStruct( 0,0,0 )";
-
+ aPythonDump <<"error";
+
+ aPythonDump << " = " << this << ".ExtrusionAlongPathObject1DMakeGroups( "
+ << theObject << ", "
+ << thePathMesh << ", "
+ << thePathShape << ", "
+ << theNodeStart << ", "
+ << theHasAngles << ", "
+ << theAngles << ", "
+ << theHasRefPoint << ", "
+ << "SMESH.PointStruct( "
+ << ( theHasRefPoint ? theRefPoint.x : 0 ) << ", "
+ << ( theHasRefPoint ? theRefPoint.y : 0 ) << ", "
+ << ( theHasRefPoint ? theRefPoint.z : 0 ) << " ) )";
+ }
+ return aGroups;
+}
+
+//=======================================================================
+//function : ExtrusionAlongPathObject2DMakeGroups
+//purpose :
+//=======================================================================
+
+SMESH::ListOfGroups* SMESH_MeshEditor_i::
+ExtrusionAlongPathObject2DMakeGroups(SMESH::SMESH_IDSource_ptr theObject,
+ SMESH::SMESH_Mesh_ptr thePathMesh,
+ GEOM::GEOM_Object_ptr thePathShape,
+ CORBA::Long theNodeStart,
+ CORBA::Boolean theHasAngles,
+ const SMESH::double_array& theAngles,
+ CORBA::Boolean theHasRefPoint,
+ const SMESH::PointStruct& theRefPoint,
+ SMESH::SMESH_MeshEditor::Extrusion_Error& Error)
+{
+ SMESH::long_array_var anElementsId = theObject->GetIDs();
+ SMESH::ListOfGroups * aGroups = extrusionAlongPath( anElementsId,
+ thePathMesh,
+ thePathShape,
+ theNodeStart,
+ theHasAngles,
+ theAngles,
+ theHasRefPoint,
+ theRefPoint,
+ true,
+ Error,
+ SMDSAbs_Face);
+
+ if ( !myPreviewMode ) {
bool isDumpGroups = aGroups && aGroups->length() > 0;
TPythonDump aPythonDump;
if(isDumpGroups) {
else
aPythonDump <<"error";
- aPythonDump << " = " << this << ".ExtrusionAlongPathObjectMakeGroups( "
+ aPythonDump << " = " << this << ".ExtrusionAlongPathObject2DMakeGroups( "
<< theObject << ", "
<< thePathMesh << ", "
<< thePathShape << ", "
<< theNodeStart << ", "
<< theHasAngles << ", "
- << "rotAngles" << ", "
- << theHasRefPoint << ", refPoint )";
+ << theAngles << ", "
+ << theHasRefPoint << ", "
+ << "SMESH.PointStruct( "
+ << ( theHasRefPoint ? theRefPoint.x : 0 ) << ", "
+ << ( theHasRefPoint ? theRefPoint.y : 0 ) << ", "
+ << ( theHasRefPoint ? theRefPoint.z : 0 ) << " ) )";
}
return aGroups;
}
CORBA::Double AngleInRadians,
CORBA::Long NbOfSteps,
CORBA::Double Tolerance);
+ void RotationSweepObject1D(SMESH::SMESH_IDSource_ptr theObject,
+ const SMESH::AxisStruct & Axis,
+ CORBA::Double AngleInRadians,
+ CORBA::Long NbOfSteps,
+ CORBA::Double Tolerance);
+ void RotationSweepObject2D(SMESH::SMESH_IDSource_ptr theObject,
+ const SMESH::AxisStruct & Axis,
+ CORBA::Double AngleInRadians,
+ CORBA::Long NbOfSteps,
+ CORBA::Double Tolerance);
void ExtrusionSweep(const SMESH::long_array & IDsOfElements,
const SMESH::DirStruct & StepVector,
const SMESH::double_array & Angles,
CORBA::Boolean HasRefPoint,
const SMESH::PointStruct & RefPoint);
+ SMESH::SMESH_MeshEditor::Extrusion_Error
+ ExtrusionAlongPathObject1D(SMESH::SMESH_IDSource_ptr theObject,
+ SMESH::SMESH_Mesh_ptr PathMesh,
+ GEOM::GEOM_Object_ptr PathShape,
+ CORBA::Long NodeStart,
+ CORBA::Boolean HasAngles,
+ const SMESH::double_array & Angles,
+ CORBA::Boolean HasRefPoint,
+ const SMESH::PointStruct & RefPoint);
+ SMESH::SMESH_MeshEditor::Extrusion_Error
+ ExtrusionAlongPathObject2D(SMESH::SMESH_IDSource_ptr theObject,
+ SMESH::SMESH_Mesh_ptr PathMesh,
+ GEOM::GEOM_Object_ptr PathShape,
+ CORBA::Long NodeStart,
+ CORBA::Boolean HasAngles,
+ const SMESH::double_array & Angles,
+ CORBA::Boolean HasRefPoint,
+ const SMESH::PointStruct & RefPoint);
SMESH::double_array* LinearAnglesVariation(SMESH::SMESH_Mesh_ptr PathMesh,
GEOM::GEOM_Object_ptr PathShape,
CORBA::Double AngleInRadians,
CORBA::Long NbOfSteps,
CORBA::Double Tolerance);
+ SMESH::ListOfGroups* RotationSweepObject1DMakeGroups(SMESH::SMESH_IDSource_ptr Object,
+ const SMESH::AxisStruct& Axix,
+ CORBA::Double AngleInRadians,
+ CORBA::Long NbOfSteps,
+ CORBA::Double Tolerance);
+ SMESH::ListOfGroups* RotationSweepObject2DMakeGroups(SMESH::SMESH_IDSource_ptr Object,
+ const SMESH::AxisStruct& Axix,
+ CORBA::Double AngleInRadians,
+ CORBA::Long NbOfSteps,
+ CORBA::Double Tolerance);
SMESH::ListOfGroups* ExtrusionSweepMakeGroups(const SMESH::long_array& IDsOfElements,
const SMESH::DirStruct& StepVector,
CORBA::Long NbOfSteps);
CORBA::Boolean HasRefPoint,
const SMESH::PointStruct& RefPoint,
SMESH::SMESH_MeshEditor::Extrusion_Error& Error);
+ SMESH::ListOfGroups* ExtrusionAlongPathObject1DMakeGroups(SMESH::SMESH_IDSource_ptr Object,
+ SMESH::SMESH_Mesh_ptr PathMesh,
+ GEOM::GEOM_Object_ptr PathShape,
+ CORBA::Long NodeStart,
+ CORBA::Boolean HasAngles,
+ const SMESH::double_array& Angles,
+ CORBA::Boolean HasRefPoint,
+ const SMESH::PointStruct& RefPoint,
+ SMESH::SMESH_MeshEditor::Extrusion_Error& Error);
+ SMESH::ListOfGroups* ExtrusionAlongPathObject2DMakeGroups(SMESH::SMESH_IDSource_ptr Object,
+ SMESH::SMESH_Mesh_ptr PathMesh,
+ GEOM::GEOM_Object_ptr PathShape,
+ CORBA::Long NodeStart,
+ CORBA::Boolean HasAngles,
+ const SMESH::double_array& Angles,
+ CORBA::Boolean HasRefPoint,
+ const SMESH::PointStruct& RefPoint,
+ SMESH::SMESH_MeshEditor::Extrusion_Error& Error);
SMESH::ListOfGroups* MirrorMakeGroups(const SMESH::long_array& IDsOfElements,
const SMESH::AxisStruct& Mirror,
SMESH::SMESH_MeshEditor::MirrorType MirrorType);
CORBA::Double AngleInRadians,
CORBA::Long NbOfSteps,
CORBA::Double Tolerance,
- const bool MakeGroups);
+ const bool MakeGroups,
+ const SMDSAbs_ElementType ElementType=SMDSAbs_All);
SMESH::ListOfGroups* extrusionSweep(const SMESH::long_array & IDsOfElements,
const SMESH::DirStruct & StepVector,
CORBA::Long NbOfSteps,
CORBA::Boolean HasRefPoint,
const SMESH::PointStruct & RefPoint,
const bool MakeGroups,
- SMESH::SMESH_MeshEditor::Extrusion_Error & Error);
+ SMESH::SMESH_MeshEditor::Extrusion_Error & Error,
+ const SMDSAbs_ElementType ElementType=SMDSAbs_All);
SMESH::ListOfGroups* mirror(const SMESH::long_array & IDsOfElements,
const SMESH::AxisStruct & Axis,
SMESH::SMESH_MeshEditor::MirrorType MirrorType,
aStates->IncrementState();
}
else if(aMethod.IsEqual("ExtrusionSweep") ||
- aMethod.IsEqual("ExtrusionSweepMakeGroups")) {
+ aMethod.IsEqual("ExtrusionSweepObject") ||
+ aMethod.IsEqual("ExtrusionSweepObject1D") ||
+ aMethod.IsEqual("ExtrusionSweepObject2D") ||
+ aMethod.IsEqual("ExtrusionSweepMakeGroups") ||
+ aMethod.IsEqual("ExtrusionSweepObjectMakeGroups") ||
+ aMethod.IsEqual("ExtrusionSweepObject1DMakeGroups") ||
+ aMethod.IsEqual("ExtrusionSweepObject2DMakeGroups")) {
bool isSubstitute = false;
int anArgIndex = 0;
for(int i = 1, n = aCmd->GetNbArgs(); i <= n; i++) {
aStates->IncrementState();
}
else if(aMethod.IsEqual("ExtrusionAlongPath") ||
+ aMethod.IsEqual("ExtrusionAlongPathObject") ||
aMethod.IsEqual("ExtrusionAlongPathMakeGroups") ||
+ aMethod.IsEqual("ExtrusionAlongPathObjectMakeGroups") ||
/* workaround for a bug in the command parsing algorithm */
- aCmd->GetString().Search("ExtrusionAlongPathMakeGroups") != -1) {
+ aCmd->GetString().Search("ExtrusionAlongPathMakeGroups") != -1 ||
+ aCmd->GetString().Search("ExtrusionAlongPathObjectMakeGroups") != -1 ) {
int aNbAngles = aCurrentStateSize-3; // State looks like "Angle1:...:AngleN:X:Y:Z"
bool isSubstitute = false;
int anArgIndex = 0;
aStates->IncrementState();
}
else if(aMethod.IsEqual("Smooth") ||
- aMethod.IsEqual("SmoothParametric")) {
+ aMethod.IsEqual("SmoothObject") ||
+ aMethod.IsEqual("SmoothParametric") ||
+ aMethod.IsEqual("SmoothParametricObject")) {
int anArgIndex = aCmd->GetNbArgs() - 2;
for(int j = 0; j < aCurrentStateSize; j++) {
if(!aCurrentState.at(j).IsEmpty())
return AngleInDegrees * pi / 180.0
# Salome notebook variable separator
-variable_separator = ":"
+var_separator = ":"
# Parametrized substitute for PointStruct
class PointStructStr:
# Returns list of variable values from salome notebook
def ParsePointStruct(Point):
- Parameters = "::"
+ Parameters = 2*var_separator
if isinstance(Point, PointStructStr):
- Parameters = str(Point.xStr) + ":" + str(Point.yStr) + ":" + str(Point.zStr)
+ Parameters = str(Point.xStr) + var_separator + str(Point.yStr) + var_separator + str(Point.zStr)
Point = PointStruct(Point.x, Point.y, Point.z)
return Point, Parameters
# Returns list of variable values from salome notebook
def ParseDirStruct(Dir):
- Parameters = "::"
+ Parameters = 2*var_separator
if isinstance(Dir, DirStructStr):
pntStr = Dir.pointStruct
if isinstance(pntStr, PointStructStr6):
- Parameters = str(pntStr.x1Str) + ":" + str(pntStr.x2Str) + ":"
- Parameters += str(pntStr.y1Str) + ":" + str(pntStr.y2Str) + ":"
- Parameters += str(pntStr.z1Str) + ":" + str(pntStr.z2Str)
+ Parameters = str(pntStr.x1Str) + var_separator + str(pntStr.x2Str) + var_separator
+ Parameters += str(pntStr.y1Str) + var_separator + str(pntStr.y2Str) + var_separator
+ Parameters += str(pntStr.z1Str) + var_separator + str(pntStr.z2Str)
Point = PointStruct(pntStr.x2 - pntStr.x1, pntStr.y2 - pntStr.y1, pntStr.z2 - pntStr.z1)
else:
- Parameters = str(pntStr.xStr) + ":" + str(pntStr.yStr) + ":" + str(pntStr.zStr)
+ Parameters = str(pntStr.xStr) + var_separator + str(pntStr.yStr) + var_separator + str(pntStr.zStr)
Point = PointStruct(pntStr.x, pntStr.y, pntStr.z)
Dir = DirStruct(Point)
return Dir, Parameters
# Returns list of variable values from salome notebook
def ParseAxisStruct(Axis):
- Parameters = 5*variable_separator
+ Parameters = 5*var_separator
if isinstance(Axis, AxisStructStr):
- Parameters = str(Axis.xStr) + variable_separator + str(Axis.yStr) + variable_separator + str(Axis.zStr) + variable_separator
- Parameters += str(Axis.dxStr) + variable_separator + str(Axis.dyStr) + variable_separator + str(Axis.dzStr)
+ Parameters = str(Axis.xStr) + var_separator + str(Axis.yStr) + var_separator + str(Axis.zStr) + var_separator
+ Parameters += str(Axis.dxStr) + var_separator + str(Axis.dyStr) + var_separator + str(Axis.dzStr)
Axis = AxisStruct(Axis.x, Axis.y, Axis.z, Axis.dx, Axis.dy, Axis.dz)
return Axis, Parameters
pass
Parameters = Parameters + str(parameter)
- Parameters = Parameters + ":"
+ Parameters = Parameters + var_separator
pass
Parameters = Parameters[:len(Parameters)-1]
return Result, Parameters
if TotalAngle and NbOfSteps:
AngleInRadians /= NbOfSteps
NbOfSteps,Tolerance,Parameters = geompyDC.ParseParameters(NbOfSteps,Tolerance)
- Parameters = AxisParameters + ":" + AngleParameters + ":" + Parameters
+ Parameters = AxisParameters + var_separator + AngleParameters + var_separator + Parameters
self.mesh.SetParameters(Parameters)
if MakeGroups:
return self.editor.RotationSweepMakeGroups(IDsOfElements, Axis,
# @ingroup l2_modif_extrurev
def RotationSweepObject(self, theObject, Axis, AngleInRadians, NbOfSteps, Tolerance,
MakeGroups=False, TotalAngle=False):
+ flag = False
+ if isinstance(AngleInRadians,str):
+ flag = True
+ AngleInRadians,AngleParameters = geompyDC.ParseParameters(AngleInRadians)
+ if flag:
+ AngleInRadians = DegreesToRadians(AngleInRadians)
if ( isinstance( theObject, Mesh )):
theObject = theObject.GetMesh()
if ( isinstance( Axis, geompyDC.GEOM._objref_GEOM_Object)):
Axis = self.smeshpyD.GetAxisStruct(Axis)
+ Axis,AxisParameters = ParseAxisStruct(Axis)
if TotalAngle and NbOfSteps:
AngleInRadians /= NbOfSteps
+ NbOfSteps,Tolerance,Parameters = geompyDC.ParseParameters(NbOfSteps,Tolerance)
+ Parameters = AxisParameters + var_separator + AngleParameters + var_separator + Parameters
+ self.mesh.SetParameters(Parameters)
if MakeGroups:
return self.editor.RotationSweepObjectMakeGroups(theObject, Axis, AngleInRadians,
NbOfSteps, Tolerance)
self.editor.RotationSweepObject(theObject, Axis, AngleInRadians, NbOfSteps, Tolerance)
return []
+ ## Generates new elements by rotation of the elements of object around the axis
+ # @param theObject object which elements should be sweeped
+ # @param Axis the axis of rotation, AxisStruct or line(geom object)
+ # @param AngleInRadians the angle of Rotation
+ # @param NbOfSteps number of steps
+ # @param Tolerance tolerance
+ # @param MakeGroups forces the generation of new groups from existing ones
+ # @param TotalAngle gives meaning of AngleInRadians: if True then it is an angular size
+ # of all steps, else - size of each step
+ # @return the list of created groups (SMESH_GroupBase) if MakeGroups=True, empty list otherwise
+ # @ingroup l2_modif_extrurev
+ def RotationSweepObject1D(self, theObject, Axis, AngleInRadians, NbOfSteps, Tolerance,
+ MakeGroups=False, TotalAngle=False):
+ flag = False
+ if isinstance(AngleInRadians,str):
+ flag = True
+ AngleInRadians,AngleParameters = geompyDC.ParseParameters(AngleInRadians)
+ if flag:
+ AngleInRadians = DegreesToRadians(AngleInRadians)
+ if ( isinstance( theObject, Mesh )):
+ theObject = theObject.GetMesh()
+ if ( isinstance( Axis, geompyDC.GEOM._objref_GEOM_Object)):
+ Axis = self.smeshpyD.GetAxisStruct(Axis)
+ Axis,AxisParameters = ParseAxisStruct(Axis)
+ if TotalAngle and NbOfSteps:
+ AngleInRadians /= NbOfSteps
+ NbOfSteps,Tolerance,Parameters = geompyDC.ParseParameters(NbOfSteps,Tolerance)
+ Parameters = AxisParameters + var_separator + AngleParameters + var_separator + Parameters
+ self.mesh.SetParameters(Parameters)
+ if MakeGroups:
+ return self.editor.RotationSweepObject1DMakeGroups(theObject, Axis, AngleInRadians,
+ NbOfSteps, Tolerance)
+ self.editor.RotationSweepObject1D(theObject, Axis, AngleInRadians, NbOfSteps, Tolerance)
+ return []
+
+ ## Generates new elements by rotation of the elements of object around the axis
+ # @param theObject object which elements should be sweeped
+ # @param Axis the axis of rotation, AxisStruct or line(geom object)
+ # @param AngleInRadians the angle of Rotation
+ # @param NbOfSteps number of steps
+ # @param Tolerance tolerance
+ # @param MakeGroups forces the generation of new groups from existing ones
+ # @param TotalAngle gives meaning of AngleInRadians: if True then it is an angular size
+ # of all steps, else - size of each step
+ # @return the list of created groups (SMESH_GroupBase) if MakeGroups=True, empty list otherwise
+ # @ingroup l2_modif_extrurev
+ def RotationSweepObject2D(self, theObject, Axis, AngleInRadians, NbOfSteps, Tolerance,
+ MakeGroups=False, TotalAngle=False):
+ flag = False
+ if isinstance(AngleInRadians,str):
+ flag = True
+ AngleInRadians,AngleParameters = geompyDC.ParseParameters(AngleInRadians)
+ if flag:
+ AngleInRadians = DegreesToRadians(AngleInRadians)
+ if ( isinstance( theObject, Mesh )):
+ theObject = theObject.GetMesh()
+ if ( isinstance( Axis, geompyDC.GEOM._objref_GEOM_Object)):
+ Axis = self.smeshpyD.GetAxisStruct(Axis)
+ Axis,AxisParameters = ParseAxisStruct(Axis)
+ if TotalAngle and NbOfSteps:
+ AngleInRadians /= NbOfSteps
+ NbOfSteps,Tolerance,Parameters = geompyDC.ParseParameters(NbOfSteps,Tolerance)
+ Parameters = AxisParameters + var_separator + AngleParameters + var_separator + Parameters
+ self.mesh.SetParameters(Parameters)
+ if MakeGroups:
+ return self.editor.RotationSweepObject2DMakeGroups(theObject, Axis, AngleInRadians,
+ NbOfSteps, Tolerance)
+ self.editor.RotationSweepObject2D(theObject, Axis, AngleInRadians, NbOfSteps, Tolerance)
+ return []
+
## Generates new elements by extrusion of the elements with given ids
# @param IDsOfElements the list of elements ids for extrusion
# @param StepVector vector, defining the direction and value of extrusion
StepVector = self.smeshpyD.GetDirStruct(StepVector)
StepVector,StepVectorParameters = ParseDirStruct(StepVector)
NbOfSteps,Parameters = geompyDC.ParseParameters(NbOfSteps)
- Parameters = StepVectorParameters + ":" + Parameters
+ Parameters = StepVectorParameters + var_separator + Parameters
self.mesh.SetParameters(Parameters)
if MakeGroups:
return self.editor.ExtrusionSweepMakeGroups(IDsOfElements, StepVector, NbOfSteps)
theObject = theObject.GetMesh()
if ( isinstance( StepVector, geompyDC.GEOM._objref_GEOM_Object)):
StepVector = self.smeshpyD.GetDirStruct(StepVector)
+ StepVector,StepVectorParameters = ParseDirStruct(StepVector)
+ NbOfSteps,Parameters = geompyDC.ParseParameters(NbOfSteps)
+ Parameters = StepVectorParameters + var_separator + Parameters
+ self.mesh.SetParameters(Parameters)
if MakeGroups:
return self.editor.ExtrusionSweepObjectMakeGroups(theObject, StepVector, NbOfSteps)
self.editor.ExtrusionSweepObject(theObject, StepVector, NbOfSteps)
theObject = theObject.GetMesh()
if ( isinstance( StepVector, geompyDC.GEOM._objref_GEOM_Object)):
StepVector = self.smeshpyD.GetDirStruct(StepVector)
+ StepVector,StepVectorParameters = ParseDirStruct(StepVector)
+ NbOfSteps,Parameters = geompyDC.ParseParameters(NbOfSteps)
+ Parameters = StepVectorParameters + var_separator + Parameters
+ self.mesh.SetParameters(Parameters)
if MakeGroups:
return self.editor.ExtrusionSweepObject1DMakeGroups(theObject, StepVector, NbOfSteps)
self.editor.ExtrusionSweepObject1D(theObject, StepVector, NbOfSteps)
theObject = theObject.GetMesh()
if ( isinstance( StepVector, geompyDC.GEOM._objref_GEOM_Object)):
StepVector = self.smeshpyD.GetDirStruct(StepVector)
+ StepVector,StepVectorParameters = ParseDirStruct(StepVector)
+ NbOfSteps,Parameters = geompyDC.ParseParameters(NbOfSteps)
+ Parameters = StepVectorParameters + var_separator + Parameters
+ self.mesh.SetParameters(Parameters)
if MakeGroups:
return self.editor.ExtrusionSweepObject2DMakeGroups(theObject, StepVector, NbOfSteps)
self.editor.ExtrusionSweepObject2D(theObject, StepVector, NbOfSteps)
if HasAngles and Angles and LinearVariation:
Angles = self.editor.LinearAnglesVariation( PathMesh, PathShape, Angles )
pass
- Parameters = AnglesParameters + ":" + RefPointParameters
+ Parameters = AnglesParameters + var_separator + RefPointParameters
self.mesh.SetParameters(Parameters)
if MakeGroups:
return self.editor.ExtrusionAlongPathMakeGroups(IDsOfElements, PathMesh,
def ExtrusionAlongPathObject(self, theObject, PathMesh, PathShape, NodeStart,
HasAngles, Angles, HasRefPoint, RefPoint,
MakeGroups=False, LinearVariation=False):
+ Angles,AnglesParameters = ParseAngles(Angles)
+ RefPoint,RefPointParameters = ParsePointStruct(RefPoint)
if ( isinstance( theObject, Mesh )):
theObject = theObject.GetMesh()
if ( isinstance( RefPoint, geompyDC.GEOM._objref_GEOM_Object)):
if HasAngles and Angles and LinearVariation:
Angles = self.editor.LinearAnglesVariation( PathMesh, PathShape, Angles )
pass
+ Parameters = AnglesParameters + var_separator + RefPointParameters
+ self.mesh.SetParameters(Parameters)
if MakeGroups:
return self.editor.ExtrusionAlongPathObjectMakeGroups(theObject, PathMesh,
PathShape, NodeStart, HasAngles,
NodeStart, HasAngles, Angles, HasRefPoint,
RefPoint)
+ ## Generates new elements by extrusion of the elements which belong to the object
+ # The path of extrusion must be a meshed edge.
+ # @param theObject the object which elements should be processed
+ # @param PathMesh mesh containing a 1D sub-mesh on the edge, along which the extrusion proceeds
+ # @param PathShape shape(edge) defines the sub-mesh for the path
+ # @param NodeStart the first or the last node on the edge. Defines the direction of extrusion
+ # @param HasAngles allows the shape to be rotated around the path
+ # to get the resulting mesh in a helical fashion
+ # @param Angles list of angles
+ # @param HasRefPoint allows using the reference point
+ # @param RefPoint the point around which the shape is rotated (the mass center of the shape by default).
+ # The User can specify any point as the Reference Point.
+ # @param MakeGroups forces the generation of new groups from existing ones
+ # @param LinearVariation forces the computation of rotation angles as linear
+ # variation of the given Angles along path steps
+ # @return list of created groups (SMESH_GroupBase) and SMESH::Extrusion_Error if MakeGroups=True,
+ # only SMESH::Extrusion_Error otherwise
+ # @ingroup l2_modif_extrurev
+ def ExtrusionAlongPathObject1D(self, theObject, PathMesh, PathShape, NodeStart,
+ HasAngles, Angles, HasRefPoint, RefPoint,
+ MakeGroups=False, LinearVariation=False):
+ Angles,AnglesParameters = ParseAngles(Angles)
+ RefPoint,RefPointParameters = ParsePointStruct(RefPoint)
+ if ( isinstance( theObject, Mesh )):
+ theObject = theObject.GetMesh()
+ if ( isinstance( RefPoint, geompyDC.GEOM._objref_GEOM_Object)):
+ RefPoint = self.smeshpyD.GetPointStruct(RefPoint)
+ if ( isinstance( PathMesh, Mesh )):
+ PathMesh = PathMesh.GetMesh()
+ if HasAngles and Angles and LinearVariation:
+ Angles = self.editor.LinearAnglesVariation( PathMesh, PathShape, Angles )
+ pass
+ Parameters = AnglesParameters + var_separator + RefPointParameters
+ self.mesh.SetParameters(Parameters)
+ if MakeGroups:
+ return self.editor.ExtrusionAlongPathObject1DMakeGroups(theObject, PathMesh,
+ PathShape, NodeStart, HasAngles,
+ Angles, HasRefPoint, RefPoint)
+ return self.editor.ExtrusionAlongPathObject1D(theObject, PathMesh, PathShape,
+ NodeStart, HasAngles, Angles, HasRefPoint,
+ RefPoint)
+
+ ## Generates new elements by extrusion of the elements which belong to the object
+ # The path of extrusion must be a meshed edge.
+ # @param theObject the object which elements should be processed
+ # @param PathMesh mesh containing a 1D sub-mesh on the edge, along which the extrusion proceeds
+ # @param PathShape shape(edge) defines the sub-mesh for the path
+ # @param NodeStart the first or the last node on the edge. Defines the direction of extrusion
+ # @param HasAngles allows the shape to be rotated around the path
+ # to get the resulting mesh in a helical fashion
+ # @param Angles list of angles
+ # @param HasRefPoint allows using the reference point
+ # @param RefPoint the point around which the shape is rotated (the mass center of the shape by default).
+ # The User can specify any point as the Reference Point.
+ # @param MakeGroups forces the generation of new groups from existing ones
+ # @param LinearVariation forces the computation of rotation angles as linear
+ # variation of the given Angles along path steps
+ # @return list of created groups (SMESH_GroupBase) and SMESH::Extrusion_Error if MakeGroups=True,
+ # only SMESH::Extrusion_Error otherwise
+ # @ingroup l2_modif_extrurev
+ def ExtrusionAlongPathObject2D(self, theObject, PathMesh, PathShape, NodeStart,
+ HasAngles, Angles, HasRefPoint, RefPoint,
+ MakeGroups=False, LinearVariation=False):
+ Angles,AnglesParameters = ParseAngles(Angles)
+ RefPoint,RefPointParameters = ParsePointStruct(RefPoint)
+ if ( isinstance( theObject, Mesh )):
+ theObject = theObject.GetMesh()
+ if ( isinstance( RefPoint, geompyDC.GEOM._objref_GEOM_Object)):
+ RefPoint = self.smeshpyD.GetPointStruct(RefPoint)
+ if ( isinstance( PathMesh, Mesh )):
+ PathMesh = PathMesh.GetMesh()
+ if HasAngles and Angles and LinearVariation:
+ Angles = self.editor.LinearAnglesVariation( PathMesh, PathShape, Angles )
+ pass
+ Parameters = AnglesParameters + var_separator + RefPointParameters
+ self.mesh.SetParameters(Parameters)
+ if MakeGroups:
+ return self.editor.ExtrusionAlongPathObject2DMakeGroups(theObject, PathMesh,
+ PathShape, NodeStart, HasAngles,
+ Angles, HasRefPoint, RefPoint)
+ return self.editor.ExtrusionAlongPathObject2D(theObject, PathMesh, PathShape,
+ NodeStart, HasAngles, Angles, HasRefPoint,
+ RefPoint)
+
## Creates a symmetrical copy of mesh elements
# @param IDsOfElements list of elements ids
# @param Mirror is AxisStruct or geom object(point, line, plane)
if ( isinstance( Axis, geompyDC.GEOM._objref_GEOM_Object)):
Axis = self.smeshpyD.GetAxisStruct(Axis)
Axis,AxisParameters = ParseAxisStruct(Axis)
- Parameters = AxisParameters + ":" + Parameters
+ Parameters = AxisParameters + var_separator + Parameters
self.mesh.SetParameters(Parameters)
if Copy and MakeGroups:
return self.editor.RotateMakeGroups(IDsOfElements, Axis, AngleInRadians)
if ( isinstance( Axis, geompyDC.GEOM._objref_GEOM_Object)):
Axis = self.smeshpyD.GetAxisStruct(Axis)
Axis,AxisParameters = ParseAxisStruct(Axis)
- Parameters = AxisParameters + ":" + Parameters
+ Parameters = AxisParameters + var_separator + Parameters
mesh = self.editor.RotateMakeMesh(IDsOfElements, Axis, AngleInRadians,
MakeGroups, NewMeshName)
mesh.SetParameters(Parameters)
strResult=strResult+str(value)
result = value
if nbParams - 1 != counter:
- strResult=strResult+variable_separator #":"
+ strResult=strResult+var_separator #":"
counter = counter+1
return result, strResult