//pdn,gka 10.06.99 S4189: command DT_ShapeConvertRev added
#include <BRep_Tool.hxx>
+#include <BRep_Builder.hxx>
#include <BRepBuilderAPI.hxx>
#include <BRepBuilderAPI_Transform.hxx>
#include <BRepTools.hxx>
+#include <BRepTools_ReShape.hxx>
#include <DBRep.hxx>
#include <Draw.hxx>
#include <Draw_Interpretor.hxx>
#include <TopoDS_Shell.hxx>
#include <TopoDS_Wire.hxx>
-#include <stdio.h>
+#include <stdio.h>
//#include <SWDRAW_ShapeUpgrade.hxx>
//#include <ShapeUpgrade_SupportModification.hxx>
//#include <ShapeExtend_WireData.hxx>
// a[n-1]= Tolerance
if (n<3) {
- di << "bad number of arguments" <<"\n";
+ di << "bad number of arguments\n";
return 1;
}
// try to read a shape:
TopoDS_Shape inputShape=DBRep::Get(a[2]);
if (inputShape.IsNull()) {
- di << "Unknown shape"<< "\n";
+ di << "Unknown shape\n";
return 1;
}
// a[2] is a shape. managing:
tool.Perform();
TopoDS_Shape res = tool.Result();
- if ( tool.Status ( ShapeExtend_OK ) ) di << "Status: OK" << "\n";
- if ( tool.Status ( ShapeExtend_DONE1 ) ) di << "Status: DONE1" << "\n";
- if ( tool.Status ( ShapeExtend_DONE2 ) ) di << "Status: DONE2" << "\n";
- if ( tool.Status ( ShapeExtend_DONE3 ) ) di << "Status: DONE3" << "\n";
- if ( tool.Status ( ShapeExtend_DONE4 ) ) di << "Status: DONE4" << "\n";
- if ( tool.Status ( ShapeExtend_DONE5 ) ) di << "Status: DONE5" << "\n";
- if ( tool.Status ( ShapeExtend_DONE6 ) ) di << "Status: DONE6" << "\n";
- if ( tool.Status ( ShapeExtend_DONE7 ) ) di << "Status: DONE7" << "\n";
- if ( tool.Status ( ShapeExtend_DONE8 ) ) di << "Status: DONE8" << "\n";
- if ( tool.Status ( ShapeExtend_FAIL1 ) ) di << "Status: FAIL1" << "\n";
- if ( tool.Status ( ShapeExtend_FAIL2 ) ) di << "Status: FAIL2" << "\n";
- if ( tool.Status ( ShapeExtend_FAIL3 ) ) di << "Status: FAIL3" << "\n";
- if ( tool.Status ( ShapeExtend_FAIL4 ) ) di << "Status: FAIL4" << "\n";
- if ( tool.Status ( ShapeExtend_FAIL5 ) ) di << "Status: FAIL5" << "\n";
- if ( tool.Status ( ShapeExtend_FAIL6 ) ) di << "Status: FAIL6" << "\n";
- if ( tool.Status ( ShapeExtend_FAIL7 ) ) di << "Status: FAIL7" << "\n";
- if ( tool.Status ( ShapeExtend_FAIL8 ) ) di << "Status: FAIL8" << "\n";
+ if ( tool.Status ( ShapeExtend_OK ) ) di << "Status: OK\n";
+ if ( tool.Status ( ShapeExtend_DONE1 ) ) di << "Status: DONE1\n";
+ if ( tool.Status ( ShapeExtend_DONE2 ) ) di << "Status: DONE2\n";
+ if ( tool.Status ( ShapeExtend_DONE3 ) ) di << "Status: DONE3\n";
+ if ( tool.Status ( ShapeExtend_DONE4 ) ) di << "Status: DONE4\n";
+ if ( tool.Status ( ShapeExtend_DONE5 ) ) di << "Status: DONE5\n";
+ if ( tool.Status ( ShapeExtend_DONE6 ) ) di << "Status: DONE6\n";
+ if ( tool.Status ( ShapeExtend_DONE7 ) ) di << "Status: DONE7\n";
+ if ( tool.Status ( ShapeExtend_DONE8 ) ) di << "Status: DONE8\n";
+ if ( tool.Status ( ShapeExtend_FAIL1 ) ) di << "Status: FAIL1\n";
+ if ( tool.Status ( ShapeExtend_FAIL2 ) ) di << "Status: FAIL2\n";
+ if ( tool.Status ( ShapeExtend_FAIL3 ) ) di << "Status: FAIL3\n";
+ if ( tool.Status ( ShapeExtend_FAIL4 ) ) di << "Status: FAIL4\n";
+ if ( tool.Status ( ShapeExtend_FAIL5 ) ) di << "Status: FAIL5\n";
+ if ( tool.Status ( ShapeExtend_FAIL6 ) ) di << "Status: FAIL6\n";
+ if ( tool.Status ( ShapeExtend_FAIL7 ) ) di << "Status: FAIL7\n";
+ if ( tool.Status ( ShapeExtend_FAIL8 ) ) di << "Status: FAIL8\n";
// fixes
Standard_Integer n, const char** a)
{
if (n<5) {
- di << "bad number of arguments" <<"\n";
+ di << "bad number of arguments\n";
return 1;
}
// try to read a shape:
TopoDS_Shape inputShape=DBRep::Get(a[2]);
if (inputShape.IsNull()) {
- di << "Unknown shape"<< "\n";
+ di << "Unknown shape\n";
return 1;
}
Standard_Integer c2d = Draw::Atoi(a[3]);
Standard_Integer c3d = Draw::Atoi(a[4]);
TopoDS_Shape revsh = ShapeCustom::ConvertToRevolution (inputShape);
- if (revsh.IsNull()) { di<<"NO RESULT"<<"\n"; return 1; }
- else if (revsh == inputShape) { di<<"No modif"<<"\n";}
- else di<<"ConvertToRevolution -> Result : "<<"\n";
+ if (revsh.IsNull()) { di<<"NO RESULT\n"; return 1; }
+ else if (revsh == inputShape) { di<<"No modif\n";}
+ else di<<"ConvertToRevolution -> Result : \n";
ShapeUpgrade_ShapeConvertToBezier tool(revsh);
tool.SetSurfaceConversion(Standard_True);
tool.Perform();
TopoDS_Shape res = tool.Result();
- if ( tool.Status ( ShapeExtend_OK ) ) di << "Status: OK" << "\n";
- if ( tool.Status ( ShapeExtend_DONE1 ) ) di << "Status: DONE1" << "\n";
- if ( tool.Status ( ShapeExtend_DONE2 ) ) di << "Status: DONE2" << "\n";
- if ( tool.Status ( ShapeExtend_DONE3 ) ) di << "Status: DONE3" << "\n";
- if ( tool.Status ( ShapeExtend_DONE4 ) ) di << "Status: DONE4" << "\n";
- if ( tool.Status ( ShapeExtend_DONE5 ) ) di << "Status: DONE5" << "\n";
- if ( tool.Status ( ShapeExtend_DONE6 ) ) di << "Status: DONE6" << "\n";
- if ( tool.Status ( ShapeExtend_DONE7 ) ) di << "Status: DONE7" << "\n";
- if ( tool.Status ( ShapeExtend_DONE8 ) ) di << "Status: DONE8" << "\n";
- if ( tool.Status ( ShapeExtend_FAIL1 ) ) di << "Status: FAIL1" << "\n";
- if ( tool.Status ( ShapeExtend_FAIL2 ) ) di << "Status: FAIL2" << "\n";
- if ( tool.Status ( ShapeExtend_FAIL3 ) ) di << "Status: FAIL3" << "\n";
- if ( tool.Status ( ShapeExtend_FAIL4 ) ) di << "Status: FAIL4" << "\n";
- if ( tool.Status ( ShapeExtend_FAIL5 ) ) di << "Status: FAIL5" << "\n";
- if ( tool.Status ( ShapeExtend_FAIL6 ) ) di << "Status: FAIL6" << "\n";
- if ( tool.Status ( ShapeExtend_FAIL7 ) ) di << "Status: FAIL7" << "\n";
- if ( tool.Status ( ShapeExtend_FAIL8 ) ) di << "Status: FAIL8" << "\n";
+ if ( tool.Status ( ShapeExtend_OK ) ) di << "Status: OK\n";
+ if ( tool.Status ( ShapeExtend_DONE1 ) ) di << "Status: DONE1\n";
+ if ( tool.Status ( ShapeExtend_DONE2 ) ) di << "Status: DONE2\n";
+ if ( tool.Status ( ShapeExtend_DONE3 ) ) di << "Status: DONE3\n";
+ if ( tool.Status ( ShapeExtend_DONE4 ) ) di << "Status: DONE4\n";
+ if ( tool.Status ( ShapeExtend_DONE5 ) ) di << "Status: DONE5\n";
+ if ( tool.Status ( ShapeExtend_DONE6 ) ) di << "Status: DONE6\n";
+ if ( tool.Status ( ShapeExtend_DONE7 ) ) di << "Status: DONE7\n";
+ if ( tool.Status ( ShapeExtend_DONE8 ) ) di << "Status: DONE8\n";
+ if ( tool.Status ( ShapeExtend_FAIL1 ) ) di << "Status: FAIL1\n";
+ if ( tool.Status ( ShapeExtend_FAIL2 ) ) di << "Status: FAIL2\n";
+ if ( tool.Status ( ShapeExtend_FAIL3 ) ) di << "Status: FAIL3\n";
+ if ( tool.Status ( ShapeExtend_FAIL4 ) ) di << "Status: FAIL4\n";
+ if ( tool.Status ( ShapeExtend_FAIL5 ) ) di << "Status: FAIL5\n";
+ if ( tool.Status ( ShapeExtend_FAIL6 ) ) di << "Status: FAIL6\n";
+ if ( tool.Status ( ShapeExtend_FAIL7 ) ) di << "Status: FAIL7\n";
+ if ( tool.Status ( ShapeExtend_FAIL8 ) ) di << "Status: FAIL8\n";
// fixes
TopoDS_Face inputFace = TopoDS::Face(inputShape);
if (inputFace.IsNull()) {
- di << a[2] << " is not a face" << "\n";
+ di << a[2] << " is not a face\n";
return 1;
}
ShapeUpgrade_Error theError=theTool.Error();
di << "Not done: error=";
if (theError==ShapeUpgrade_Done)
- di << "Done"<<"\n";
+ di << "Done\n";
else if (theError==ShapeUpgrade_NotDone)
- di << "NotDone"<<"\n";
+ di << "NotDone\n";
else if (theError==ShapeUpgrade_EmptyShell)
- di << "EmptyShell"<<"\n";
+ di << "EmptyShell\n";
else if (theError==ShapeUpgrade_InvalidCriterion)
- di << "InvalidCriterion"<<"\n";
+ di << "InvalidCriterion\n";
else if (theError==ShapeUpgrade_InvalidGridSurface)
- di << "InvalidGridSurface"<<"\n";
+ di << "InvalidGridSurface\n";
else if (theError==ShapeUpgrade_DegeneratedEdge)
- di << "DegeneratedEdge"<<"\n";
+ di << "DegeneratedEdge\n";
else if (theError==ShapeUpgrade_NoSurface)
- di << "NoSurface"<<"\n";
+ di << "NoSurface\n";
else if (theError==ShapeUpgrade_NoTolerance)
- di << "NoTolerance"<<"\n";
+ di << "NoTolerance\n";
return 1;
}
TopoDS_Shell res = theTool.Shell();
if (n>=5) {
TopoDS_Shape inputBoundary=DBRep::Get(a[3]);
if (inputBoundary.IsNull()) {
- di << "Invalid Boundary" << "\n";
+ di << "Invalid Boundary\n";
return 1;
}
TopoDS_Wire WireBoundary = TopoDS::Wire(inputBoundary);
// DT_ShapeDivide result Surface Wire Surf Tol
Handle(Geom_Surface) WireSupport = DrawTrSurf::GetSurface(a[4]);
if (WireSupport.IsNull()) {
- di << "Invalid Surface supporting the Wire" << "\n";
+ di << "Invalid Surface supporting the Wire\n";
return 1;
}
theTool.SetBoundary(WireBoundary, WireSupport);
// DT_ShapeDivide result NbU NbV {Surf_u_v...} Face Tol
// DT_ShapeDivide result NbU NbV {Surf_u_v...} Wire Surf Tol
if (n<6) {
- di << "bad number of arguments for grid input" <<"\n";
+ di << "bad number of arguments for grid input\n";
return 1;
}
// number of surf:
Standard_Integer NbU=Draw::Atoi(a[2]);
Standard_Integer NbV=Draw::Atoi(a[3]);
if (n < 4+NbU*NbV+1) {
- di << "bad number of arguments" <<"\n";
+ di << "bad number of arguments\n";
return 1;
}
if (n>=6+NbU*NbV) {
TopoDS_Shape inputBoundary=DBRep::Get(a[4+NbU*NbV]);
if (inputBoundary.IsNull()) {
- di << "Invalid Boundary" << "\n";
+ di << "Invalid Boundary\n";
return 1;
}
TopoDS_Wire WireBoundary = TopoDS::Wire(inputBoundary);
// DT_ShapeDivide result Surface Wire Surf Tol
Handle(Geom_Surface) WireSupport = DrawTrSurf::GetSurface(a[4+NbU*NbV+1]);
if (WireSupport.IsNull()) {
- di << "Invalid Surface supporting the Wire" << "\n";
+ di << "Invalid Surface supporting the Wire\n";
return 1;
}
theTool.SetBoundary(WireBoundary, WireSupport);
ShapeUpgrade_Error theError=theTool.Error();
di << "Not done: error=";
if (theError==ShapeUpgrade_Done)
- di << "Done"<<"\n";
+ di << "Done\n";
else if (theError==ShapeUpgrade_NotDone)
- di << "NotDone"<<"\n";
+ di << "NotDone\n";
else if (theError==ShapeUpgrade_EmptyShell)
- di << "EmptyShell"<<"\n";
+ di << "EmptyShell\n";
else if (theError==ShapeUpgrade_InvalidCriterion)
- di << "InvalidCriterion"<<"\n";
+ di << "InvalidCriterion\n";
else if (theError==ShapeUpgrade_InvalidGridSurface)
- di << "InvalidGridSurface"<<"\n";
+ di << "InvalidGridSurface\n";
else if (theError==ShapeUpgrade_DegeneratedEdge)
- di << "DegeneratedEdge"<<"\n";
+ di << "DegeneratedEdge\n";
else if (theError==ShapeUpgrade_NoSurface)
- di << "NoSurface"<<"\n";
+ di << "NoSurface\n";
else if (theError==ShapeUpgrade_NoTolerance)
- di << "NoTolerance"<<"\n";
+ di << "NoTolerance\n";
return 1;
}
Standard_Integer n, const char** a)
{
if (n<5) {
- di << "bad number of arguments" <<"\n";
+ di << "bad number of arguments\n";
return 1;
}
// try to read a shape:
TopoDS_Shape inputShape=DBRep::Get(a[2]);
if (inputShape.IsNull()) {
- di << "Unknown shape"<< "\n";
+ di << "Unknown shape\n";
return 1;
}
tool.Perform();
TopoDS_Shape res = tool.Result();
- if ( tool.Status ( ShapeExtend_OK ) ) di << "Status: OK" << "\n";
- if ( tool.Status ( ShapeExtend_DONE1 ) ) di << "Status: DONE1" << "\n";
- if ( tool.Status ( ShapeExtend_DONE2 ) ) di << "Status: DONE2" << "\n";
- if ( tool.Status ( ShapeExtend_DONE3 ) ) di << "Status: DONE3" << "\n";
- if ( tool.Status ( ShapeExtend_DONE4 ) ) di << "Status: DONE4" << "\n";
- if ( tool.Status ( ShapeExtend_DONE5 ) ) di << "Status: DONE5" << "\n";
- if ( tool.Status ( ShapeExtend_DONE6 ) ) di << "Status: DONE6" << "\n";
- if ( tool.Status ( ShapeExtend_DONE7 ) ) di << "Status: DONE7" << "\n";
- if ( tool.Status ( ShapeExtend_DONE8 ) ) di << "Status: DONE8" << "\n";
- if ( tool.Status ( ShapeExtend_FAIL1 ) ) di << "Status: FAIL1" << "\n";
- if ( tool.Status ( ShapeExtend_FAIL2 ) ) di << "Status: FAIL2" << "\n";
- if ( tool.Status ( ShapeExtend_FAIL3 ) ) di << "Status: FAIL3" << "\n";
- if ( tool.Status ( ShapeExtend_FAIL4 ) ) di << "Status: FAIL4" << "\n";
- if ( tool.Status ( ShapeExtend_FAIL5 ) ) di << "Status: FAIL5" << "\n";
- if ( tool.Status ( ShapeExtend_FAIL6 ) ) di << "Status: FAIL6" << "\n";
- if ( tool.Status ( ShapeExtend_FAIL7 ) ) di << "Status: FAIL7" << "\n";
- if ( tool.Status ( ShapeExtend_FAIL8 ) ) di << "Status: FAIL8" << "\n";
+ if ( tool.Status ( ShapeExtend_OK ) ) di << "Status: OK\n";
+ if ( tool.Status ( ShapeExtend_DONE1 ) ) di << "Status: DONE1\n";
+ if ( tool.Status ( ShapeExtend_DONE2 ) ) di << "Status: DONE2\n";
+ if ( tool.Status ( ShapeExtend_DONE3 ) ) di << "Status: DONE3\n";
+ if ( tool.Status ( ShapeExtend_DONE4 ) ) di << "Status: DONE4\n";
+ if ( tool.Status ( ShapeExtend_DONE5 ) ) di << "Status: DONE5\n";
+ if ( tool.Status ( ShapeExtend_DONE6 ) ) di << "Status: DONE6\n";
+ if ( tool.Status ( ShapeExtend_DONE7 ) ) di << "Status: DONE7\n";
+ if ( tool.Status ( ShapeExtend_DONE8 ) ) di << "Status: DONE8\n";
+ if ( tool.Status ( ShapeExtend_FAIL1 ) ) di << "Status: FAIL1\n";
+ if ( tool.Status ( ShapeExtend_FAIL2 ) ) di << "Status: FAIL2\n";
+ if ( tool.Status ( ShapeExtend_FAIL3 ) ) di << "Status: FAIL3\n";
+ if ( tool.Status ( ShapeExtend_FAIL4 ) ) di << "Status: FAIL4\n";
+ if ( tool.Status ( ShapeExtend_FAIL5 ) ) di << "Status: FAIL5\n";
+ if ( tool.Status ( ShapeExtend_FAIL6 ) ) di << "Status: FAIL6\n";
+ if ( tool.Status ( ShapeExtend_FAIL7 ) ) di << "Status: FAIL7\n";
+ if ( tool.Status ( ShapeExtend_FAIL8 ) ) di << "Status: FAIL8\n";
// fixes
Standard_Integer n, const char** a)
{
if (n<3) {
- di << "bad number of arguments" <<"\n";
+ di << "bad number of arguments\n";
return 1;
}
TopoDS_Shape inputShape=DBRep::Get(a[2]);
if (inputShape.IsNull()) {
- di << "Unknown shape"<< "\n";
+ di << "Unknown shape\n";
return 1;
}
tool.Perform();
TopoDS_Shape res = tool.Result();
- if ( tool.Status ( ShapeExtend_OK ) ) di << "Status: OK" << "\n";
- if ( tool.Status ( ShapeExtend_DONE1 ) ) di << "Status: DONE1" << "\n";
- if ( tool.Status ( ShapeExtend_DONE2 ) ) di << "Status: DONE2" << "\n";
- if ( tool.Status ( ShapeExtend_DONE3 ) ) di << "Status: DONE3" << "\n";
- if ( tool.Status ( ShapeExtend_DONE4 ) ) di << "Status: DONE4" << "\n";
- if ( tool.Status ( ShapeExtend_DONE5 ) ) di << "Status: DONE5" << "\n";
- if ( tool.Status ( ShapeExtend_DONE6 ) ) di << "Status: DONE6" << "\n";
- if ( tool.Status ( ShapeExtend_DONE7 ) ) di << "Status: DONE7" << "\n";
- if ( tool.Status ( ShapeExtend_DONE8 ) ) di << "Status: DONE8" << "\n";
- if ( tool.Status ( ShapeExtend_FAIL1 ) ) di << "Status: FAIL1" << "\n";
- if ( tool.Status ( ShapeExtend_FAIL2 ) ) di << "Status: FAIL2" << "\n";
- if ( tool.Status ( ShapeExtend_FAIL3 ) ) di << "Status: FAIL3" << "\n";
- if ( tool.Status ( ShapeExtend_FAIL4 ) ) di << "Status: FAIL4" << "\n";
- if ( tool.Status ( ShapeExtend_FAIL5 ) ) di << "Status: FAIL5" << "\n";
- if ( tool.Status ( ShapeExtend_FAIL6 ) ) di << "Status: FAIL6" << "\n";
- if ( tool.Status ( ShapeExtend_FAIL7 ) ) di << "Status: FAIL7" << "\n";
- if ( tool.Status ( ShapeExtend_FAIL8 ) ) di << "Status: FAIL8" << "\n";
+ if ( tool.Status ( ShapeExtend_OK ) ) di << "Status: OK\n";
+ if ( tool.Status ( ShapeExtend_DONE1 ) ) di << "Status: DONE1\n";
+ if ( tool.Status ( ShapeExtend_DONE2 ) ) di << "Status: DONE2\n";
+ if ( tool.Status ( ShapeExtend_DONE3 ) ) di << "Status: DONE3\n";
+ if ( tool.Status ( ShapeExtend_DONE4 ) ) di << "Status: DONE4\n";
+ if ( tool.Status ( ShapeExtend_DONE5 ) ) di << "Status: DONE5\n";
+ if ( tool.Status ( ShapeExtend_DONE6 ) ) di << "Status: DONE6\n";
+ if ( tool.Status ( ShapeExtend_DONE7 ) ) di << "Status: DONE7\n";
+ if ( tool.Status ( ShapeExtend_DONE8 ) ) di << "Status: DONE8\n";
+ if ( tool.Status ( ShapeExtend_FAIL1 ) ) di << "Status: FAIL1\n";
+ if ( tool.Status ( ShapeExtend_FAIL2 ) ) di << "Status: FAIL2\n";
+ if ( tool.Status ( ShapeExtend_FAIL3 ) ) di << "Status: FAIL3\n";
+ if ( tool.Status ( ShapeExtend_FAIL4 ) ) di << "Status: FAIL4\n";
+ if ( tool.Status ( ShapeExtend_FAIL5 ) ) di << "Status: FAIL5\n";
+ if ( tool.Status ( ShapeExtend_FAIL6 ) ) di << "Status: FAIL6\n";
+ if ( tool.Status ( ShapeExtend_FAIL7 ) ) di << "Status: FAIL7\n";
+ if ( tool.Status ( ShapeExtend_FAIL8 ) ) di << "Status: FAIL8\n";
// fixes
// a[3]= Tolerance
if (n !=4) {
- di << "bad number of arguments" <<"\n";
+ di << "bad number of arguments\n";
return 1;
}
TopoDS_Shape inputShape=DBRep::Get(a[2]);
TopoDS_Face inputFace = TopoDS::Face(inputShape);
if (inputFace.IsNull()) {
- di << a[2] << " is not a face" << "\n";
+ di << a[2] << " is not a face\n";
return 1;
}
//theTool.SetTolerance(Tol);
theTool.Build();
if (!theTool.IsDone()) {
- di << "Not done" << "\n";
+ di << "Not done\n";
return 1;
}
Standard_Integer NbU=Draw::Atoi(a[2]);
Standard_Integer NbV=Draw::Atoi(a[3]);
if (n != 4+NbU+NbV+1) {
- di << "bad number of arguments" <<"\n";
+ di << "bad number of arguments\n";
return 1;
}
// a[3]= input Shell
if (n !=4) {
- di << "bad number of arguments" <<"\n";
+ di << "bad number of arguments\n";
return 1;
}
TopoDS_Shape inputShape= DBRep::Get(a[2]);
TopoDS_Face inputFace = TopoDS::Face(inputShape);
if (inputFace.IsNull()) {
- di << a[2] << " is not a face" << "\n";
+ di << a[2] << " is not a face\n";
return 1;
}
inputShape = DBRep::Get(a[3]);
TopoDS_Shell inputShell = TopoDS::Shell(inputShape);
if (inputShell.IsNull()) {
- di << a[3] << " is not a shell" << "\n";
+ di << a[3] << " is not a shell\n";
return 1;
}
// a[2]= Tolerance
if (n < 3) {
- di << "bad number of arguments" <<"\n";
+ di << "bad number of arguments\n";
return 1;
}
// a[2]= Tolerance
if (n < 3) {
- di << "bad number of arguments" <<"\n";
+ di << "bad number of arguments\n";
return 1;
}
{
if (n <3) {
- di << "bad number of arguments" <<"\n";
+ di << "bad number of arguments\n";
return 1;
}
TopoDS_Face source = TopoDS::Face(DBRep::Get(a[2]));
if(source.IsNull()) {
- di <<"Shape is not face"<<"\n";
+ di <<"Shape is not face\n";
return 1;
}
TopoDS_Iterator wi(source);
if(!wi.More()) {
- di <<"Shape is face without wire"<<"\n";
+ di <<"Shape is face without wire\n";
return 1;
}
{
if (n <3) {
- di << "bad number of arguments" <<"\n";
+ di << "bad number of arguments\n";
return 1;
}
TopoDS_Face source = TopoDS::Face(DBRep::Get(a[2]));
if(source.IsNull()) {
- di <<"Shape is not face"<<"\n";
+ di <<"Shape is not face\n";
return 1;
}
Handle(ShapeUpgrade_ShapeDivideContinuity) tool = new ShapeUpgrade_FaceDivideContinuity;
TopoDS_Shape result = tool->Result();
- if ( tool->Status ( ShapeExtend_OK ) ) di << "Status: OK" << "\n";
- if ( tool->Status ( ShapeExtend_DONE1 ) ) di << "Status: DONE1" << "\n";
- if ( tool->Status ( ShapeExtend_DONE2 ) ) di << "Status: DONE2" << "\n";
- if ( tool->Status ( ShapeExtend_DONE3 ) ) di << "Status: DONE3" << "\n";
- if ( tool->Status ( ShapeExtend_DONE4 ) ) di << "Status: DONE4" << "\n";
- if ( tool->Status ( ShapeExtend_DONE5 ) ) di << "Status: DONE5" << "\n";
- if ( tool->Status ( ShapeExtend_DONE6 ) ) di << "Status: DONE6" << "\n";
- if ( tool->Status ( ShapeExtend_DONE7 ) ) di << "Status: DONE7" << "\n";
- if ( tool->Status ( ShapeExtend_DONE8 ) ) di << "Status: DONE8" << "\n";
- if ( tool->Status ( ShapeExtend_FAIL1 ) ) di << "Status: FAIL1" << "\n";
- if ( tool->Status ( ShapeExtend_FAIL2 ) ) di << "Status: FAIL2" << "\n";
- if ( tool->Status ( ShapeExtend_FAIL3 ) ) di << "Status: FAIL3" << "\n";
- if ( tool->Status ( ShapeExtend_FAIL4 ) ) di << "Status: FAIL4" << "\n";
- if ( tool->Status ( ShapeExtend_FAIL5 ) ) di << "Status: FAIL5" << "\n";
- if ( tool->Status ( ShapeExtend_FAIL6 ) ) di << "Status: FAIL6" << "\n";
- if ( tool->Status ( ShapeExtend_FAIL7 ) ) di << "Status: FAIL7" << "\n";
- if ( tool->Status ( ShapeExtend_FAIL8 ) ) di << "Status: FAIL8" << "\n";
+ if ( tool->Status ( ShapeExtend_OK ) ) di << "Status: OK\n";
+ if ( tool->Status ( ShapeExtend_DONE1 ) ) di << "Status: DONE1\n";
+ if ( tool->Status ( ShapeExtend_DONE2 ) ) di << "Status: DONE2\n";
+ if ( tool->Status ( ShapeExtend_DONE3 ) ) di << "Status: DONE3\n";
+ if ( tool->Status ( ShapeExtend_DONE4 ) ) di << "Status: DONE4\n";
+ if ( tool->Status ( ShapeExtend_DONE5 ) ) di << "Status: DONE5\n";
+ if ( tool->Status ( ShapeExtend_DONE6 ) ) di << "Status: DONE6\n";
+ if ( tool->Status ( ShapeExtend_DONE7 ) ) di << "Status: DONE7\n";
+ if ( tool->Status ( ShapeExtend_DONE8 ) ) di << "Status: DONE8\n";
+ if ( tool->Status ( ShapeExtend_FAIL1 ) ) di << "Status: FAIL1\n";
+ if ( tool->Status ( ShapeExtend_FAIL2 ) ) di << "Status: FAIL2\n";
+ if ( tool->Status ( ShapeExtend_FAIL3 ) ) di << "Status: FAIL3\n";
+ if ( tool->Status ( ShapeExtend_FAIL4 ) ) di << "Status: FAIL4\n";
+ if ( tool->Status ( ShapeExtend_FAIL5 ) ) di << "Status: FAIL5\n";
+ if ( tool->Status ( ShapeExtend_FAIL6 ) ) di << "Status: FAIL6\n";
+ if ( tool->Status ( ShapeExtend_FAIL7 ) ) di << "Status: FAIL7\n";
+ if ( tool->Status ( ShapeExtend_FAIL8 ) ) di << "Status: FAIL8\n";
// fixes
// a[4+nbU*nbV]= Tolerance
if (n <4) {
- di << "bad number of arguments" <<"\n";
+ di << "bad number of arguments\n";
return 1;
}
/*
if ( GS.IsNull()) {
// Case of composite grid surface
- di << "composite surf" << "\n";
+ di << "composite surf\n";
Standard_Integer nbU=Draw::Atoi(a[2]);
Standard_Integer nbV=Draw::Atoi(a[3]);
if (nbU==0 || nbV==0) return 1;
theGrid->SetValue(iu,iv,GS);
}
}
- di << "appel a SplitSurface::Init" << "\n";
+ di << "appel a SplitSurface::Init\n";
theTool->Init(theGrid);
}
else {*/
// Case of single surface
- di << "single surf" << "\n";
+ di << "single surf\n";
- di << "appel a SplitSurface::Init" << "\n";
+ di << "appel a SplitSurface::Init\n";
theTool->Init(GS);
if(Split ==1) {
Handle(TColStd_HSequenceOfReal) spval = new TColStd_HSequenceOfReal;
theTool->SetVSplitValues(spval);
}
- di << "appel a SplitSurface::Build" << "\n";
+ di << "appel a SplitSurface::Build\n";
theTool->Build(Standard_True);
- di << "appel a SplitSurface::GlobalU/VKnots" << "\n";
+ di << "appel a SplitSurface::GlobalU/VKnots\n";
Handle(ShapeExtend_CompositeSurface) Grid = theTool->ResSurfaces();
Handle(TColStd_HArray1OfReal) GlobalU=Grid->UJointValues();
Handle(TColStd_HArray1OfReal) GlobalV=Grid->VJointValues();
di <<" "<< GlobalV->Value(iv);
di <<"\n";
-di << "appel a Surfaces" << "\n";
+di << "appel a Surfaces\n";
Handle(TColGeom_HArray2OfSurface) theSurfaces= Grid->Patches();
-di << "transfert resultat" << "\n";
+di << "transfert resultat\n";
Standard_Integer NbRow=theSurfaces->ColLength();
Standard_Integer NbCol=theSurfaces->RowLength();
for (Standard_Integer irow=1; irow<=NbRow; irow++) {
(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
{
if (argc < 4) {
- di<<"result + curve + offset"<<"\n";
+ di<<"result + curve + offset\n";
return 1 /* Error */;
}
(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
{
if (argc < 5) {
- di<<"result + curve + offset + Dir"<<"\n";
+ di<<"result + curve + offset + Dir\n";
return 1 /* Error */;
}
(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
{
if (argc < 5) {
- di << "Split face: splitface result face [u usplit1 usplit2...] [v vsplit1 vsplit2 ...]" << "\n";
+ di << "Split face: splitface result face [u usplit1 usplit2...] [v vsplit1 vsplit2 ...]\n";
return 1;
}
TopoDS_Shape aLocalShape = DBRep::Get(argv[2]) ;
TopoDS_Face face = TopoDS::Face ( aLocalShape );
if ( face.IsNull() ) {
- di << argv[2] << " is not Face" << "\n";
+ di << argv[2] << " is not Face\n";
return 1;
}
Standard_Real val = Draw::Atof ( argv[i] );
TColStd_SequenceOfReal &vals = ( byV ? vval : uval );
if ( vals.Length() >0 && val - vals.Last() < Precision::PConfusion() ) {
- di << "Values should be sorted in increasing order; skipped" << "\n";
+ di << "Values should be sorted in increasing order; skipped\n";
continue;
}
if ( ( byV && ( val < Vf+Precision::PConfusion() ||
val > Vl-Precision::PConfusion() ) ) ||
(!byV && ( val < Uf+Precision::PConfusion() ||
val > Ul-Precision::PConfusion() ) ) ) {
- di << "Values should be inside range of surface; skipped" << "\n";
+ di << "Values should be inside range of surface; skipped\n";
continue;
}
vals.Append ( val );
}
}
if ( uval.Length() <1 && vval.Length() <1 ) {
- di << "No splitting defined" << "\n";
+ di << "No splitting defined\n";
return 1;
}
if ( uval.Length() >0 ) {
}
Handle(ShapeExtend_CompositeSurface) Grid = new ShapeExtend_CompositeSurface;
- if ( ! Grid->Init ( AS ) ) di << "Grid badly connected!" << "\n";
+ if ( ! Grid->Init ( AS ) ) di << "Grid badly connected!\n";
ShapeFix_ComposeShell SUCS;
TopLoc_Location l;
SUCS.SetContext( RS );
SUCS.Perform ();
- if ( SUCS.Status ( ShapeExtend_OK ) ) di << "Status: OK" << "\n";
- if ( SUCS.Status ( ShapeExtend_DONE1 ) ) di << "Status: DONE1" << "\n";
- if ( SUCS.Status ( ShapeExtend_DONE2 ) ) di << "Status: DONE2" << "\n";
- if ( SUCS.Status ( ShapeExtend_DONE3 ) ) di << "Status: DONE3" << "\n";
- if ( SUCS.Status ( ShapeExtend_DONE4 ) ) di << "Status: DONE4" << "\n";
- if ( SUCS.Status ( ShapeExtend_DONE5 ) ) di << "Status: DONE5" << "\n";
- if ( SUCS.Status ( ShapeExtend_DONE6 ) ) di << "Status: DONE6" << "\n";
- if ( SUCS.Status ( ShapeExtend_DONE7 ) ) di << "Status: DONE7" << "\n";
- if ( SUCS.Status ( ShapeExtend_DONE8 ) ) di << "Status: DONE8" << "\n";
- if ( SUCS.Status ( ShapeExtend_FAIL1 ) ) di << "Status: FAIL1" << "\n";
- if ( SUCS.Status ( ShapeExtend_FAIL2 ) ) di << "Status: FAIL2" << "\n";
- if ( SUCS.Status ( ShapeExtend_FAIL3 ) ) di << "Status: FAIL3" << "\n";
- if ( SUCS.Status ( ShapeExtend_FAIL4 ) ) di << "Status: FAIL4" << "\n";
- if ( SUCS.Status ( ShapeExtend_FAIL5 ) ) di << "Status: FAIL5" << "\n";
- if ( SUCS.Status ( ShapeExtend_FAIL6 ) ) di << "Status: FAIL6" << "\n";
- if ( SUCS.Status ( ShapeExtend_FAIL7 ) ) di << "Status: FAIL7" << "\n";
- if ( SUCS.Status ( ShapeExtend_FAIL8 ) ) di << "Status: FAIL8" << "\n";
+ if ( SUCS.Status ( ShapeExtend_OK ) ) di << "Status: OK\n";
+ if ( SUCS.Status ( ShapeExtend_DONE1 ) ) di << "Status: DONE1\n";
+ if ( SUCS.Status ( ShapeExtend_DONE2 ) ) di << "Status: DONE2\n";
+ if ( SUCS.Status ( ShapeExtend_DONE3 ) ) di << "Status: DONE3\n";
+ if ( SUCS.Status ( ShapeExtend_DONE4 ) ) di << "Status: DONE4\n";
+ if ( SUCS.Status ( ShapeExtend_DONE5 ) ) di << "Status: DONE5\n";
+ if ( SUCS.Status ( ShapeExtend_DONE6 ) ) di << "Status: DONE6\n";
+ if ( SUCS.Status ( ShapeExtend_DONE7 ) ) di << "Status: DONE7\n";
+ if ( SUCS.Status ( ShapeExtend_DONE8 ) ) di << "Status: DONE8\n";
+ if ( SUCS.Status ( ShapeExtend_FAIL1 ) ) di << "Status: FAIL1\n";
+ if ( SUCS.Status ( ShapeExtend_FAIL2 ) ) di << "Status: FAIL2\n";
+ if ( SUCS.Status ( ShapeExtend_FAIL3 ) ) di << "Status: FAIL3\n";
+ if ( SUCS.Status ( ShapeExtend_FAIL4 ) ) di << "Status: FAIL4\n";
+ if ( SUCS.Status ( ShapeExtend_FAIL5 ) ) di << "Status: FAIL5\n";
+ if ( SUCS.Status ( ShapeExtend_FAIL6 ) ) di << "Status: FAIL6\n";
+ if ( SUCS.Status ( ShapeExtend_FAIL7 ) ) di << "Status: FAIL7\n";
+ if ( SUCS.Status ( ShapeExtend_FAIL8 ) ) di << "Status: FAIL8\n";
TopoDS_Shape sh = SUCS.Result();
ShapeFix::SameParameter ( sh, Standard_False );
TopoDS_Shape inputShape=DBRep::Get(argv[2]);
if (inputShape.IsNull()) {
- di << "Unknown shape"<< "\n";
+ di << "Unknown shape\n";
return 1;
}
TopoDS_Shape revsh = ShapeCustom::ConvertToRevolution (inputShape);
const char** argv)
{
if (argc<3) {
- di << "bad number of arguments" <<"\n";
+ di << "bad number of arguments\n";
return 1;
}
TopoDS_Shape inputShape=DBRep::Get(argv[2]);
if (inputShape.IsNull()) {
- di << "Unknown shape"<< "\n";
+ di << "Unknown shape\n";
return 1;
}
const char** argv)
{
if (argc<4) {
- di << "bad number of arguments" <<"\n";
+ di << "bad number of arguments\n";
return 1;
}
TopoDS_Shape inputShape=DBRep::Get(argv[2]);
if (inputShape.IsNull()) {
- di << "Unknown shape"<< "\n";
+ di << "Unknown shape\n";
return 1;
}
Standard_Real aMaxArea = Draw::Atof(argv[3]);
const char** argv)
{
if (argc<4) {
- di << "bad number of arguments" <<"\n";
+ di << "bad number of arguments\n";
return 1;
}
Standard_Real aMinArea = Draw::Atof(argv[2]);
TopoDS_Shape inputShape=DBRep::Get(argv[3]);
if (inputShape.IsNull()) {
- di << "Unknown shape"<< "\n";
+ di << "Unknown shape\n";
return 1;
}
Handle(ShapeUpgrade_RemoveInternalWires) aTool;
if(inputShape.ShapeType() < TopAbs_WIRE)
aTool = new ShapeUpgrade_RemoveInternalWires(inputShape);
else {
- di<<"Invalid type of first shape: should be FACE,SHELL,SOLID or COMPOUND"<<"\n";
+ di<<"Invalid type of first shape: should be FACE,SHELL,SOLID or COMPOUND\n";
return 1;
}
else
aTool->Perform();
if(aTool->Status(ShapeExtend_FAIL1))
- di<<"Initial shape has invalid type"<<"\n";
+ di<<"Initial shape has invalid type\n";
else if(aTool->Status(ShapeExtend_FAIL2))
- di<<"Specified sub-shape is not belonged to whole shape"<<"\n";
+ di<<"Specified sub-shape is not belonged to whole shape\n";
if(aTool->Status(ShapeExtend_DONE1)) {
const TopTools_SequenceOfShape& aRemovedWires =aTool->RemovedWires();
- di<<aRemovedWires.Length()<<" internal wires were removed"<<"\n";
+ di<<aRemovedWires.Length()<<" internal wires were removed\n";
}
if(aTool->Status(ShapeExtend_DONE2)) {
const TopTools_SequenceOfShape& aRemovedFaces =aTool->RemovedFaces();
- di<<aRemovedFaces.Length()<<" small faces were removed"<<"\n";
+ di<<aRemovedFaces.Length()<<" small faces were removed\n";
}
TopoDS_Shape res = aTool->GetResult();
const char** argv)
{
if (argc<3) {
- di << "bad number of arguments. Should be: removeloc res shape" <<"\n";
+ di << "bad number of arguments. Should be: removeloc res shape [remove_level(see ShapeEnum)]\n";
return 1;
}
if(aShape.IsNull())
return 1;
ShapeUpgrade_RemoveLocations aRemLoc;
+ if (argc > 3)
+ aRemLoc.SetRemoveLevel((TopAbs_ShapeEnum)Draw::Atoi(argv[3]));
aRemLoc.Remove(aShape);
TopoDS_Shape aNewShape = aRemLoc.GetResult();
//=======================================================================
static Standard_Integer unifysamedom(Draw_Interpretor& di, Standard_Integer n, const char** a)
{
- if (n < 3 || n > 6)
+ if (n < 3)
{
- di << "Use unifysamedom result shape [-f] [-e] [+b]\n";
- di << "where [-f]. [-e], [+b] is available options\n";
- di << "[-f] to switch off 'unify-faces' mode \n";
- di << "[-e] to switch off 'unify-edges' mode\n";
- di << "[+b] to switch on a 'concat bspline' mode\n";
+ di << "Use unifysamedom result shape [s1 s2 ...] [-f] [-e] [+b] [+i] [-t val] [-a val]\n";
+ di << "options:\n";
+ di << "s1 s2 ... to keep the given edges during unification of faces\n";
+ di << "-f to switch off 'unify-faces' mode \n";
+ di << "-e to switch off 'unify-edges' mode\n";
+ di << "+b to switch on 'concat bspline' mode\n";
+ di << "+i to switch on 'allow internal edges' mode\n";
+ di << "-t val to set linear tolerance\n";
+ di << "-a val to set angular tolerance\n";
di << "'unify-faces' and 'unify-edges' modes are switched on by default";
return 1;
}
Standard_Boolean anUFaces = Standard_True;
Standard_Boolean anUEdges = Standard_True;
Standard_Boolean anConBS = Standard_False;
+ Standard_Boolean isAllowInternal = Standard_False;
+ Standard_Real aLinTol = Precision::Confusion();
+ Standard_Real aAngTol = Precision::Angular();
+ TopoDS_Shape aKeepShape;
+ TopTools_MapOfShape aMapOfShapes;
if (n > 3)
for ( int i = 3; i < n; i++ )
{
- if ( !strcmp(a[i], "-f"))
- anUFaces = Standard_False;
- else if (!strcmp(a[i], "-e"))
- anUEdges = Standard_False;
- else if (!strcmp(a[i], "+b"))
- anConBS = Standard_True;
+ aKeepShape = DBRep::Get(a[i]);
+ if (!aKeepShape.IsNull()) {
+ aMapOfShapes.Add(aKeepShape);
+ }
+ else {
+ if ( !strcmp(a[i], "-f"))
+ anUFaces = Standard_False;
+ else if (!strcmp(a[i], "-e"))
+ anUEdges = Standard_False;
+ else if (!strcmp(a[i], "+b"))
+ anConBS = Standard_True;
+ else if (!strcmp(a[i], "+i"))
+ isAllowInternal = Standard_True;
+ else if (!strcmp(a[i], "-t") || !strcmp(a[i], "-a"))
+ {
+ if (++i < n)
+ {
+ (a[i-1][1] == 't' ? aLinTol : aAngTol) = Draw::Atof(a[i]);
+ }
+ else
+ {
+ di << "value expected after " << a[i-1];
+ return 1;
+ }
+ }
+ }
}
Unifier().Initialize(aShape, anUEdges, anUFaces, anConBS);
+ Unifier().KeepShapes(aMapOfShapes);
+ Unifier().AllowInternalEdges(isAllowInternal);
+ Unifier().SetLinearTolerance(aLinTol);
+ Unifier().SetAngularTolerance(aAngTol);
Unifier().Build();
TopoDS_Shape Result = Unifier().Shape();
return 0;
}
-Standard_Integer unifysamedomgen (Draw_Interpretor& di,
- Standard_Integer n,
- const char** a)
+Standard_Integer unifysamedomgen(Draw_Interpretor& di,
+ Standard_Integer n,
+ const char** a)
{
- if (n!=3) {
- di << "use unifysamedomgen newshape oldshape";
+ if (n != 3) {
+ di << "use unifysamedomgen newshape oldshape\n";
return 0;
}
TopoDS_Shape aShape;
- aShape=DBRep::Get(a[2]);
+ aShape = DBRep::Get(a[2]);
if (aShape.IsNull()) {
- di<<" null shape is not allowed here\n";
+ di << "Null shape is not allowed here\n";
return 1;
}
- TopoDS_Shape ResShape = Unifier().Generated(aShape);
- if (ResShape.IsNull()) {
- di << " null shape\n";
+
+ const TopTools_ListOfShape& aLS = Unifier().Generated(aShape);
+
+ if (aLS.Extent() > 1) {
+ BRep_Builder aBB;
+ TopoDS_Compound aRes;
+ aBB.MakeCompound(aRes);
+ TopTools_ListIteratorOfListOfShape aIt(aLS);
+ for (; aIt.More(); aIt.Next()) {
+ const TopoDS_Shape& aCurrentShape = aIt.Value();
+ aBB.Add(aRes, aCurrentShape);
+ }
+ DBRep::Set(a[1], aRes);
+ }
+ else if (aLS.Extent() == 1) {
+ DBRep::Set(a[1], aLS.First());
}
else {
- DBRep::Set(a[1], ResShape);
+ di << "No shapes were generated from the shape\n";
}
return 0;
}
+Standard_Integer unifysamedommod(Draw_Interpretor& di,
+ Standard_Integer n,
+ const char** a)
+{
+ if (n != 3) {
+ di << "use unifysamedommod newshape oldshape\n";
+ return 0;
+ }
+ TopoDS_Shape aShape;
+ aShape = DBRep::Get(a[2]);
+ if (aShape.IsNull()) {
+ di << "Null shape is not allowed here\n";
+ return 1;
+ }
+
+ const TopTools_ListOfShape& aLS = Unifier().Modified(aShape);
+
+ if (aLS.Extent() > 1) {
+ BRep_Builder aBB;
+ TopoDS_Compound aRes;
+ aBB.MakeCompound(aRes);
+ TopTools_ListIteratorOfListOfShape aIt(aLS);
+ for (; aIt.More(); aIt.Next()) {
+ const TopoDS_Shape& aCurrentShape = aIt.Value();
+ aBB.Add(aRes, aCurrentShape);
+ }
+ DBRep::Set(a[1], aRes);
+ }
+ else if (aLS.Extent() == 1) {
+ DBRep::Set(a[1], aLS.First());
+ }
+ else {
+ di << "The shape has not been modified\n";
+ }
+ return 0;
+}
+
+Standard_Integer unifysamedomisdel(Draw_Interpretor& di,
+ Standard_Integer n,
+ const char** a)
+{
+ if (n < 2) {
+ di << "Use: unifysamedomisdel shape\n";
+ return 1;
+ }
+ TopoDS_Shape aShape = DBRep::Get(a[1]);
+ if (aShape.IsNull()) {
+ di << "Null shape is not allowed here\n";
+ return 1;
+ }
+ Standard_Boolean IsDeleted = Unifier().IsDeleted(aShape);
+ di << "The shape has" << (IsDeleted ? " " : " not ") << "been deleted" << "\n";
+ return 0;
+}
static Standard_Integer copytranslate(Draw_Interpretor& di,
Standard_Integer argc,
const char** argv)
{
if (argc<6) {
- di << "bad number of arguments. Should be: removeloc res shape dx dyy dz" <<"\n";
+ di << "bad number of arguments. Should be: copytranslate res shape dx dy dz\n";
return 1;
}
TopoDS_Shape aShape = DBRep::Get(argv[2]);
}
+Standard_Integer reshape(Draw_Interpretor& di,
+ Standard_Integer n,
+ const char** a)
+{
+ if ( n < 3 )
+ {
+ di << "Error: wrong number of arguments. Type 'help " << a[0] << "'\n";
+ return 1;
+ }
+
+ TopoDS_Shape source = DBRep::Get(a[2]);
+ if ( source.IsNull() )
+ {
+ di << "Error: source shape ('" << a[2] << "') is null\n";
+ return 1;
+ }
+
+ Handle(BRepTools_ReShape) ReShaper = new BRepTools_ReShape;
+
+ // Record the requested modifications
+ for ( Standard_Integer i = 1; i < n; ++i )
+ {
+ Standard_CString arg = a[i];
+ TCollection_AsciiString opt(arg);
+ opt.LowerCase();
+
+ if ( opt == "-replace" )
+ {
+ if ( n - i < 3 )
+ {
+ di << "Error: not enough arguments for replacement\n";
+ return 1;
+ }
+
+ TopoDS_Shape what = DBRep::Get(a[++i]);
+ if ( what.IsNull() )
+ {
+ di << "Error: argument shape ('" << a[i] << "') is null\n";
+ return 1;
+ }
+
+ TopoDS_Shape with = DBRep::Get(a[++i]);
+ if ( with.IsNull() )
+ {
+ di << "Error: replacement shape ('" << a[i] << "') is null\n";
+ return 1;
+ }
+
+ ReShaper->Replace(what, with);
+ }
+ else if ( opt == "-remove" )
+ {
+ if ( n - i < 2 )
+ {
+ di << "Error: not enough arguments for removal\n";
+ return 1;
+ }
+
+ TopoDS_Shape what = DBRep::Get(a[++i]);
+ if ( what.IsNull() )
+ {
+ di << "Error: shape to remove ('" << a[i] << "') is null\n";
+ return 1;
+ }
+
+ ReShaper->Remove(what);
+ }
+ }
+
+ // Apply all the recorded modifications
+ TopoDS_Shape result = ReShaper->Apply(source);
+ if ( result.IsNull() )
+ {
+ di << "Error: result shape is null\n";
+ return 1;
+ }
+
+ DBRep::Set(a[1], result);
+ return 0;
+}
+
//=======================================================================
//function : InitCommands
//purpose :
theCommands.Add ("RemoveIntWires","result minarea wholeshape [faces or wires] [moderemoveface ]",
__FILE__,removeinternalwires,g);
- theCommands.Add ("removeloc","result shape",__FILE__,removeloc,g);
+ theCommands.Add ("removeloc","result shape [remove_level(see ShapeEnum)]",__FILE__,removeloc,g);
theCommands.Add ("unifysamedom",
- "unifysamedom result shape [-f] [-e] [+b]", __FILE__,unifysamedom,g);
-
- theCommands.Add ("unifysamedomgen",
- "unifysamedomgen newshape oldshape : get new shape generated "
- "by unifysamedom command from the old one",
- __FILE__,unifysamedomgen,g);
+ "unifysamedom result shape [s1 s2 ...] [-f] [-e] [+b] [+i] [-t val] [-a val]", __FILE__,unifysamedom,g);
+
+ theCommands.Add("unifysamedomgen",
+ "unifysamedomgen newshape oldshape : get new shape generated "
+ "by unifysamedom command from the old one",
+ __FILE__, unifysamedomgen, g);
+
+ theCommands.Add("unifysamedommod",
+ "unifysamedommod newshape oldshape : get new shape modified "
+ "by unifysamedom command from the old one",
+ __FILE__, unifysamedommod, g);
+
+ theCommands.Add("unifysamedomisdel",
+ "unifysamedomisdel shape : shape is deleted ",
+ __FILE__, unifysamedomisdel, g);
theCommands.Add ("copytranslate","result shape dx dy dz",__FILE__,copytranslate,g);
+
+ theCommands.Add ("reshape",
+ "\n Basic utility for topological modification: "
+ "\n '-replace what with' Replaces 'what' sub-shape with 'with' sub-shape"
+ "\n '-remove what' Removes 'what' sub-shape"
+ "\n Requests '-replace' and '-remove' can be repeated many times.",
+ __FILE__, reshape, g);
}