}
Handle(GEOM_AISShape) aSh = new GEOM_AISShape(Shape, aName->Value());
aSh->SetShadingColor(myDisplayGUI->myGeomBase->myShadingColor);
+ aSh->SetInfiniteState(Shape.Infinite());
Handle(GEOM_InteractiveObject) IO = new GEOM_InteractiveObject(anIOR->Value(), myDisplayGUI->myGeomGUI->GetFatherior(), "GEOM");
IO->setEntry(obj->GetID());
aSh->setIO(IO);
QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE"));
/* Reset all arguments and local context to allow user a new selection ...*/
- this->ResetStateOfDialog();
+ //this->ResetStateOfDialog();
return;
}
SALOMEDS::ListOfFileNames_var aSeq = new SALOMEDS::ListOfFileNames;
aSeq->length(1);
// Prepare a file name to open
- TCollection_AsciiString aNameWithExt(SALOMEDS_Tool::GetNameFromPath(theComponent->GetStudy()->URL()));
+ TCollection_AsciiString aNameWithExt("");
+ if (isMultiFile)
+ aNameWithExt = TCollection_AsciiString(SALOMEDS_Tool::GetNameFromPath(theComponent->GetStudy()->URL()));
aNameWithExt += TCollection_AsciiString("_GEOM.sgd");
aSeq[0] = CORBA::string_dup(aNameWithExt.ToCString());
// Build a full file name of temporary file
isMultiFile);
// Prepare a file name to open
- TCollection_AsciiString aNameWithExt(aSeq[0]);
+ TCollection_AsciiString aNameWithExt("");
+ if (isMultiFile)
+ aNameWithExt = TCollection_AsciiString(SALOMEDS_Tool::GetNameFromPath(theComponent->GetStudy()->URL()));
+ aNameWithExt += TCollection_AsciiString("_GEOM.sgd");
TCollection_AsciiString aFullName = aTmpDir + aNameWithExt;
// Open document
anAttr = aStudyBuilder->FindOrCreateAttribute(father, "AttributePixMap");
aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr);
aPixmap->SetPixMap("ICON_OBJBROWSER_Geometry");
+ aStudyBuilder->DefineComponentInstance(father, myGeom);
QAD_Application::getDesktop()->getActiveStudy()->updateObjBrowser();
if(aLocked)
aStudy->GetProperties()->SetLocked(true);
op->finish();
}
- aStudyBuilder->DefineComponentInstance(father, myGeom);
father->ComponentIOR(myGeomGUI->GetFatherior());
TCollection_AsciiString nameG("");
OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
Handle(AIS_InteractiveContext) ic = v3d->getAISContext();
Handle(GEOM_AISShape) theResult = new GEOM_AISShape(shape, nameG.ToCString());
+ theResult->SetInfiniteState(shape.Infinite());
theResult->SetShadingColor(myShadingColor);
IO = new GEOM_InteractiveObject(aShape->Name(), myGeomGUI->GetFatherior(), "GEOM");
theResult->setIO(IO);
anAttr = aStudyBuilder->FindOrCreateAttribute(father, "AttributePixMap");
aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr);
aPixmap->SetPixMap("ICON_OBJBROWSER_Geometry");
+ aStudyBuilder->DefineComponentInstance(father, myGeom);
if (aLocked)
aStudy->GetProperties()->SetLocked(true);
op->finish();
}
- aStudyBuilder->DefineComponentInstance(father, myGeom);
father->ComponentIOR(myGeomGUI->GetFatherior());
SALOMEDS::SObject_var fatherSF = aStudy->FindObjectID(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->entry());
{
QAD_PyEditor* PyEditor = QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getPyEditor();
PyEditor->setText("from GEOM_usinggeom import *\n");
- PyEditor->setText(">>> ");
+ //PyEditor->setText(">>> ");
PyEditor->handleReturn();
break;
}
SALOMEDS::AttributeIOR_var anIOR;
SALOME_ListIteratorOfListIO It(Sel->StoredIObjects());
+ QAD_Operation* op = new SALOMEGUI_ImportOperation( QAD_Application::getDesktop()->getActiveStudy() );
+ op->start();
+ Standard_Boolean deleted = false;
for(;It.More();It.Next()) {
Handle(SALOME_InteractiveObject) IObject = It.Value();
if(IObject->hasEntry()) {
/* Erase objects in Study */
SALOMEDS::SObject_var obj = aStudy->FindObjectID(IObject->getEntry());
if(!obj->_is_nil()) {
- QAD_Operation* op = new SALOMEGUI_ImportOperation(QAD_Application::getDesktop()->getActiveStudy());
- op->start();
aStudyBuilder->RemoveObject(obj);
- op->finish();
+ deleted = true;
}
} /* IObject->hasEntry() */
} /* more/next */
+ if (deleted) op->finish();
+ else op->abort();
+
/* Clear any previous selection */
Sel->ClearIObjects();
QAD_Application::getDesktop()->getActiveStudy()->updateObjBrowser();
anAttr = aStudyBuilder->FindOrCreateAttribute(father, "AttributePixMap");
aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr);
aPixmap->SetPixMap( "ICON_OBJBROWSER_Geometry" );
+ aStudyBuilder->DefineComponentInstance( father, myGeom );
if (aLocked) aStudy->GetProperties()->SetLocked(true);
op->finish();
}
// if (aLocked) return false;
- aStudyBuilder->DefineComponentInstance( father, myGeom );
father->ComponentIOR(myGeomGUI->GetFatherior());
QString nameShape = QAD_Tools::getFileNameFromPath(file,false) + QString("_%1").arg(myGeomGUI->GetNbGeom()++);
#NRI : BugID 1682 : sg = SALOMEGUI_Swig()
#NRI : BugID 1682 : sg.updateObjBrowser(0)
- salome.sg.updateObjBrowser(0)
+# salome.sg.updateObjBrowser(0)
return id
def addToStudyInFather(aFather, aShape, aName):
addArguments( aShape )
#NRI : BugID 1682 : sg.updateObjBrowser(0)
- salome.sg.updateObjBrowser(0)
+# salome.sg.updateObjBrowser(0)
return id
# -----------------------------------------------------------------------------
myDrawer->ShadingAspect()->Aspect()->SetDistinguishOn();
Graphic3d_MaterialAspect aMatAspect;
- aMatAspect.SetAmbient( 1 );
- aMatAspect.SetDiffuse( 0 );
- aMatAspect.SetEmissive( 0 );
- aMatAspect.SetShininess(1 );
- aMatAspect.SetSpecular( 0 );
+ aMatAspect.SetAmbient( 0.5 );
+ aMatAspect.SetDiffuse( 0.5 );
+ aMatAspect.SetEmissive( 0.5 );
+ aMatAspect.SetShininess(0.5 );
+ aMatAspect.SetSpecular( 0.5 );
myDrawer->ShadingAspect()->Aspect()->SetFrontMaterial(aMatAspect);
myDrawer->ShadingAspect()->Aspect()->SetBackMaterial(Graphic3d_NOM_JADE);
this->ishighlighted = false;
this->subshape = false;
+ this->myIsInfinite = false;
}
GEOM_Actor::~GEOM_Actor()
// Mapper creating function
//-------------------------------------------------------------
void GEOM_Actor::CreateMapper(int theMode) {
+ this->myIsInfinite = myShape.Infinite();
if(myShape.ShapeType() == TopAbs_VERTEX) {
gp_Pnt aPnt = BRep_Tool::Pnt(TopoDS::Vertex(myShape));
this->SetPosition(aPnt.X(),aPnt.Y(),aPnt.Z());
}
if(!ishighlighted) {
- if(myDisplayMode >= 1) {
+ if ( ispreselected )
+ this->Property = PreviewProperty;
+ else if(myDisplayMode >= 1) {
// SHADING
this->Property = ShadingProperty;
}
this->Property = WireframeProperty;
}
- if ( ispreselected )
- this->Property = PreviewProperty;
}
this->Property->Render(this, ren);
// Color
void SetColor(float r,float g,float b);
void GetColor(float& r,float& g,float& b);
-
+
+ virtual bool IsInfinite() {return myIsInfinite;}
protected:
GEOM_Actor();
private:
bool subshape;
+ bool myIsInfinite;
TopoDS_Shape myShape;
double deflection;
{
// Shading like default OCC material
FaceProp->SetRepresentationToSurface();
- FaceProp->SetInterpolation(1);
+ FaceProp->SetInterpolationToGouraud();
FaceProp->SetAmbient(1.0);
FaceProp->SetDiffuse(1.0);
FaceProp->SetSpecular(0.4);
// Wireframe for Preview edge
EdgePVProp->SetRepresentationToWireframe();
- EdgePVProp->SetAmbientColor(0, 1, 1);
- EdgePVProp->SetDiffuseColor(0, 1, 1);
- EdgePVProp->SetSpecularColor(0, 1, 1);
+ EdgePVProp->SetAmbientColor(1, 1, 0);
+ EdgePVProp->SetDiffuseColor(1, 1, 0);
+ EdgePVProp->SetSpecularColor(1, 1, 0);
// Wireframe for vertex
VertexProp->SetRepresentationToWireframe();
int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString);
if(nbSel < 1) {
- if(myEditCurrentArgument == GroupPoints->LineEdit1)
+ if(myEditCurrentArgument == GroupPoints->LineEdit1) {
+ myListShapes.length(0);
myOkListShapes = false;
- else if(myEditCurrentArgument == GroupPoints->LineEdit2)
+ } else if(myEditCurrentArgument == GroupPoints->LineEdit2) {
+ myListTools.length(0);
myOkListTools = false;
- else if(myEditCurrentArgument == GroupPoints->LineEdit3)
+ } else if(myEditCurrentArgument == GroupPoints->LineEdit3) {
+ myListRemoveInside.length(0);
myOkKeepShape = false;
- else if(myEditCurrentArgument == GroupPoints->LineEdit4)
+ } else if(myEditCurrentArgument == GroupPoints->LineEdit4) {
+ myListKeepInside.length(0);
myOkRemoveShape = false;
+ }
return;
}
if (!OnE1 && !OnE2 && !theF.IsNull())
{
- // analitically find vertices E1 and E2 must pass trough
+ // if 3 faces intersects each others, 3 new edges on them must pass
+ // through one vertex but real intersection points of each
+ // pair of edges are sometimes more far than a tolerance.
+ // Try to analitically find vertices that E1 and E2 must pass trough
TopoDS_Shape F1 = getOtherShape( theF, AsDes->Ascendant( E1 ));
TopoDS_Shape F2 = getOtherShape( theF, AsDes->Ascendant( E2 ));
- if (!F1.IsNull() && !F2.IsNull())
+ if (!F1.IsNull() && !F2.IsNull() && !F1.IsSame( F2 ))
{
OnE1 = findVOnE ( theV, E1, E2, F1, F2, AsDes, V1 );
OnE2 = findVOnE ( theV, E2, E1, F1, F2, AsDes, V2 );
#include <Geom_RectangularTrimmedSurface.hxx>
#include <Geom_SphericalSurface.hxx>
#include <Geom_Surface.hxx>
-#include <Geom_ToroidalSurface.hxx>
#include <Geom_TrimmedCurve.hxx>
#include <Precision.hxx>
#include <TColStd_MapOfInteger.hxx>
// avoid intersecting faces of one shape
TopoDS_Shape S1;
if (FaceShapeMap.IsBound(F1)) S1 = FaceShapeMap.Find(F1);
- // avoid intersecting faces sharing vertices, suppose they belong to
- // shapes sharing same faces
- TopTools_IndexedMapOfShape VM;
- TopExp::MapShapes( F1, TopAbs_VERTEX, VM);
+
+ // to filter faces sharing an edge
+ TopTools_IndexedMapOfShape EM;
+ TopExp::MapShapes( F1, TopAbs_EDGE, EM);
TColStd_ListIteratorOfListOfInteger itLI = BOS.Compare(F1);
for (; itLI.More(); itLI.Next()) {
if (!S1.IsNull() && S1.IsSame(S2))
continue; // descendants of one shape
- TopExp_Explorer expV (F2, TopAbs_VERTEX);
- for ( ; expV.More(); expV.Next())
- if (VM.Contains( expV.Current() ))
+ TopExp_Explorer expE (F2, TopAbs_EDGE);
+ for ( ; expE.More(); expE.Next())
+ if (EM.Contains( expE.Current() ))
break;
- if (expV.More())
- continue; // faces have a common edge
-
+ if (expE.More())
+ {
+ // faces have a common edge, check if they are a tool and a face
+ // generated by the tool in another shape; in that case they are
+ // to be intersected
+ TopLoc_Location L1, L2;
+ Handle(Geom_Surface) S1 = BRep_Tool::Surface( F1, L1 );
+ Handle(Geom_Surface) S2 = BRep_Tool::Surface( F2, L2 );
+ if ( S1 != S2 || L1 != L2 )
+ continue;
+ }
+
F1.Orientation(TopAbs_FORWARD);
F2.Orientation(TopAbs_FORWARD);
FacesPartition(F1,F2);
// UPeriodic, sometimes it is in domain but nontheless it has
// wrong position.
// Check pcurve position by 3D point
- if (S->IsKind(STANDARD_TYPE( Geom_SphericalSurface )) ||
- S->IsKind(STANDARD_TYPE( Geom_ToroidalSurface )))
+ if (S->IsKind(STANDARD_TYPE( Geom_SphericalSurface )))
{
// get point on the surface
gp_Pnt Ps = S->Value( Pm.X(), Pm.Y() );
TopoDS_Edge se = TopoDS::Edge( itLSE.Value() );
+ // move itLSE to the next se
Standard_Integer ancRank = DS.AncestorRank(se);
if (ME[ancRank-1].Contains( se ))
+ {
LSE.Remove( itLSE ); // se is an edge of face it intersects
+ continue;
+ }
else
+ {
itLSE.Next();
+ }
const TopoDS_Face& F = (ancRank == 1) ? F2 : F1;
myEqualEdges : MapOfShape from TopTools; -- equal splits
myNewSection : MapOfShape from TopTools; -- new secton edges
myClosedShapes : MapOfShape from TopTools;
+ mySharedFaces : MapOfShape from TopTools; -- faces shared by several shapes
myWrappingSolid: MapOfShape from TopTools; -- solids having other shapes inside
myFaceShapeMap : DataMapOfShapeShape from TopTools; -- to find a shape by face
myListShapes.Clear();
myMapFaces.Clear();
myMapTools.Clear();
- myClosedShapes.Clear();
myEqualEdges.Clear();
myNewSection.Clear();
+ myClosedShapes.Clear();
+ mySharedFaces.Clear();
myWrappingSolid.Clear();
myFaceShapeMap.Clear();
MakeShells (S , NSL);
if (makeSolids && S.ShapeType() == TopAbs_SOLID )
MakeSolids( S, NSL );
-
+
+ // store new shells or solids
TopTools_ListIteratorOfListOfShape itNSL (NSL);
for ( ; itNSL.More(); itNSL.Next())
myBuilder.Add (myShape, itNSL.Value());
}
}
- // find outer a shell most close to each hole shell
+ // find an outer shell most close to each hole shell
TopTools_DataMapOfShapeShape aInOutMap;
for (aShellIt.Initialize( aHoleShells ); aShellIt.More(); aShellIt.Next())
{
Standard_Boolean isSolid = (theShape.ShapeType() == TopAbs_SOLID);
if (All || isSolid) // All is for sub-result removal
{
+ // loop on not used faces; checked faces will be removed from MFP
+ // during the loop
for ( itm.Initialize( MFP ); itm.More(); itm.Next() ) {
- TopoDS_Shape aFace = itm.Key();
+ const TopoDS_Shape & aFace = itm.Key();
- // find a shape aFace originates from
+ // a shape which aFace originates from
TopoDS_Shape anOrigShape = GetOriginalShape( aFace );
- // find out if all faces of anOrigShape are not in MFP
+ // find out if all split faces of anOrigShape are not in MFP
// and by the way remove them from MFP
Standard_Boolean isAllOut = Standard_True;
TopoDS_Shape aSplitFaces = anOrigShape;
if (myImageShape.HasImage(anOrigShape))
aSplitFaces = myImageShape.Image(anOrigShape).First();
- TopTools_ListOfShape aSplitFaceL;
+ TopTools_ListOfShape aSplitFaceL; // faces candidate to be kept
for (expl.Init( aSplitFaces, TopAbs_FACE ); expl.More(); expl.Next())
{
const TopoDS_Shape & aSpFace = expl.Current();
- // a tool face which become object has image but the whole tool shape has not
+ // a tool face which became object has image but the whole tool shape has not
if (myImageShape.HasImage( aSpFace ))
{
TopExp_Explorer exF (myImageShape.Image( aSpFace ).First(), TopAbs_FACE );
for ( ; exF.More(); exF.Next() )
{
aSplitFaceL.Append( exF.Current() );
- if ( ! MFP.Remove( exF.Current() ))
- isAllOut = Standard_False;
+ if ( ! MFP.Remove( exF.Current() ) && isAllOut )
+ // a shared face might be removed from MFP during a prev loop
+ isAllOut = mySharedFaces.Contains( exF.Current() );
}
}
else
{
aSplitFaceL.Append( aSpFace );
- if ( ! MFP.Remove( aSpFace ))
- isAllOut = Standard_False;
+ if ( ! MFP.Remove( aSpFace ) && isAllOut)
+ // a shared face might be removed from MFP during a prev loop
+ isAllOut = mySharedFaces.Contains( aSpFace );
}
}
- itm.Initialize( MFP );
+ itm.Initialize( MFP ); // iterate remaining faces
if ( !isAllOut )
continue;
myImagesFaces.Bind(F,LNF);
// replace the result faces that have already been built
- // during same domain faces reconstruction
- if (myInter3d.HasSameDomainF( F )) {
- // build map edge to same domain faces
+ // during same domain faces reconstruction done earlier
+ if (myInter3d.HasSameDomainF( F ))
+ {
+ // build map edge to same domain faces: EFM
TopTools_IndexedDataMapOfShapeListOfShape EFM;
TopTools_MapOfShape SDFM; // avoid doubling
itl.Initialize( myInter3d.SameDomain( F ));
for (; itl.More(); itl.Next()) {
if ( !myImagesFaces.HasImage( itl.Value() ))
continue;
+ // loop on splits of a SD face
TopTools_ListIteratorOfListOfShape itNF;
itNF.Initialize (myImagesFaces.Image( itl.Value() ));
for ( ; itNF.More(); itNF.Next()) {
TopExp::MapShapesAndAncestors(SDF, TopAbs_EDGE, TopAbs_FACE, EFM);
}
}
- // do replace
+ // do replace faces in the LNF
TopTools_ListOfShape LOF;
if ( !EFM.IsEmpty() )
itl.Initialize( LNF );
Standard_Real dot;
Partition_Loop3d::IsInside (E, TopoDS::Face(NF), TopoDS::Face(SDF),
1, dot, GoodOri);
- if (dot < 0) {
+ if (dot < 0)
+ {
+ // NF and SDF are on different side of E
if (SDFL.Extent() == 1) {
itl.Next();
continue;
}
else
- SDF = SDFL.Last();
+ SDF = SDFL.Last(); // next face must be on the same side
}
gp_Vec V1 = Partition_Loop3d::Normal( E, TopoDS::Face( NF ));
gp_Vec V2 = Partition_Loop3d::Normal( E, TopoDS::Face( SDF ));
if (!myImagesFaces.HasImage( NF ))
myImagesFaces.Bind( NF, SDF );
+ // mySharedFaces is used in FindFacesInside()
+ mySharedFaces.Add( SDF );
+
LOF.Prepend ( SDF );
LNF.Remove (itl);
}
myImagesFaces.Bind(F,LNF);
}
} // if (myImagesFaces.HasImage( F ))
-
+
+ // fill the resulting compound
for (itl.Initialize(LNF); itl.More(); itl.Next())
myBuilder.Add ( C, itl.Value());
+
} // loop on faces of S
return C;
TopTools_MapOfShape myEqualEdges;
TopTools_MapOfShape myNewSection;
TopTools_MapOfShape myClosedShapes;
+TopTools_MapOfShape mySharedFaces;
TopTools_MapOfShape myWrappingSolid;
TopTools_DataMapOfShapeShape myFaceShapeMap;
TopTools_DataMapOfShapeShape myInternalFaces;