Useless writes of intermediate shapes to hardcoded paths are removed in samples\mfc\standard\02_Modeling\src\ModelingDoc.cpp
Methods IGESBRep::WriteShape(), XSControl_Utils::WriteShape() are deleted; BRepTools::Write() can be used instead.
Method TopOpeBRepBuild_Tools::DumpMapOfShapeWithState() is moved to where it is used -- TopOpeBRepBuild_Builder1_1.cxx as static function (commented out).
Unused DRAW command OCC18612 is removed.
Upgrade Guide is corrected to avoid Doxygen warnings.
The main functionality provided by Local Context - selection of object subparts - can be now used within Neutral Point without opening any Local Context.
-The property *::SelectionMode()* has been removed from the class *AIS_InteractiveObject*.
+The property *SelectionMode()* has been removed from the class *AIS_InteractiveObject*.
This property contradicts to selection logic, since it is allowed to activate several Selection modes at once.
Therefore keeping one selection mode as object field makes no sense.
Applications that used this method should implement selection mode caching at application level, if it is necessary for some reason.
@subsection upgrade_720_removed Removed features
The following obsolete features have been removed:
-* *AIS_InteractiveContext::PreSelectionColor()*, *::DefaultColor()*, *::WasCurrentTouched()*, *::ZDetection()*.
+* *AIS_InteractiveContext::PreSelectionColor()*, *DefaultColor()*, *WasCurrentTouched()*, *ZDetection()*.
These properties were unused, and therefore application should remove occurrences of these methods.
* *AIS_InteractiveObject::SelectionPriority()*.
These property was not implemented.
* Since Highlight and Selection styles within *AIS_InteractiveContext* are now defined by *Prs3d_Drawer* inheriting from *Graphic3d_PresentationAttributes*,
it is now possible to customize default highlight attributes like *Display Mode* and *ZLayer*, which previously could be defined only on Object level.
* Properties *Prs3d_Drawer::HighlightStyle()* and *Prs3d_Drawer::SelectionStyle()* have been removed.
- Instead, *AIS_InteractiveObject* now defines *::DynamicHilightAttributes()* for dynamic highlighting in addition to *::HilightAttributes()* used for highlighting in selected state.
+ Instead, *AIS_InteractiveObject* now defines *DynamicHilightAttributes()* for dynamic highlighting in addition to *HilightAttributes()* used for highlighting in selected state.
* The following protected fields have been removed from class *AIS_InteractiveObject*:
- *myOwnColor*, replaced by *myDrawer->Color()*
- *myTransparency*, replaced by *myDrawer->Transparency()*
asect.Approximation(Standard_True);
asect.Build();
TopoDS_Shape R = asect.Shape();
- BRepTools::Write(R,"E:\\temp\\R");
BRepFeat_SplitShape asplit(S);
PinkFace = BRepBuilderAPI_MakeFace(aFace,Wire1);
BRepLib::BuildCurves3d(PinkFace);
- BRepTools::Write(PinkFace,"E:\\temp\\PinkFace.rle");
-
-
/////////////Display
Handle(AIS_Shape) white = new AIS_Shape(WhiteFace);
myAISContext->SetColor(white,Quantity_NOC_WHITE,Standard_False);
B.Add(FXMAX,W);
- BRepTools::Write(FXMAX,"E:\\temp\\f1.rle");
-
//Face FXMIN
P = new Geom_Plane(gp_Ax2(gp_Pnt(0,0,0),gp_Dir(-1,0,0),gp_Dir(0,0,1)));
B.MakeFace(FXMIN,P,precision);
FYMAX.Orientation(TopAbs_REVERSED);
- BRepTools::Write(FZMIN,"E:\\temp\\f3.rle");
- BRepTools::Write(FYMAX,"E:\\temp\\f2.rle");
-
//Shell
TopoDS_Shell Sh;
B.MakeShell(Sh);
B.MakeSolid(Sol);
B.Add(Sol,Sh);
- BRepTools::Write(Sol,"e://temp//solid");
Handle(AIS_Shape) borne = new AIS_Shape(Sol);
myAISContext->SetDisplayMode (borne, 1, Standard_False);
myAISContext->SetColor (borne, Quantity_NOC_RED, Standard_False);
#include <BRep_Builder.hxx>
#include <BRep_Tool.hxx>
-#include <BRepTools.hxx>
#include <Geom2d_Curve.hxx>
#include <Geom_Curve.hxx>
#include <Geom_Surface.hxx>
#include <TopoDS_Wire.hxx>
#include <XSAlgo.hxx>
-#include <stdio.h>
-/* Just used for WriteShape */
-//:21
-// =========================
-// == Selection Members ==
-// =========================
static Handle(IGESToBRep_AlgoContainer) theContainer;
//=======================================================================
return Standard_False;
}
-//=======================================================================
-//function : WriteShape
-//purpose : Creates a file Shape_'number'
-//=======================================================================
-void IGESToBRep::WriteShape(const TopoDS_Shape& shape,
- const Standard_Integer number)
-{
- char fname[110];
- sprintf(fname, "Shape_%d",number);
- ofstream f(fname,ios::out);
- cout << "Output file name : " << fname << endl;
- f << "DBRep_DrawableShape\n";
-
- BRepTools::Write(shape, f);
- f.close();
-}
-
//=======================================================================
//function : IGESCurveToSequenceOfIGESCurve
//purpose : Creates a sequence of IGES curves from IGES curve:
//! 502, 504, 508, 510, 514, 186.
Standard_EXPORT static Standard_Boolean IsBRepEntity (const Handle(IGESData_IGESEntity)& start);
- //! Creates a file Shape_'number' with the shape being
- //! able to be restored by Draw.
- Standard_EXPORT static void WriteShape (const TopoDS_Shape& shape, const Standard_Integer number);
-
Standard_EXPORT static Standard_Integer IGESCurveToSequenceOfIGESCurve (const Handle(IGESData_IGESEntity)& curve, Handle(TColStd_HSequenceOfTransient)& sequence);
Standard_EXPORT static Standard_Boolean TransferPCurve (const TopoDS_Edge& fromedge, const TopoDS_Edge& toedge, const TopoDS_Face& face);
-
-
-
-protected:
-
-
-
-
-
-private:
-
-
-
-
-friend class IGESToBRep_CurveAndSurface;
-friend class IGESToBRep_BasicSurface;
-friend class IGESToBRep_BasicCurve;
-friend class IGESToBRep_TopoSurface;
-friend class IGESToBRep_TopoCurve;
-friend class IGESToBRep_BRepEntity;
-friend class IGESToBRep_IGESBoundary;
-friend class IGESToBRep_Reader;
-friend class IGESToBRep_Actor;
-friend class IGESToBRep_AlgoContainer;
-friend class IGESToBRep_ToolContainer;
-
};
-
-
-
-
-
-
#endif // _IGESToBRep_HeaderFile
#include <Draw_ProgressIndicator.hxx>
#include <XSControl_WorkSession.hxx>
#include <Transfer_TransientProcess.hxx>
-#include <XSDRAW_Commands.hxx>
#include <TColStd_HSequenceOfTransient.hxx>
#include <Message_ProgressSentry.hxx>
#include <XSControl_TransferReader.hxx>
-static Standard_Integer OCC18612igesbrep (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
- DeclareAndCast(IGESControl_Controller,ctl,XSDRAW::Controller());
- if (ctl.IsNull()) XSDRAW::SetNorm("IGES");
-
- // Progress indicator
- Handle(Draw_ProgressIndicator) progress = new Draw_ProgressIndicator ( di, 1 );
- progress->SetScale ( 0, 100, 1 );
- progress->Show();
-
- IGESControl_Reader Reader (XSDRAW::Session(),Standard_False);
- if (ctl.IsNull())
- ctl=Handle(IGESControl_Controller)::DownCast(XSDRAW::Controller());
-
- TCollection_AsciiString fnom,rnom;
-
- Standard_Boolean modfic = XSDRAW::FileAndVar
- (argv[1],argv[2],"IGESBREP",fnom,rnom);
- if (modfic) di<<" File IGES to read : "<<fnom.ToCString()<<"\n";
- else di<<" Model taken from the session : "<<fnom.ToCString()<<"\n";
- di<<" -- Names of variables BREP-DRAW prefixed by : "<<rnom.ToCString()<<"\n";
- IFSelect_ReturnStatus readstat = IFSelect_RetVoid;
-
-#ifdef CHRONOMESURE
- OSD_Timer Chr; Chr.Reset();
- IDT_SetLevel(3);
-#endif
-
-
-// Reading the file
- progress->NewScope ( 20, "Loading" ); // On average loading takes 20%
- progress->Show();
-
- // *New*
- //In order to decrease number of produced edges during translation it is possible to set following parameter
- Interface_Static::SetIVal("read.iges.bspline.continuity",0);
- // *New*
-
- if (modfic) readstat = Reader.ReadFile (fnom.ToCString());
- else if (XSDRAW::Session()->NbStartingEntities() > 0) readstat = IFSelect_RetDone;
-
- progress->EndScope();
- progress->Show();
-
- if (readstat != IFSelect_RetDone) {
- if (modfic) di<<"Could not read file "<<fnom.ToCString()<<" , abandon\n";
- else di<<"No model loaded\n";
- return 1;
- }
-// Choice of treatment
- Standard_Boolean fromtcl = (argc > 3);
- Standard_Integer modepri = 1, nent, nbs;
- if (fromtcl) modepri = 4;
-
- while (modepri) {
- //Roots for transfer are defined before setting mode ALL or OnlyVisible - gka
- //mode OnlyVisible does not work.
- // nent = Reader.NbRootsForTransfer();
- if (!fromtcl) {
- cout<<"Mode (0 End, 1 Visible Roots, 2 All Roots, 3 Only One Entity, 4 Selection) :"<<flush;
- modepri = -1;
-
-// amv 26.09.2003 : this is used to avoid error of enter's simbol
- char str[80];
- cin>>str;
- modepri = Draw::Atoi(str);
- }
-
- if (modepri == 0) { //fin
- di << "Bye and good luck! \n";
- break;
- }
-
- else if (modepri <= 2) { // 1 : Visible Roots, 2 : All Roots
- di << "All Geometry Transfer\n";
- di<<"spline_continuity (read) : "<<Interface_Static::IVal("read.iges.bspline.continuity")<<" (0 : no modif, 1 : C1, 2 : C2)\n";
- di<<" To modify : command param read.iges.bspline.continuity\n";
- Handle(XSControl_WorkSession) thesession = Reader.WS();
- thesession->ClearContext();
- XSDRAW::SetTransferProcess (thesession->TransferReader()->TransientProcess());
- progress->NewScope ( 80, "Translation" );
- progress->Show();
- thesession->TransferReader()->TransientProcess()->SetProgress ( progress );
-
- if (modepri == 1) Reader.SetReadVisible (Standard_True);
- Reader.TransferRoots();
-
- thesession->TransferReader()->TransientProcess()->SetProgress ( 0 );
- progress->EndScope();
- progress->Show();
- // result in only one shape for all the roots
- // or in one shape for one root.
- di<<"Count of shapes produced : "<<Reader.NbShapes()<<"\n";
- Standard_Integer answer = 1;
- if (Reader.NbShapes() > 1) {
- cout << " pass(0) one shape for all (1)\n or one shape per root (2)\n + WriteBRep (one for all : 3) (one per root : 4) : " << flush;
- answer = -1;
- //amv 26.09.2003
- char str_a[80];
- cin >> str_a;
- answer = Draw::Atoi(str_a);
- }
- if ( answer == 0) continue;
- if ( answer == 1 || answer == 3) {
- TopoDS_Shape shape = Reader.OneShape();
- // save the shape
- if (shape.IsNull()) { di<<"No Shape produced\n"; continue; }
- char fname[110];
- Sprintf(fname, "%s", rnom.ToCString());
- di << "Saving shape in variable Draw : " << fname << "\n";
- if (answer == 3) IGESToBRep::WriteShape (shape,1);
- try {
- OCC_CATCH_SIGNALS
- DBRep::Set(fname,shape);
- }
- catch(Standard_Failure) {
- di << "** Exception : ";
- di << Standard_Failure::Caught()->GetMessageString();
- di<<" ** Skip\n";
- di << "Saving shape in variable Draw : " << fname << "\n";
- IGESToBRep::WriteShape (shape,1);
- }
- }
-
- else if (answer == 2 || answer == 4) {
- Standard_Integer numshape = Reader.NbShapes();
- for (Standard_Integer inum = 1; inum <= numshape; inum++) {
- // save all the shapes
- TopoDS_Shape shape = Reader.Shape(inum);
- if (shape.IsNull()) { di<<"No Shape produced\n"; continue; }
- char fname[110];
- Sprintf(fname, "%s_%d", rnom.ToCString(),inum);
- di << "Saving shape in variable Draw : " << fname << "\n";
- if (answer == 4) IGESToBRep::WriteShape (shape,inum);
- try {
- OCC_CATCH_SIGNALS
- DBRep::Set(fname,shape);
- }
- catch(Standard_Failure) {
- di << "** Exception : ";
- di << Standard_Failure::Caught()->GetMessageString();
- di<<" ** Skip\n";
- }
- }
- }
- else return 0;
- }
-
- else if (modepri == 3) { // One Entity
- cout << "Only One Entity"<<endl;
- cout<<"spline_continuity (read) : "<<Interface_Static::IVal("read.iges.bspline.continuity")<<" (0 : no modif, 1 : C1, 2 : C2)"<<endl;
- cout<<" To modify : command param read.iges.bspline.continuity"<<endl;
- cout << " give the number of the Entity : " << flush;
- nent = XSDRAW::GetEntityNumber();
-
- if (!Reader.TransferOne (nent)) di<<"Transfer entity n0 "<<nent<<" : no result\n";
- else {
- nbs = Reader.NbShapes();
- char shname[30]; Sprintf (shname,"%s_%d",rnom.ToCString(),nent);
- di<<"Transfer entity n0 "<<nent<<" OK -> DRAW Shape: "<<shname<<"\n";
- di<<"Now, "<<nbs<<" Shapes produced\n";
- TopoDS_Shape sh = Reader.Shape(nbs);
- DBRep::Set (shname,sh);
- }
- }
-
- else if (modepri == 4) { // Selection
- Standard_Integer answer = 1;
- Handle(TColStd_HSequenceOfTransient) list;
-
-// Selection, nommee ou via tcl. tcl : raccourcis admis
-// * donne iges-visible + xst-transferrable-roots
-// *r donne xst-model-roots (TOUTES racines)
-
- if( fromtcl && argv[3][0]=='*' && argv[3][1]=='\0' ) {
- di << "All Geometry Transfer\n";
- di<<"spline_continuity (read) : "<<Interface_Static::IVal("read.iges.bspline.continuity")<<" (0 : no modif, 1 : C1, 2 : C2)\n";
- di<<" To modify : command param read.iges.bspline.continuity\n";
- Handle(XSControl_WorkSession) thesession = Reader.WS();
- thesession->ClearContext();
- XSDRAW::SetTransferProcess (thesession->TransferReader()->TransientProcess());
- progress->NewScope ( 80, "Translation" );
- progress->Show();
- thesession->TransferReader()->TransientProcess()->SetProgress ( progress );
-
- Reader.SetReadVisible (Standard_True);
- Reader.TransferRoots();
-
- thesession->TransferReader()->TransientProcess()->SetProgress ( 0 );
- progress->EndScope();
- progress->Show();
-
- // result in only one shape for all the roots
- TopoDS_Shape shape = Reader.OneShape();
- // save the shape
- char fname[110];
- Sprintf(fname, "%s", rnom.ToCString());
- di << "Saving shape in variable Draw : " << fname << "\n";
- try {
- OCC_CATCH_SIGNALS
- DBRep::Set(fname,shape);
- }
- catch(Standard_Failure) {
- di << "** Exception : ";
- di << Standard_Failure::Caught()->GetMessageString();
- di<<" ** Skip\n";
- di << "Saving shape in variable Draw : " << fname << "\n";
- IGESToBRep::WriteShape (shape,1);
- }
- return 0;
- }
-
- if(fromtcl) {
- modepri = 0; // d office, une seule passe
- if (argv[3][0] == '*' && argv[3][1] == 'r' && argv[3][2] == '\0') {
- di<<"All Roots : ";
- list = XSDRAW::GetList ("xst-model-roots");
- }
- else {
- TCollection_AsciiString compart = XSDRAW_CommandPart (argc,argv,3);
- di<<"List given by "<<compart.ToCString()<<" : ";
- list = XSDRAW::GetList (compart.ToCString());
- }
- if (list.IsNull()) {
- di<<"No list defined. Give a selection name or * for all visible transferrable roots\n";
- continue;
- }
- }
- else {
- cout<<"Name of Selection :"<<flush;
- list = XSDRAW::GetList();
- if (list.IsNull()) { cout<<"No list defined"<<endl; continue; }
- }
-
- Standard_Integer nbl = list->Length();
- di<<"Nb entities selected : "<<nbl<<"\n";
- if (nbl == 0) continue;
- while (answer) {
- if (!fromtcl) {
- cout<<"Choice: 0 abandon 1 transfer all 2 with confirmation 3 list n0s ents :"<<flush;
- answer = -1;
- // anv 26.09.2003
- char str_answer[80];
- cin>>str_answer;
- answer = Draw::Atoi(str_answer);
- }
- if (answer <= 0 || answer > 3) continue;
- if (answer == 3) {
- for (Standard_Integer ill = 1; ill <= nbl; ill ++) {
- Handle(Standard_Transient) ent = list->Value(ill);
- di<<" ";// model->Print(ent,di);
- }
- di<<"\n";
- }
- if (answer == 1 || answer == 2) {
- Standard_Integer nbt = 0;
- Handle(XSControl_WorkSession) thesession = Reader.WS();
-
- XSDRAW::SetTransferProcess (thesession->TransferReader()->TransientProcess());
- progress->NewScope ( 80, "Translation" );
- progress->Show();
- thesession->TransferReader()->TransientProcess()->SetProgress ( progress );
-
- Message_ProgressSentry PSentry ( progress, "Root", 0, nbl, 1 );
- for (Standard_Integer ill = 1; ill <= nbl && PSentry.More(); ill ++, PSentry.Next()) {
-
- nent = Reader.Model()->Number(list->Value(ill));
- if (nent == 0) continue;
- if (!Reader.TransferOne(nent)) di<<"Transfer entity n0 "<<nent<<" : no result\n";
- else {
- nbs = Reader.NbShapes();
- char shname[30]; Sprintf (shname,"%s_%d",rnom.ToCString(),nbs);
- di<<"Transfer entity n0 "<<nent<<" OK -> DRAW Shape: "<<shname<<"\n";
- di<<"Now, "<<nbs<<" Shapes produced\n";
- TopoDS_Shape sh = Reader.Shape(nbs);
- DBRep::Set (shname,sh);
- nbt++;
- }
- }
- thesession->TransferReader()->TransientProcess()->SetProgress ( 0 );
- progress->EndScope();
- progress->Show();
- di<<"Nb Shapes successfully produced : "<<nbt<<"\n";
- answer = 0; // on ne reboucle pas
- }
- }
- }
- else di<<"Unknown mode n0 "<<modepri<<"\n";
- }
-
- // *New*
- //In order to clear memory after IGES reading you could add the following code
- const Handle(XSControl_TransferReader) &TR = Reader.WS()->TransferReader();
- const Handle(Transfer_TransientProcess) &TP = TR->TransientProcess();
- TP->Clear();
- TR->Clear(2);
- Reader.WS()->Model()->Clear();
- Standard_Integer i =1;
- for( ; i <= 7; i++)
- Reader.WS()->ClearData(i);
- // *New*
-
- return 0;
-}
-
#include <Geom_Plane.hxx>
static Standard_Integer OCC20766 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
{
theCommands.Add("OCC15755", "OCC15755 file shape", __FILE__, OCC15755, group);
theCommands.Add("OCC16782", "OCC16782 file.std file.xml file.cbf", __FILE__, OCC16782, group);
theCommands.Add("OCC12584", "OCC12584 [mode = 0/1/2]", __FILE__, OCC12584, group);
- theCommands.Add("OCC18612", "OCC18612 [file else already loaded model] [name DRAW]", __FILE__, OCC18612igesbrep, group);
theCommands.Add("OCC20766", "OCC20766 plane a b c d", __FILE__, OCC20766, group);
theCommands.Add("OCC20627", "OCC20627", __FILE__, OCC20627, group);
theCommands.Add("OCC17424", "OCC17424 shape X_Pnt Y_Pnt Z_Pnt X_Dir Y_Dir Z_Dir PInf", __FILE__, OCC17424, group);
extern Standard_Boolean GLOBAL_faces2d;
-//modified by NIZNHY-PKV Mon Dec 16 11:38:55 2002 f
//=======================================================================
//function : ~TopOpeBRepBuild_Builder1
//purpose :
theUsedVertexMap.Clear();
theUnkStateVer.Clear();
}
-//modified by NIZNHY-PKV Mon Dec 16 11:38:59 2002 t
+
+/*
+namespace {
+
+void DumpMapOfShapeWithState (const Standard_Integer iP,
+ const TopOpeBRepDS_IndexedDataMapOfShapeWithState& aMapOfShapeWithState)
+{
+ static Standard_Integer cnt=0;
+ TCollection_AsciiString aFName1 ("/DEBUG/TOPOPE/"), postfix;
+
+ Standard_CString ShapeType [9] = {"COMPO", "COMPS", "SOLID", "SHELL", "FACE ", "WIRE ", "EDGE ", "VERTX"};
+ Standard_CString ShapeState[4] = {"IN ", "OUT", "ON ", "UNKNOWN"};
+
+ printf("\n\n********************************\n");
+ printf("* *\n");
+ Standard_Integer i, n=aMapOfShapeWithState.Extent();
+ if (!iP) {
+ printf("* Object comparing with TOOL *\n");
+ postfix=TCollection_AsciiString("Obj");
+ }
+
+ else {
+ printf("* Tool comparing with Object *\n");
+ postfix=TCollection_AsciiString("Tool");
+ }
+
+ printf("* *\n");
+ printf("********************************\n");
+ printf("*** aMapOfShapeWithState.Extent()=%d\n", n);
+ printf(" C O N T E N T S\n");
+
+ TCollection_AsciiString aFName;
+ aFName+=aFName1;
+ aFName+=postfix;
+
+ for (i=1; i<=n; i++) {
+ TCollection_AsciiString aI(i), aName;;
+ aName+=aFName; aName+=aI;
+
+ const TopoDS_Shape& aShape=aMapOfShapeWithState.FindKey(i);
+ const TopOpeBRepDS_ShapeWithState& aShapeWithState=
+ aMapOfShapeWithState.FindFromIndex(i);
+
+ BRepTools::Write (aShape, aName.ToCString());
+
+ TCollection_AsciiString ann;
+ ann+=postfix; ann+=aI;
+
+ printf("Key: %-8s , " , ann.ToCString());
+ printf("%s, ", ShapeType[aShape.ShapeType()]);
+ if (!iP)
+ printf("State comp.with Tool=%s\n", ShapeState[aShapeWithState.State()]);
+
+ else
+ printf("State comp.with Obj =%s\n", ShapeState[aShapeWithState.State()]);
+
+ if (aShapeWithState.IsSplitted()) {
+
+ const TopTools_ListOfShape& aListOfShape=aShapeWithState.Part(TopAbs_IN);
+ TopTools_ListIteratorOfListOfShape anIt(aListOfShape);
+ for (;anIt.More(); anIt.Next()) {
+ const TopoDS_Shape& aS=anIt.Value();
+
+ TCollection_AsciiString cn(cnt), prefix("_S_"), sn;
+ sn+=aFName; sn+=prefix; sn+=cn;
+ BRepTools::Write (aS, sn.ToCString());
+
+ TCollection_AsciiString an;//=postfix+prefix+cn;
+ an+=postfix; an+=prefix; an+=cn;
+ printf(" -> Splitted Part IN : %s\n", an.ToCString());
+ cnt++;
+ }
+
+ const TopTools_ListOfShape& aListOfShapeOut=aShapeWithState.Part(TopAbs_OUT);
+ anIt.Initialize (aListOfShapeOut);
+ for (;anIt.More(); anIt.Next()) {
+ const TopoDS_Shape& aS=anIt.Value();
+
+ TCollection_AsciiString cn(cnt), prefix("_S_"), sn;//=aFName+prefix+cn;
+ sn+=aFName; sn+=prefix; sn+=cn;
+ BRepTools::Write (aS, sn.ToCString());
+
+ TCollection_AsciiString an;//=postfix+prefix+cn;
+ an+=postfix; an+=prefix; an+=cn;
+ printf(" -> Splitted Part OUT: %-s\n", an.ToCString());
+ cnt++;
+ }
+
+ const TopTools_ListOfShape& aListOfShapeOn=aShapeWithState.Part(TopAbs_ON);
+ anIt.Initialize (aListOfShapeOn);
+ for (;anIt.More(); anIt.Next()) {
+ const TopoDS_Shape& aS=anIt.Value();
+
+ TCollection_AsciiString cn(cnt), prefix("_S_"), sn;//=aFName+prefix+cn;
+ sn+=aFName; sn+=prefix; sn+=cn;
+ BRepTools::Write (aS, sn.ToCString());
+
+ TCollection_AsciiString an;//=postfix+prefix+cn;
+ an+=postfix; an+=prefix; an+=cn;
+ printf(" -> Splitted Part ON : %s\n", an.ToCString());
+ cnt++;
+ }
+ }
+
+ }
+ cnt=0;
+}
+
+} // anonymous namespace
+*/
//=======================================================================
//function : PerformShapeWithStates
TopOpeBRepDS_IndexedDataMapOfShapeWithState& aMapOfShapeWithStateTool=
aDS.ChangeMapOfShapeWithStateTool();
- TopOpeBRepBuild_Tools::DumpMapOfShapeWithState(0, aMapOfShapeWithStateObj);
- TopOpeBRepBuild_Tools::DumpMapOfShapeWithState(1, aMapOfShapeWithStateTool);
+ DumpMapOfShapeWithState(0, aMapOfShapeWithStateObj);
+ DumpMapOfShapeWithState(1, aMapOfShapeWithStateTool);
*/
// Phase#2 Phase ON
//define parameter division number as 10*e^(-PI) = 0.43213918
const Standard_Real PAR_T = 0.43213918;
-//=======================================================================
-//function TopOpeBRepBuild_Tools::DumpMapOfShapeWithState
-//purpose :
-//=======================================================================
- void TopOpeBRepBuild_Tools::DumpMapOfShapeWithState(const Standard_Integer iP,
- const TopOpeBRepDS_IndexedDataMapOfShapeWithState&
- aMapOfShapeWithState)
-{
- static Standard_Integer cnt=0;
- TCollection_AsciiString aFName1 ("/DEBUG/TOPOPE/"), postfix;
-
- Standard_CString ShapeType [9] = {"COMPO", "COMPS", "SOLID", "SHELL", "FACE ", "WIRE ", "EDGE ", "VERTX"};
- Standard_CString ShapeState[4] = {"IN ", "OUT", "ON ", "UNKNOWN"};
-
- printf("\n\n********************************\n");
- printf("* *\n");
- Standard_Integer i, n=aMapOfShapeWithState.Extent();
- if (!iP) {
- printf("* Object comparing with TOOL *\n");
- postfix=TCollection_AsciiString("Obj");
- }
-
- else {
- printf("* Tool comparing with Object *\n");
- postfix=TCollection_AsciiString("Tool");
- }
-
- printf("* *\n");
- printf("********************************\n");
- printf("*** aMapOfShapeWithState.Extent()=%d\n", n);
- printf(" C O N T E N T S\n");
-
- TCollection_AsciiString aFName;
- aFName+=aFName1;
- aFName+=postfix;
-
- for (i=1; i<=n; i++) {
- TCollection_AsciiString aI(i), aName;;
- aName+=aFName; aName+=aI;
-
- const TopoDS_Shape& aShape=aMapOfShapeWithState.FindKey(i);
- const TopOpeBRepDS_ShapeWithState& aShapeWithState=
- aMapOfShapeWithState.FindFromIndex(i);
-
- BRepTools::Write (aShape, aName.ToCString());
-
- TCollection_AsciiString ann;
- ann+=postfix; ann+=aI;
-
- printf("Key: %-8s , " , ann.ToCString());
- printf("%s, ", ShapeType[aShape.ShapeType()]);
- if (!iP)
- printf("State comp.with Tool=%s\n", ShapeState[aShapeWithState.State()]);
-
- else
- printf("State comp.with Obj =%s\n", ShapeState[aShapeWithState.State()]);
-
- if (aShapeWithState.IsSplitted()) {
-
- const TopTools_ListOfShape& aListOfShape=aShapeWithState.Part(TopAbs_IN);
- TopTools_ListIteratorOfListOfShape anIt(aListOfShape);
- for (;anIt.More(); anIt.Next()) {
- const TopoDS_Shape& aS=anIt.Value();
-
- TCollection_AsciiString cn(cnt), prefix("_S_"), sn;
- sn+=aFName; sn+=prefix; sn+=cn;
- BRepTools::Write (aS, sn.ToCString());
-
- TCollection_AsciiString an;//=postfix+prefix+cn;
- an+=postfix; an+=prefix; an+=cn;
- printf(" -> Splitted Part IN : %s\n", an.ToCString());
- cnt++;
- }
-
- const TopTools_ListOfShape& aListOfShapeOut=aShapeWithState.Part(TopAbs_OUT);
- anIt.Initialize (aListOfShapeOut);
- for (;anIt.More(); anIt.Next()) {
- const TopoDS_Shape& aS=anIt.Value();
-
- TCollection_AsciiString cn(cnt), prefix("_S_"), sn;//=aFName+prefix+cn;
- sn+=aFName; sn+=prefix; sn+=cn;
- BRepTools::Write (aS, sn.ToCString());
-
- TCollection_AsciiString an;//=postfix+prefix+cn;
- an+=postfix; an+=prefix; an+=cn;
- printf(" -> Splitted Part OUT: %-s\n", an.ToCString());
- cnt++;
- }
-
- const TopTools_ListOfShape& aListOfShapeOn=aShapeWithState.Part(TopAbs_ON);
- anIt.Initialize (aListOfShapeOn);
- for (;anIt.More(); anIt.Next()) {
- const TopoDS_Shape& aS=anIt.Value();
-
- TCollection_AsciiString cn(cnt), prefix("_S_"), sn;//=aFName+prefix+cn;
- sn+=aFName; sn+=prefix; sn+=cn;
- BRepTools::Write (aS, sn.ToCString());
-
- TCollection_AsciiString an;//=postfix+prefix+cn;
- an+=postfix; an+=prefix; an+=cn;
- printf(" -> Splitted Part ON : %s\n", an.ToCString());
- cnt++;
- }
- }
-
- }
- cnt=0;
-}
-
-
//=======================================================================
//function TopOpeBRepBuild_Tools::FindState
//purpose :
DEFINE_STANDARD_ALLOC
- Standard_EXPORT static void DumpMapOfShapeWithState (const Standard_Integer iP, const TopOpeBRepDS_IndexedDataMapOfShapeWithState& aMapOfShapeWithState);
-
Standard_EXPORT static void FindState (const TopoDS_Shape& aVertex, const TopAbs_State aState, const TopAbs_ShapeEnum aShapeEnum, const TopTools_IndexedDataMapOfShapeListOfShape& aMapVertexEdges, TopTools_MapOfShape& aMapProcessedVertices, TopOpeBRepDS_DataMapOfShapeState& aMapVs);
Standard_EXPORT static void PropagateState (const TopOpeBRepDS_DataMapOfShapeState& aSplEdgesState, const TopTools_IndexedMapOfShape& anEdgesToRestMap, const TopAbs_ShapeEnum aShapeEnum1, const TopAbs_ShapeEnum aShapeEnum2, TopOpeBRepTool_ShapeClassifier& aShapeClassifier, TopOpeBRepDS_IndexedDataMapOfShapeWithState& aMapOfShapeWithState, const TopTools_MapOfShape& anUnkStateShapes);
// ##########################################################
// ####### SHAPES : Acces de base #######
- Standard_Boolean XSControl_Utils::WriteShape
- (const TopoDS_Shape& shape,
- const Standard_CString filename) const
- { return BRepTools::Write (shape,filename); }
-
- TopoDS_Shape XSControl_Utils::NewShape () const
- { TopoDS_Shape shape; return shape; }
-
- Standard_Boolean XSControl_Utils::ReadShape
- (TopoDS_Shape& shape,
- const Standard_CString filename) const
-{
- BRep_Builder B;
- return BRepTools::Read (shape,filename,B);
-}
-
- Standard_Boolean XSControl_Utils::IsNullShape (const TopoDS_Shape& shape) const
- { return shape.IsNull(); }
-
-
TopoDS_Shape XSControl_Utils::CompoundFromSeq
(const Handle(TopTools_HSequenceOfShape)& seqval) const
{
Standard_EXPORT void AppendEStr (const Handle(TColStd_HSequenceOfHExtendedString)& seqval, const Standard_ExtString strval) const;
- //! Writes a Shape under the internal BRepTools form
- //! (an internal help utility)
- //! Returns True if writing has succeeded, False else
- Standard_EXPORT Standard_Boolean WriteShape (const TopoDS_Shape& shape, const Standard_CString filename) const;
-
- //! Returns a new empty, undefined Shape, which can then be filled
- //! by ReadShape
- Standard_EXPORT TopoDS_Shape NewShape() const;
-
- //! Reads a Shape from the internal BRepTools form and returns it
- //! (an internal help utility)
- //! Returns True if reading has succeeded, False else
- Standard_EXPORT Standard_Boolean ReadShape (TopoDS_Shape& shape, const Standard_CString filename) const;
-
- //! Returns True if a Shape is Null
- Standard_EXPORT Standard_Boolean IsNullShape (const TopoDS_Shape& shape) const;
-
//! Converts a list of Shapes to a Compound (a kind of Shape)
Standard_EXPORT TopoDS_Shape CompoundFromSeq (const Handle(TopTools_HSequenceOfShape)& seqval) const;
XSDRAW.cxx
XSDRAW.hxx
-XSDRAW_Commands.hxx
XSDRAW_Functions.cxx
XSDRAW_Functions.hxx
XSDRAW_Vars.cxx
+++ /dev/null
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#include <TCollection_AsciiString.hxx>
-
-static TCollection_AsciiString XSDRAW_CommandPart
- (Standard_Integer argc, const char** argv, const Standard_Integer argf)
-{
- TCollection_AsciiString res;
- for (Standard_Integer i = argf; i < argc; i ++) {
- if (i > argf) res.AssignCat(" ");
- res.AssignCat (argv[i]);
- }
- return res;
-}
//gka 06.01.99 S3767 new function TPSTAT (first version)
//pdn 11.01.99 putting "return" statement for compilation on NT
+#include <BRepTools.hxx>
#include <DBRep.hxx>
#include <Draw_Appli.hxx>
#include <Draw_ProgressIndicator.hxx>
#include <XSControl_WorkSession.hxx>
#include <XSControl_TransferReader.hxx>
#include <XSDRAW.hxx>
-#include <XSDRAW_Commands.hxx>
#include <XSDRAWIGES.hxx>
#include <stdio.h>
-// #include <IGESData_IGESWriter.hxx>
-// pour igeslist
-//#include <GeometryTest.hxx> essai CKY 4-AUT-1998
-//#include <BRepTest.hxx> essai CKY 4-AUT-1998
-//#include <MeshTest.hxx> essai CKY 4-AUT-1998
-// Init functions
-// + tplosttrim
+
+namespace {
+
+ //=======================================================================
+//function : WriteShape
+//purpose : Creates a file Shape_'number'
+//=======================================================================
+void WriteShape(const TopoDS_Shape& shape, const Standard_Integer number)
+{
+ char fname[110];
+ sprintf(fname, "Shape_%d",number);
+ ofstream f(fname,ios::out);
+ cout << "Output file name : " << fname << endl;
+ f << "DBRep_DrawableShape\n";
+
+ BRepTools::Write(shape, f);
+ f.close();
+}
+
+TCollection_AsciiString XSDRAW_CommandPart
+ (Standard_Integer argc, const char** argv, const Standard_Integer argf)
+{
+ TCollection_AsciiString res;
+ for (Standard_Integer i = argf; i < argc; i ++) {
+ if (i > argf) res.AssignCat(" ");
+ res.AssignCat (argv[i]);
+ }
+ return res;
+}
+}
+
//--------------------------------------------------------------
// Function : igesbrep
//--------------------------------------------------------------
char fname[110];
Sprintf(fname, "%s", rnom.ToCString());
di << "Saving shape in variable Draw : " << fname << "\n";
- if (answer == 3) IGESToBRep::WriteShape (shape,1);
+ if (answer == 3) WriteShape (shape,1);
try {
OCC_CATCH_SIGNALS
DBRep::Set(fname,shape);
di << Standard_Failure::Caught()->GetMessageString();
di<<" ** Skip\n";
di << "Saving shape in variable Draw : " << fname << "\n";
- IGESToBRep::WriteShape (shape,1);
+ WriteShape (shape,1);
}
}
char fname[110];
Sprintf(fname, "%s_%d", rnom.ToCString(),inum);
di << "Saving shape in variable Draw : " << fname << "\n";
- if (answer == 4) IGESToBRep::WriteShape (shape,inum);
+ if (answer == 4) WriteShape (shape,inum);
try {
OCC_CATCH_SIGNALS
DBRep::Set(fname,shape);
di << Standard_Failure::Caught()->GetMessageString();
di<<" ** Skip\n";
di << "Saving shape in variable Draw : " << fname << "\n";
- IGESToBRep::WriteShape (shape,1);
+ WriteShape (shape,1);
}
return 0;
}