the <b>Object Browser</b>.
\note If the selected file is in IGES format and the length is not
-expressed in meters, it will be sussested to scale the model into the
+expressed in meters, it will be suggested to scale the model into the
metric system:
-y types (solid, face, edge and
-vertex) for all named shapes
+
\image html iges_unit.png
\par
\n This operation removes all seam and degenerated edges from a given
shape. Its main purpose is healing of solids and compounds to obtain
hexahedral solids and compounds of hexahedral solids.
-However, there is an option to unite all faces, sharing one
-surface, which allows obaining not only hexahedral solids.
+However, there is an option to unite all faces sharing one
+surface, which produces not only hexahedral solids.
\n <b>TUI Command:</b> <em>geompy.RemoveExtraEdges(theShape,theOptimumNbFaces)</em>,
where <em>theShape</em> is a compound or a single solid
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ) ;
initName( tr( "GEOM_CURVE" ) );
+ resize(100,100);
ConstructorsClicked( 0 );
}
initName( tr( "GEOM_ELLIPSE" ) );
+ resize(100,100);
displayPreview();
}
myGroup->PushButton1->click();
SelectionIntoArgument();
+ resize(100,100);
}
//=================================================================================
SIGNAL( currentSelectionChanged( )), this, SLOT( SelectionIntoArgument() ) );
updateButtonState();
-
+ resize(100,100);
SelectionIntoArgument();
}
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
+
#ifdef WNT
#pragma warning( disable:4786 )
#endif
// if this label has been freed (object deleted)
bool useExisting = false;
TDF_Label aChild;
- if (!_lastCleared.IsNull()) {
- if (_lastCleared.Root() == aDoc->Main().Root()) {
+ if (_freeLabels.find(theDocID) != _freeLabels.end()) {
+ std::list<TDF_Label>& aFreeLabels = _freeLabels[theDocID];
+ if (!aFreeLabels.empty()) {
useExisting = true;
- aChild = _lastCleared;
- // 0020229: if next label exists and is empty, try to reuse it
- Standard_Integer aNextTag = aChild.Tag() + 1;
- TDF_Label aNextL = aDoc->Main().FindChild(aNextTag, Standard_False);
- if (!aNextL.IsNull() && !aNextL.HasAttribute())
- _lastCleared = aNextL;
- else
- _lastCleared.Nullify();
+ aChild = aFreeLabels.front();
+ aFreeLabels.pop_front();
}
}
if (!useExisting) {
// if this label has been freed (object deleted)
bool useExisting = false;
TDF_Label aChild;
+ /*
if (!_lastCleared.IsNull()) {
if (_lastCleared.Root() == aDoc->Main().Root()) {
useExisting = true;
_lastCleared.Nullify();
}
}
+ */
+ int aDocID = theMainShape->GetDocID();
+ if (_freeLabels.find(aDocID) != _freeLabels.end()) {
+ std::list<TDF_Label>& aFreeLabels = _freeLabels[aDocID];
+ if (!aFreeLabels.empty()) {
+ useExisting = true;
+ aChild = aFreeLabels.front();
+ aFreeLabels.pop_front();
+ }
+ }
if (!useExisting) {
// create new label
aChild = TDF_TagSource::NewChild(aDoc->Main());
{
if (!theObject) return false;
+ int aDocID = theObject->GetDocID();
+
//Remove an object from the map of available objects
TCollection_AsciiString anID = BuildIDFromObject(theObject);
if (_objects.IsBound(anID)) _objects.UnBind(anID);
TDF_Label aLabel = theObject->GetEntry();
aLabel.ForgetAllAttributes(Standard_True);
- _lastCleared = aLabel;
+
+ // Remember the label to reuse it then
+ std::list<TDF_Label>& aFreeLabels = _freeLabels[aDocID];
+ aFreeLabels.push_back(aLabel);
theObject.Nullify();
}
for (Standard_Integer i=1; i<=aSeq.Length(); i++) _objects.UnBind(aSeq.Value(i));
- _lastCleared.Nullify();
+ // Forget free labels for this document
+ TFreeLabelsList::iterator anIt = _freeLabels.find(theDocID);
+ if (anIt != _freeLabels.end()) {
+ _freeLabels.erase(anIt);
+ }
_mapIDDocument.UnBind(theDocID);
_OCAFApp->Close(aDoc);
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
+
#ifndef _GEOM_Engine_HXX_
#define _GEOM_Engine_HXX_
#include <TDF_Label.hxx>
#include <map>
+#include <list>
#include <vector>
struct TVariable{
typedef std::map<TCollection_AsciiString, ObjectStates* > TVariablesList;
+typedef std::map<int, std::list<TDF_Label> > TFreeLabelsList;
+
class GEOM_Engine
{
public:
Resource_DataMapOfAsciiStringAsciiString _studyEntry2NameMap;
- TDF_Label _lastCleared;
+ TFreeLabelsList _freeLabels;
};
#endif
void SetTolerance(const Standard_Real theValue)
{ _func->SetReal(SHAPE_ARG_TOLERANCE, theValue); }
- Standard_Integer GetTolerance() { return _func->GetReal(SHAPE_ARG_TOLERANCE); }
+ Standard_Real GetTolerance() { return _func->GetReal(SHAPE_ARG_TOLERANCE); }
private:
if (aFW->StatusConnected(ShapeExtend_FAIL)) {
Standard_ConstructionError::Raise("Wire construction failed: cannot build connected wire");
}
-
// IMP 0019766
- aFW->FixGapsByRangesMode() = Standard_True;
- if (aFW->FixGaps3d()) {
- Handle(ShapeExtend_WireData) sbwd = aFW->WireData();
- Handle(ShapeFix_Edge) aFe = new ShapeFix_Edge;
- for (Standard_Integer iedge = 1; iedge <= sbwd->NbEdges(); iedge++) {
- TopoDS_Edge aEdge = TopoDS::Edge(sbwd->Edge(iedge));
- aFe->FixVertexTolerance(aEdge);
- aFe->FixSameParameter(aEdge);
+ if (aFW->StatusConnected(ShapeExtend_DONE3)) {
+ // Confused with <prec> but not Analyzer.Precision(), set the same
+ aFW->FixGapsByRangesMode() = Standard_True;
+ if (aFW->FixGaps3d()) {
+ Handle(ShapeExtend_WireData) sbwd = aFW->WireData();
+ Handle(ShapeFix_Edge) aFe = new ShapeFix_Edge;
+ for (Standard_Integer iedge = 1; iedge <= sbwd->NbEdges(); iedge++) {
+ TopoDS_Edge aEdge = TopoDS::Edge(sbwd->Edge(iedge));
+ aFe->FixVertexTolerance(aEdge);
+ aFe->FixSameParameter(aEdge);
+ }
+ }
+ else if (aFW->StatusGaps3d(ShapeExtend_FAIL)) {
+ Standard_ConstructionError::Raise("Wire construction failed: cannot fix 3d gaps");
}
- }
- else if (aFW->StatusGaps3d(ShapeExtend_FAIL)) {
- Standard_ConstructionError::Raise("Wire construction failed: cannot fix 3d gaps");
}
aShape = aFW->WireAPIMake();
## Create a tangent plane, corresponding to the given parameter on the given face.
# @param theFace The face for which tangent plane should be built.
# @param theParameterV vertical value of the center point (0.0 - 1.0).
- # @param theParameterU horisontal value of the center point (0.0 - 1.0).
+ # @param theParameterU horisontal value of the center point (0.0 - 1.0).
# @param theTrimSize the size of plane.
# @return New GEOM_Object, containing the created tangent.
#
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
initName( tr( "GEOM_FILLING" ) );
+ resize(100,100);
}
//=================================================================================
connect(GroupPoints->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(SelectionTypeButtonClicked()));
initName(tr("GEOM_PIPE"));
+ resize(100,100);
GroupPoints->TextLabel3->hide();
GroupPoints->PushButton3->hide();
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), this, SLOT(SetDoubleSpinBoxStep(double)));
initName(tr("GEOM_REVOLUTION"));
+ resize(100,100);
GroupPoints->PushButton1->click();
SelectionIntoArgument();
globalSelection( GEOM_ALLSHAPES );
SelectionIntoArgument();
+ resize(100,100);
}
GroupPoints->PushButton1->click();
SelectionIntoArgument();
+ resize(100,100);
}
//=================================================================================
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
initName( tr( "CHANGE_ORIENTATION_NEW_OBJ_NAME" ) );
+ resize(100,100);
}
GroupPoints->PushButton1->click();
SelectionIntoArgument();
+ resize(100,100);
}
//=================================================================================
#include <Geom_Curve.hxx>
#include <gp_Pnt.hxx>
#include <TopoDS.hxx>
+#include <TopExp.hxx>
#include <TopoDS_Edge.hxx>
#include <BRep_Tool.hxx>
+#include <TopTools_IndexedMapOfShape.hxx>
#include <BRepBuilderAPI_MakeVertex.hxx>
#include <TColStd_IndexedMapOfInteger.hxx>
myEditCurrentArgument = GroupPoints->LineEdit1;
myObject = GEOM::GEOM_Object::_nil();
+ myIndex = -1;
//myGeomGUI->SetState( 0 );
initSelection();
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
initName( tr( "DEVIDE_EDGE_NEW_OBJECT_NAME" ) );
+ resize(100,100);
}
//=================================================================================
TopoDS_Shape aShape;
gp_Pnt aPnt;
- if ( GEOMBase::GetShape( myObject, aShape, TopAbs_SHAPE ) ) {
- if (aShape.ShapeType() == TopAbs_EDGE) {
- Standard_Real aFP, aLP, aP;
- Handle(Geom_Curve) aCurve = BRep_Tool::Curve(TopoDS::Edge(aShape), aFP, aLP);
- aP = aFP + (aLP - aFP) * myValEdt->value();
- aPnt = aCurve->Value(aP);
- BRepBuilderAPI_MakeVertex mkVertex (aPnt);
- aShape = mkVertex.Shape();
- // Build prs
- SALOME_Prs* aPrs = getDisplayer()->BuildPrs( aShape );
- if ( aPrs != 0 && !aPrs->IsNull() )
- GEOMBase_Helper::displayPreview( aPrs, false, true );
- }
+ GEOMBase::GetShape( myObject, aShape, TopAbs_SHAPE );
+
+ if ( myIndex != -1) {
+ TopTools_IndexedMapOfShape aShapes;
+ TopExp::MapShapes(aShape, aShapes);
+ aShape = aShapes.FindKey(myIndex);
}
+
+ if (aShape.ShapeType() == TopAbs_EDGE) {
+ Standard_Real aFP, aLP, aP;
+ Handle(Geom_Curve) aCurve = BRep_Tool::Curve(TopoDS::Edge(aShape), aFP, aLP);
+ aP = aFP + (aLP - aFP) * myValEdt->value();
+ aPnt = aCurve->Value(aP);
+ BRepBuilderAPI_MakeVertex mkVertex (aPnt);
+ aShape = mkVertex.Shape();
+ // Build prs
+ SALOME_Prs* aPrs = getDisplayer()->BuildPrs( aShape );
+ if ( aPrs != 0 && !aPrs->IsNull() )
+ GEOMBase_Helper::displayPreview( aPrs, false, true );
+ }
}
//=================================================================================
myEditCurrentArgument->setText( "" );
myObject = GEOM::GEOM_Object::_nil();
+ myIndex = -1;
initSelection();
myEditCurrentArgument->setText( "" );
myObject = GEOM::GEOM_Object::_nil();
+ myIndex = -1;
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
SALOME_ListIO aSelList;
if ( aSelList.Extent() == 1 ) {
Handle(SALOME_InteractiveObject) anIO = aSelList.First();
Standard_Boolean aRes;
- GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( anIO, aRes );
- if ( !CORBA::is_nil( aSelectedObject ) && aRes ) {
- QString aName = GEOMBase::GetName( aSelectedObject );
+ GEOM::GEOM_Object_var aSelectedObj = GEOMBase::ConvertIOinGEOMObject( anIO, aRes );
+ if ( !CORBA::is_nil( aSelectedObj ) && aRes )
+ {
TopoDS_Shape aShape;
- if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) ) {
+ QString aName = GEOMBase::GetName( aSelectedObj );
+ if ( GEOMBase::GetShape( aSelectedObj, aShape, TopAbs_SHAPE ) )
+ {
const int aType = aShape.ShapeType();
- if ( aType <= TopAbs_EDGE ) {
- // edge, wire, face, shell, solid, compound
+ if ( aType <= TopAbs_EDGE ) // edge, wire, face, shell, solid, compound
+ {
GEOM::short_array anIndexes;
TColStd_IndexedMapOfInteger aMap;
- aSelMgr->GetIndexes( anIO, aMap );
-
- if ( aMap.Extent() == 1 ) { // local selection
- int anIndex = aMap( 1 );
- myEditCurrentArgument->setText( aName += QString( ":edge_%1" ).arg( anIndex ) );
-
- //Find SubShape Object in Father
- GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather( aSelectedObject, aName );
- if ( aFindedObject == GEOM::GEOM_Object::_nil() ) { // Object not found in study
- GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations( getStudyId() );
- myObject = aShapesOp->GetSubShape( aSelectedObject, anIndex );
- }
- else {
- myObject = aFindedObject; // get Object from study
- }
+ SalomeApp_Application* anApp =
+ (SalomeApp_Application*)(SUIT_Session::session()->activeApplication());
+ anApp->selectionMgr()->GetIndexes( anIO, aMap );
+
+ if ( !aMap.IsEmpty() ) // subshape selection
+ {
+ myIndex = aMap( 1 );
+ myObject = aSelectedObj;
+ myEditCurrentArgument->setText( aName += QString( ":edge_%1" ).arg( myIndex ) );
}
- else if ( aType == TopAbs_EDGE ) {
- // single shape selection
- myObject = aSelectedObject;
+ else if ( aType == TopAbs_EDGE ) // single shape selection
+ {
+ myIndex = -1;
+ myObject = aSelectedObj;
myEditCurrentArgument->setText( GEOMBase::GetName( myObject ) );
}
- else {
- // face, shell, solid or compound was selected, and NOT its subshape.
+ else // face, shell, solid or compound was selected, and NOT its subshape.
+ {
+ myIndex = -1;
myObject = GEOM::GEOM_Object::_nil();
}
}
}
}
}
+
displayPreview();
}
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
// myObject = GEOM::GEOM_Object::_nil();
+ myIndex = -1;
//myGeomGUI->SetState( 0 );
initSelection();
bool RepairGUI_DivideEdgeDlg::execute( ObjectList& objects )
{
GEOM::GEOM_Object_var anObj = GEOM::GEOM_IHealingOperations::_narrow( getOperation() )->DivideEdge
- ( myObject, -1, myValEdt->value(), getIsByParameter() );
+ ( myObject, myIndex, myValEdt->value(), getIsByParameter() );
bool aResult = !anObj->_is_nil();
if ( aResult )
{
GEOM::GEOM_Object_var aNullGeomObject;
localSelection( aNullGeomObject, TopAbs_EDGE ); // load local selection on ALL objects
}
-
-//=================================================================================
-// function : addSubshapeToStudy
-// purpose : virtual method to add new SubObjects if local selection
-//=================================================================================
-void RepairGUI_DivideEdgeDlg::addSubshapesToStudy()
-{
- QMap<QString, GEOM::GEOM_Object_var> objMap;
- objMap[GroupPoints->LineEdit1->text()] = myObject;
-
- addSubshapesToFather( objMap );
-}
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& );
virtual bool execute( ObjectList& );
- virtual void addSubshapesToStudy();
private:
void Init();
void initSelection();
bool getIsByParameter() const;
+ int myIndex;
private:
GEOM::GEOM_Object_var myObject;
this, SLOT( SelectionIntoArgument() ) );
initName( tr( "REMOVE_EXTRA_EDGES_NEW_OBJ_NAME" ) );
+ resize(100,100);
}
GroupPoints->PushButton1->click();
SelectionIntoArgument();
+ resize(100,100);
}
//=================================================================================
GroupPoints->PushButton1->click();
SelectionIntoArgument();
+ resize(100,100);
}
//=================================================================================
connect( myFreeBoundBtn, SIGNAL( clicked() ), this, SLOT( onDetect() ) );
initName( tr( "SEWING_NEW_OBJ_NAME" ) );
+ resize(100,100);
}
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
initName( tr( "SUPRESS_FACE_NEW_OBJ_NAME" ) );
+ resize(100,100);
}
initName(tr("GEOM_MIRROR"));
ConstructorsClicked(0);
+ resize(0,0);
}
//=================================================================================
initName( tr( "GEOM_OFFSET" ) );
globalSelection( GEOM_ALLSHAPES );
+ resize(100,100);
}
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
SALOME_ListIO aSelList;
aSelMgr->selectedObjects(aSelList);
+ GEOM::GEOM_Object_var aSelectedObject;
QString aName;
GEOMBase::ConvertListOfIOInListOfGO(aSelList, myObjects);
if (!myObjects.length())
return;
- else
- myEditCurrentArgument->setText(aName);
}
else {
if (aSelList.Extent() != 1)
// nbSel == 1
Standard_Boolean testResult = Standard_False;
- GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult);
+ aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult);
if (!testResult || CORBA::is_nil(aSelectedObject))
return;
}
}
}
+ }
+
+ myEditCurrentArgument->setText(aName);
- myEditCurrentArgument->setText(aName);
-
- if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 0) {
- myAxis = aSelectedObject;
- if (!myAxis->_is_nil() && !myObjects.length())
- GroupPoints->PushButton1->click();
- }
- else if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 1) {
- myCentPoint = aSelectedObject;
- if (!myCentPoint->_is_nil() && myPoint1->_is_nil())
- GroupPoints->PushButton4->click();
- }
- else if (myEditCurrentArgument == GroupPoints->LineEdit4) {
- myPoint1 = aSelectedObject;
- if (!myPoint1->_is_nil() && myPoint2->_is_nil())
- GroupPoints->PushButton5->click();
- }
- else if (myEditCurrentArgument == GroupPoints->LineEdit5) {
- myPoint2 = aSelectedObject;
- if (!myPoint2->_is_nil() && !myObjects.length())
- GroupPoints->PushButton1->click();
+ if (myEditCurrentArgument == GroupPoints->LineEdit1) {
+ if (myObjects.length()) {
+ if (getConstructorId() == 0 && myAxis->_is_nil() || getConstructorId() == 1 && myCentPoint->_is_nil() )
+ GroupPoints->PushButton2->click();
}
}
+ else if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 0) {
+ myAxis = aSelectedObject;
+ if (!myAxis->_is_nil() && !myObjects.length())
+ GroupPoints->PushButton1->click();
+ }
+ else if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 1) {
+ myCentPoint = aSelectedObject;
+ if (!myCentPoint->_is_nil() && myPoint1->_is_nil())
+ GroupPoints->PushButton4->click();
+ }
+ else if (myEditCurrentArgument == GroupPoints->LineEdit4) {
+ myPoint1 = aSelectedObject;
+ if (!myPoint1->_is_nil() && myPoint2->_is_nil())
+ GroupPoints->PushButton5->click();
+ }
+ else if (myEditCurrentArgument == GroupPoints->LineEdit5) {
+ myPoint2 = aSelectedObject;
+ if (!myPoint2->_is_nil() && !myObjects.length())
+ GroupPoints->PushButton1->click();
+ }
// clear selection
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
myEditCurrentArgument = GroupPoints->LineEdit1;
GroupPoints->PushButton2->setDown(false);
+ GroupPoints->PushButton4->setDown(false);
+ GroupPoints->PushButton5->setDown(false);
GroupPoints->LineEdit2->setEnabled(false);
+ GroupPoints->LineEdit4->setEnabled(false);
+ GroupPoints->LineEdit5->setEnabled(false);
}
else if (send == GroupPoints->PushButton2) {
myEditCurrentArgument = GroupPoints->LineEdit2;