#include <BRepAlgoAPI_Fuse.hxx>
#include <BRepAlgoAPI_Cut.hxx>
#include <BRepAlgoAPI_Common.hxx>
+#include <BRepAlgoAPI_Section.hxx>
#include <TopoDS_Iterator.hxx>
#include <TopTools_MapOfShape.hxx>
#include <TopExp_Explorer.hxx>
else if(aFunction->GetDriverGUID() == COMMON_GUID){
BRepAlgoAPI_Common aMkCom (anOBJECT, aTOOL);
anIsDone = CheckAndLoad(aMkCom, aFunction);
+ }
+ // case SECTION
+ else if(aFunction->GetDriverGUID() == SECTION_GUID){
+ BRepAlgoAPI_Section aMkSect (anOBJECT, aTOOL);
+ anIsDone = CheckAndLoad(aMkSect, aFunction);
}
else {
aFunction->SetFailure(UNSUPPORTED_FUNCTION);
}
}
+//=======================================================================
+//function : LoadNamingDS
+//purpose :
+//=======================================================================
+void DNaming_BooleanOperationDriver::LoadSectionNDS (const TDF_Label& theResultLabel,
+ BRepAlgoAPI_BooleanOperation& MS) const
+{
+
+ const TopoDS_Shape& ResSh = MS.Shape();
+ const TopoDS_Shape& ObjSh = MS.Shape1();
+ const TopoDS_Shape& ToolSh = MS.Shape2();
+ if (ResSh.IsNull()) {
+#ifdef DEB
+ cout<<"LoadSectionNamingDS: The result of the boolean operation is null"<<endl;
+#endif
+ return;
+ }
+
+ // LoadResult
+ DNaming::LoadResult(theResultLabel, MS);
+
+ TopTools_DataMapOfShapeShape SubShapes;
+ TopExp_Explorer Exp(ResSh, TopAbs_EDGE);
+ for (; Exp.More(); Exp.Next()) {
+ SubShapes.Bind(Exp.Current(),Exp.Current());
+ }
+
+ // Naming of modified faces:
+ TNaming_Builder genEdB (theResultLabel.NewChild()); //FindChild(1,Standard_True));
+ DNaming::LoadAndOrientGeneratedShapes (MS, ObjSh, TopAbs_FACE, genEdB,SubShapes);
+ DNaming::LoadAndOrientGeneratedShapes (MS, ToolSh, TopAbs_FACE, genEdB, SubShapes);
+
+}
//=======================================================================
//function : CheckAndLoad
//purpose : checks result of operation and performs Topological Naming
else if(theFunction->GetDriverGUID() == CUT_GUID) {
LoadNamingDS(RESPOSITION(theFunction), theMkOpe); // the same naming only for case of solids
} else if(theFunction->GetDriverGUID() == COMMON_GUID) {
- LoadNamingDS(RESPOSITION(theFunction), theMkOpe);
- }
+ LoadNamingDS(RESPOSITION(theFunction), theMkOpe);
+ } else if(theFunction->GetDriverGUID() == SECTION_GUID) {
+ LoadSectionNDS(RESPOSITION(theFunction), theMkOpe);
+ }
theFunction->SetFailure(DONE);
return Standard_True;
Standard_Boolean aRes(Standard_False);
if(!isBuilt) {
- aDMap.Bind("PntXYZ", PNTXYZ_GUID);
- aDMap.Bind("PntRLT", PNTRLT_GUID);
- aDMap.Bind("Line3D", LINE3D_GUID);
- aDMap.Bind("Box", BOX_GUID);//+
- aDMap.Bind("Sph", SPH_GUID);//+
- aDMap.Bind("Cyl", CYL_GUID);//+
- aDMap.Bind("Cut", CUT_GUID);//+
- aDMap.Bind("Fuse", FUSE_GUID);//+
- aDMap.Bind("Comm", COMMON_GUID);//+
- aDMap.Bind("Prism", PRISM_GUID);//+
- aDMap.Bind("FulRevol", FULREVOL_GUID);//+
- aDMap.Bind("SecRevol", SECREVOL_GUID);//+
- aDMap.Bind("PMirr", PMIRR_GUID);//+
- aDMap.Bind("PTxyz", PTXYZ_GUID);//+
- aDMap.Bind("PTALine", PTALINE_GUID);//+
- aDMap.Bind("PRLine", PRRLINE_GUID);//+
- aDMap.Bind("Fillet",FILLT_GUID);//+
- aDMap.Bind("Attach",ATTCH_GUID);//+
- aDMap.Bind("XAttach",XTTCH_GUID);//+
+ aDMap.Bind("PntXYZ", PNTXYZ_GUID);
+ aDMap.Bind("PntRLT", PNTRLT_GUID);
+ aDMap.Bind("Line3D", LINE3D_GUID);
+ aDMap.Bind("Box", BOX_GUID);
+ aDMap.Bind("Sph", SPH_GUID);
+ aDMap.Bind("Cyl", CYL_GUID);
+ aDMap.Bind("Cut", CUT_GUID);
+ aDMap.Bind("Fuse", FUSE_GUID);
+ aDMap.Bind("Comm", COMMON_GUID);
+ aDMap.Bind("Prism", PRISM_GUID);
+ aDMap.Bind("FulRevol", FULREVOL_GUID);
+ aDMap.Bind("SecRevol", SECREVOL_GUID);
+ aDMap.Bind("PMirr", PMIRR_GUID);
+ aDMap.Bind("PTxyz", PTXYZ_GUID);
+ aDMap.Bind("PTALine", PTALINE_GUID);
+ aDMap.Bind("PRLine", PRRLINE_GUID);
+ aDMap.Bind("Fillet", FILLT_GUID);
+ aDMap.Bind("Attach", ATTCH_GUID);
+ aDMap.Bind("XAttach", XTTCH_GUID);
+ aDMap.Bind("Section", SECTION_GUID);
isBuilt = Standard_True;
}
aDrv = new DNaming_PointDriver();
else if(name == "PntRLT")
aDrv = new DNaming_PointDriver();
-else if(name == "Line3D")
+ else if(name == "Line3D")
aDrv = new DNaming_Line3DDriver();
+ else if(name == "Section")
+ aDrv = new DNaming_BooleanOperationDriver();
else
cout << "the specified driver is not supported" <<endl;
return aDrv;
return 1;
}
+//=======================================================================
+//function : DNaming_AddSection
+//purpose : "AddSection Doc Object Tool"
+//=======================================================================
+
+ static Standard_Integer DNaming_AddSection (Draw_Interpretor& theDI,
+ Standard_Integer theNb, const char** theArg)
+ {
+ if (theNb == 4) {
+
+ Handle(TDocStd_Document) aDocument;
+ Standard_CString aDocS(theArg[1]);
+ if (!DDocStd::GetDocument(aDocS, aDocument)) return 1;
+
+ Handle(TDataStd_UAttribute) anObject, aTool;
+ if (!DDocStd::Find(aDocument, theArg[2], GEOMOBJECT_GUID, anObject)) return 1;
+ if (!DDocStd::Find(aDocument, theArg[3], GEOMOBJECT_GUID, aTool)) return 1;
+ Standard_GUID funGUID;
+ if(!GetFuncGUID("Section",funGUID)) return 1;
+ Handle(TFunction_Function) aFun = SetFunctionDS(anObject->Label(), funGUID);
+ if(aFun.IsNull()) return 1;
+ TDataStd_Name::Set(aFun->Label(), "Section");
+
+ TDF_Reference::Set(anObject->Label(), aFun->Label().FindChild(FUNCTION_RESULT_LABEL)); //result is here
+ DNaming::SetObjectArg(aFun, BOOL_TOOL, aTool);
+ DDF::ReturnLabel(theDI, aFun->Label());
+ return 0;
+ }
+ cout << "DModel_AddSection : Error" << endl;
+ return 1;
+ }
+
//=======================================================================
//function : DNaming_AddFillet
//purpose : "AddFillet Doc Object Radius Path "
theCommands.Add ("AddCommon", "AddCommon Doc Object Tool", __FILE__, DNaming_AddCommon, g2);
+ theCommands.Add ("AddSection", "AddSection Doc Object Tool", __FILE__, DNaming_AddSection, g2);
+
theCommands.Add ("AddFillet",
"AddFillet Doc Object Radius Path [SurfaceType(0-Rational;1-QuasiAngular;2-Polynomial)]",
__FILE__, DNaming_AddFillet, g2);