Problem: There is no possibility to change shape healing options from DRAW without rewriting resource file.
Change: Shape healing parameters from STEP and IGES resource files were duplicated to InterfaceStatic. Resource manager initialize from InterfaceStatic if resource file name is empty.
Result: User can operationally change shape healing parameters from DRAW command using "param" command.
Standard_Integer argc = pilot->NbWords();
Handle(IFSelect_WorkSession) WS = pilot->Session();
const Standard_CString arg1 = pilot->Arg(1);
- const Standard_CString arg2 = pilot->Arg(2);
+ Standard_CString arg2 = pilot->Arg(2);
+ const Standard_CString anEmptyStr = "";
+ if (arg2 && strlen(arg2) == 2 && arg2[0] == '"' && arg2[1] == '"')
+ {
+ arg2 = anEmptyStr;
+ }
// **** Param(Value) ****
Message_Messenger::StreamBuffer sout = Message::SendInfo();
- if (argc < 2) {
+ if (argc < 2 || (argc == 3 && strcmp (arg1, "-p") == 0)) {
Handle(TColStd_HSequenceOfHAsciiString) li = Interface_Static::Items();
- Standard_Integer i,nb = li->Length();
- sout<<" List of parameters : "<<nb<<" items : "<<std::endl;
+ Standard_Integer i,nb = li->Length(), aPatternNb = 0;
+ size_t aPatternLen = strlen(arg2);
+ if (argc == 3)
+ {
+ for (i = 1; i <= nb; i ++)
+ {
+ if (strncmp(li->Value(i)->String().ToCString(), arg2, aPatternLen) == 0)
+ {
+ aPatternNb++;
+ }
+ }
+ }
+ else
+ {
+ aPatternNb = nb;
+ }
+ sout << " List of parameters : " << aPatternNb << " items : " << std::endl;
for (i = 1; i <= nb; i ++) {
+ if (argc == 3 && strncmp(li->Value(i)->String().ToCString(), arg2, aPatternLen) != 0)
+ {
+ continue;
+ }
sout<<li->Value(i)->String();
sout<<" : "<<Interface_Static::CVal(li->Value(i)->ToCString())<<std::endl;
}
if (argc == 2) sout<<"To modify, param name_param new_val"<<std::endl;
else {
- sout<<" New demanded value : "<<arg2;
+ if (strlen(arg2) != 0)
+ {
+ sout<<" New demanded value : "<<arg2;
+ }
+ else
+ {
+ sout<<" New demanded value : not valued";
+ }
if (Interface_Static::SetCVal (arg1,arg2))
{ sout<<" OK"<<std::endl; return IFSelect_RetDone; }
else { sout <<" , refused"<<std::endl; return IFSelect_RetError; }
IFSelect_Act::AddFunc("itemlabel","xxx xxx : liste items having this label",fun24);
IFSelect_Act::AddFunc("xsave","filename:string : sauve items-session",fun25);
IFSelect_Act::AddFunc("xrestore","filename:string : restaure items-session",fun26);
- IFSelect_Act::AddFunc("param","nompar:string : displays parameter value; + nompar val : changes it",fun27);
+ IFSelect_Act::AddFunc("param","[-p Pattern] - displays all parameters or filtered by pattern;\n"
+ "par_name - displays parameter;\n"
+ "par_name par_value - changes parameter's value", fun27);
IFSelect_Act::AddFunc("sentfiles","Lists files sent from last Load",fun29);
IFSelect_Act::AddFunc("fileprefix","prefix:string : definit File Prefix",fun30);
Interface_Static::SetIVal ("write.convertsurface.mode",0);
// abv 15.11.00: ShapeProcessing
- Interface_Static::Init ("XSTEP","write.iges.resource.name",'t',"IGES");
- Interface_Static::Init ("XSTEP","read.iges.resource.name",'t',"IGES");
- Interface_Static::Init ("XSTEP","write.iges.sequence",'t',"ToIGES");
- Interface_Static::Init ("XSTEP","read.iges.sequence",'t',"FromIGES");
+ Interface_Static::Init ("XSTEP", "write.iges.resource.name", 't', "IGES");
+ Interface_Static::Init ("XSTEP", "read.iges.resource.name", 't', "IGES");
+ Interface_Static::Init ("XSTEP", "write.iges.sequence", 't', "ToIGES");
+ Interface_Static::Init ("XSTEP", "read.iges.sequence", 't', "FromIGES");
+ Interface_Static::Init ("XSTEP", "ToIGES.exec.op", 't', "DirectFaces");
+ Interface_Static::Init ("XSTEP", "FromIGES.exec.op", 't', "FixShape");
+ Interface_Static::Init ("XSTEP", "FromIGES.FixShape.Tolerance3d", 't', "&Runtime.Tolerance");
+ Interface_Static::Init ("XSTEP", "FromIGES.FixShape.MaxTolerance3d", 't', "&Runtime.MaxTolerance");
+ Interface_Static::Init ("XSTEP", "FromIGES.FixShape.MinTolerance3d", 't', "1.e-7");
+ Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixFreeShellMode", 't', "-1");
+ Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixFreeFaceMode", 't', "-1");
+ Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixFreeWireMode", 't', "-1");
+ Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixSameParameterMode", 't', "-1");
+ Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixSolidMode", 't', "-1");
+ Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixShellOrientationMode", 't', "-1");
+ Interface_Static::Init ("XSTEP", "FromIGES.FixShape.CreateOpenSolidMode", 't', "1");
+ Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixShellMode", 't', "-1");
+ Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixFaceOrientationMode", 't', "-1");
+ Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixFaceMode", 't', "-1");
+ Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixWireMode", 't', "-1");
+ Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixOrientationMode", 't', "-1");
+ Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixAddNaturalBoundMode", 't', "-1");
+ Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixMissingSeamMode", 't', "-1");
+ Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixSmallAreaWireMode", 't', "-1");
+ Interface_Static::Init ("XSTEP", "FromIGES.FixShape.RemoveSmallAreaFaceMode", 't', "-1");
+ Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixIntersectingWiresMode", 't', "-1");
+ Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixLoopWiresMode", 't', "-1");
+ Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixSplitFaceMode", 't', "-1");
+ Interface_Static::Init ("XSTEP", "FromIGES.FixShape.AutoCorrectPrecisionMode", 't', "1");
+ Interface_Static::Init ("XSTEP", "FromIGES.FixShape.ModifyTopologyMode", 't', "0");
+ Interface_Static::Init ("XSTEP", "FromIGES.FixShape.ModifyGeometryMode", 't', "1");
+ Interface_Static::Init ("XSTEP", "FromIGES.FixShape.ClosedWireMode", 't', "1");
+ Interface_Static::Init ("XSTEP", "FromIGES.FixShape.PreferencePCurveMode", 't', "1");
+ Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixReorderMode", 't', "-1");
+ Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixSmallMode", 't', "-1");
+ Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixConnectedMode", 't', "-1");
+ Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixEdgeCurvesMode", 't', "-1");
+ Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixDegeneratedMode", 't', "-1");
+ Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixLackingMode", 't', "-1");
+ Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixSelfIntersectionMode", 't', "-1");
+ Interface_Static::Init ("XSTEP", "FromIGES.FixShape.RemoveLoopMode", 't', "-1");
+ Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixReversed2dMode", 't', "-1");
+ Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixRemovePCurveMode", 't', "-1");
+ Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixRemoveCurve3dMode", 't', "-1");
+ Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixAddPCurveMode", 't', "-1");
+ Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixAddCurve3dMode", 't', "-1");
+ Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixSeamMode", 't', "-1");
+ Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixShiftedMode", 't', "-1");
+ Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixEdgeSameParameterMode", 't', "0");
+ Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixNotchedEdgesMode", 't', "-1");
+ Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixTailMode", 't', "0");
+ Interface_Static::Init ("XSTEP", "FromIGES.FixShape.MaxTailAngle", 't', "0.0");
+ Interface_Static::Init ("XSTEP", "FromIGES.FixShape.MaxTailWidth", 't', "-1.0");
+ Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixSelfIntersectingEdgeMode", 't', "-1");
+ Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixIntersectingEdgesMode", 't', "-1");
+ Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixNonAdjacentIntersectingEdgesMode", 't', "-1");
+ Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixVertexPositionMode", 't', "0");
+ Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixVertexToleranceMode", 't', "-1");
// sln 11.06.2002 OCC448 : Initialize "read.onlyvisible" parameter to control transferring
// invisible sub entities which logically depend on the grouping entities
}
return list;
}
+
+//=======================================================================
+// function : FillMap
+// purpose : Fills given string-to-string map with all static data
+//=======================================================================
+void Interface_Static::FillMap (NCollection_DataMap<TCollection_AsciiString, TCollection_AsciiString, TCollection_AsciiString>& theMap)
+{
+ theMap.Clear();
+
+ NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)>& aMap = MoniTool_TypedValue::Stats();
+
+ for (NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)>::Iterator anIt(aMap); anIt.More(); anIt.Next())
+ {
+ Handle(Interface_Static) aValue = Handle(Interface_Static)::DownCast(anIt.Value());
+ if (aValue.IsNull())
+ {
+ continue;
+ }
+ if (aValue->HStringValue().IsNull())
+ {
+ continue;
+ }
+
+ theMap.Bind (anIt.Key(), aValue->HStringValue()->String());
+ }
+}
//! must be defined around it
Standard_EXPORT static void Standards();
-
-
+ //! Fills given string-to-string map with all static data
+ Standard_EXPORT static void FillMap(NCollection_DataMap<TCollection_AsciiString, TCollection_AsciiString, TCollection_AsciiString>& theMap);
DEFINE_STANDARD_RTTIEXT(Interface_Static,Interface_TypedValue)
std::cout << "Resource Manager Warning: Environment variable \"CSF_" << aName << "UserDefaults\" not set." << std::endl;
}
+// =======================================================================
+// function : Resource_Manager
+// purpose :
+// =======================================================================
+Resource_Manager::Resource_Manager()
+ : myName(""), myVerbose(Standard_False)
+{
+
+}
+
// =======================================================================
// function : Load
// purpose :
anOSDPath.SystemName(aPath);
}
+
+//=======================================================================
+// function : GetMap
+// purpose :
+//=======================================================================
+Resource_DataMapOfAsciiStringAsciiString& Resource_Manager::GetMap(Standard_Boolean theRefMap)
+{
+ return theRefMap ? myRefMap : myUserMap;
+}
//! syntax of an individual resource line is:
Standard_EXPORT Resource_Manager(const Standard_CString aName, const Standard_Boolean Verbose = Standard_False);
+ //! Create an empty Resource manager
+ Standard_EXPORT Resource_Manager();
+
//! Create a Resource manager.
//! @param theName [in] description file name
//! @param theDefaultsDirectory [in] default folder for looking description file
//! or file doesn't exist returns empty string.
Standard_EXPORT static void GetResourcePath (TCollection_AsciiString& aPath, const Standard_CString aName, const Standard_Boolean isUserDefaults);
+ //! Returns internal Ref or User map with parameters
+ Standard_EXPORT Resource_DataMapOfAsciiStringAsciiString& GetMap(Standard_Boolean theRefMap = Standard_True);
+
private:
Standard_EXPORT void Load (const TCollection_AsciiString& thePath,
Interface_Static::Init ("step","write.step.vertex.mode",'&',"eval One Compound");
Interface_Static::Init ("step","write.step.vertex.mode",'&',"eval Single Vertex");
Interface_Static::SetIVal("write.step.vertex.mode",0);
-
+
// abv 15.11.00: ShapeProcessing
- Interface_Static::Init ("XSTEP","write.step.resource.name",'t',"STEP");
- Interface_Static::Init ("XSTEP","read.step.resource.name",'t',"STEP");
- Interface_Static::Init ("XSTEP","write.step.sequence",'t',"ToSTEP");
- Interface_Static::Init ("XSTEP","read.step.sequence",'t',"FromSTEP");
+ Interface_Static::Init ("XSTEP", "write.step.resource.name", 't', "STEP");
+ Interface_Static::Init ("XSTEP", "read.step.resource.name", 't', "STEP");
+ Interface_Static::Init ("XSTEP", "write.step.sequence", 't', "ToSTEP");
+ Interface_Static::Init ("XSTEP", "read.step.sequence", 't', "FromSTEP");
+ Interface_Static::Init ("XSTEP", "ToSTEP.exec.op", 't', "SplitCommonVertex,DirectFaces");
+ Interface_Static::Init ("XSTEP", "FromSTEP.exec.op", 't', "FixShape");
+ Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.Tolerance3d", 't', "&Runtime.Tolerance");
+ Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.MaxTolerance3d", 't', "&Runtime.MaxTolerance");
+ Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.MinTolerance3d", 't', "1.e-7");
+ Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixFreeShellMode", 't', "-1");
+ Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixFreeFaceMode", 't', "-1");
+ Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixFreeWireMode", 't', "-1");
+ Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixSameParameterMode", 't', "-1");
+ Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixSolidMode", 't', "-1");
+ Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixShellOrientationMode", 't', "-1");
+ Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.CreateOpenSolidMode", 't', "0");
+ Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixShellMode", 't', "-1");
+ Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixFaceOrientationMode", 't', "-1");
+ Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixFaceMode", 't', "-1");
+ Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixWireMode", 't', "-1");
+ Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixOrientationMode", 't', "-1");
+ Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixAddNaturalBoundMode", 't', "-1");
+ Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixMissingSeamMode", 't', "-1");
+ Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixSmallAreaWireMode", 't', "-1");
+ Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.RemoveSmallAreaFaceMode", 't', "-1");
+ Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixIntersectingWiresMode", 't', "-1");
+ Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixLoopWiresMode", 't', "-1");
+ Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixSplitFaceMode", 't', "-1");
+ Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.AutoCorrectPrecisionMode", 't', "1");
+ Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.ModifyTopologyMode", 't', "0");
+ Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.ModifyGeometryMode", 't', "1");
+ Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.ClosedWireMode", 't', "1");
+ Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.PreferencePCurveMode", 't', "1");
+ Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixReorderMode", 't', "-1");
+ Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixSmallMode", 't', "-1");
+ Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixConnectedMode", 't', "-1");
+ Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixEdgeCurvesMode", 't', "-1");
+ Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixDegeneratedMode", 't', "-1");
+ Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixLackingMode", 't', "-1");
+ Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixSelfIntersectionMode", 't', "-1");
+ Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.RemoveLoopMode", 't', "-1");
+ Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixReversed2dMode", 't', "-1");
+ Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixRemovePCurveMode", 't', "-1");
+ Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixRemoveCurve3dMode", 't', "-1");
+ Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixAddPCurveMode", 't', "-1");
+ Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixAddCurve3dMode", 't', "-1");
+ Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixSeamMode", 't', "-1");
+ Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixShiftedMode", 't', "-1");
+ Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixEdgeSameParameterMode", 't', "0");
+ Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixNotchedEdgesMode", 't', "-1");
+ Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixTailMode", 't', "0");
+ Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.MaxTailAngle", 't', "0.0");
+ Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.MaxTailWidth", 't', "-1.0");
+ Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixSelfIntersectingEdgeMode", 't', "-1");
+ Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixIntersectingEdgesMode", 't', "-1");
+ Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixNonAdjacentIntersectingEdgesMode", 't', "-1");
+ Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixVertexPositionMode", 't', "0");
+ Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixVertexToleranceMode", 't', "-1");
// ika 28.07.16: Parameter to read all top level solids and shells,
// should be used only in case of invalid shape_representation without links to shapes.
const Standard_CString scope)
{
myScope.Nullify();
- myRC = LoadResourceManager ( file );
+ if (file != nullptr && strlen (file) != 0)
+ {
+ myRC = LoadResourceManager ( file );
+ }
+ else
+ {
+ myRC = new Resource_Manager();
+ }
if ( scope && scope[0] ) {
SetScope ( scope );
}
if ( context.IsNull() )
{
Standard_CString rscfile = Interface_Static::CVal(prscfile);
- if (!rscfile)
- rscfile = prscfile;
- context = new ShapeProcess_ShapeContext(shape, rscfile);
+ if (rscfile != nullptr && strlen (rscfile) == 0)
+ {
+ context = new ShapeProcess_ShapeContext(shape, nullptr);
+ Interface_Static::FillMap(context->ResourceManager()->GetMap());
+ }
+ else
+ {
+ if (!rscfile)
+ rscfile = prscfile;
+ context = new ShapeProcess_ShapeContext(shape, rscfile);
+ }
context->SetDetalisation(TopAbs_EDGE);
}
context->SetNonManifold(NonManifold);
--- /dev/null
+puts "============"
+puts "OCC28024 Data Exchange, Configuration - revise XSTEPResource initialization"
+puts "============"
+puts ""
+#####################################################
+# Testing the mechanism for changing options of ShapeHealing
+# from DRAW
+#####################################################
+
+pload MODELING XDE
+
+if { [info exists imagedir] == 0 } {
+ set imagedir ../bug28024
+ if {![file exists ${imagedir}]} {
+ file mkdir ${imagedir}
+ }
+}
+set step_file ${imagedir}/inv_triangle.stp
+
+# Make simple triangle with INNER wire
+vertex v1 0 0 0
+vertex v2 1 0 0
+vertex v3 0 1 0
+edge e1 v2 v1
+edge e2 v3 v2
+edge e3 v1 v3
+wire w1 e1 e3 e2
+plane p1
+mkface f1 p1 w1 norient
+
+# Save to STEP
+testwritestep ${step_file} f1
+
+# Empty resource file name to take params from InterfaceStatic
+param "read.step.resource.name" "\"\""
+# Turn off FixOrientation procedure
+param "FromSTEP.FixShape.FixOrientationMode" 0
+
+# Read from STEP without shape healing
+stepread ${step_file} r *
+explode r_1 f
+
+# The area of triangle must be negative
+checkarea r_1_1 -0.5 1e-6 0.001
+
+param "read.step.resource.name" "STEP"
+param "FromSTEP.FixShape.FixOrientationMode" -1