0028024: Data Exchange - create a convenient mechanism for managing shape healing...
[occt.git] / src / STEPControl / STEPControl_Controller.cxx
1 // Copyright (c) 1999-2014 OPEN CASCADE SAS
2 //
3 // This file is part of Open CASCADE Technology software library.
4 //
5 // This library is free software; you can redistribute it and/or modify it under
6 // the terms of the GNU Lesser General Public License version 2.1 as published
7 // by the Free Software Foundation, with special exception defined in the file
8 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
9 // distribution for complete text of the license and disclaimer of any warranty.
10 //
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
13
14 //:j4 gka 16.03.99 S4134
15 //    gka 05.04.99 S4136: parameters definitions changed
16
17 #include <APIHeaderSection_EditHeader.hxx>
18 #include <APIHeaderSection_MakeHeader.hxx>
19 #include <IFSelect_EditForm.hxx>
20 #include <IFSelect_SelectModelRoots.hxx>
21 #include <IFSelect_SelectSignature.hxx>
22 #include <IFSelect_SignAncestor.hxx>
23 #include <IFSelect_SignCounter.hxx>
24 #include <Interface_Macros.hxx>
25 #include <Interface_Static.hxx>
26 #include <RWHeaderSection.hxx>
27 #include <RWStepAP214.hxx>
28 #include <Standard_Type.hxx>
29 #include <Standard_Version.hxx>
30 #include <STEPControl_ActorRead.hxx>
31 #include <STEPControl_ActorWrite.hxx>
32 #include <STEPControl_Controller.hxx>
33 #include <StepData_FileProtocol.hxx>
34 #include <StepData_StepModel.hxx>
35 #include <STEPEdit.hxx>
36 #include <STEPEdit_EditContext.hxx>
37 #include <STEPEdit_EditSDR.hxx>
38 #include <StepSelect_WorkLibrary.hxx>
39 #include <STEPSelections_SelectAssembly.hxx>
40 #include <STEPSelections_SelectDerived.hxx>
41 #include <STEPSelections_SelectFaces.hxx>
42 #include <STEPSelections_SelectForTransfer.hxx>
43 #include <STEPSelections_SelectGSCurves.hxx>
44 #include <STEPSelections_SelectInstances.hxx>
45 #include <TopoDS_Shape.hxx>
46 #include <Transfer_ActorOfTransientProcess.hxx>
47 #include <XSAlgo.hxx>
48 #include <XSControl_WorkSession.hxx>
49
50 IMPLEMENT_STANDARD_RTTIEXT(STEPControl_Controller,XSControl_Controller)
51
52 //  Pour NewModel et Write : definition de produit (temporaire ...)
53 STEPControl_Controller::STEPControl_Controller ()
54 : XSControl_Controller ("STEP", "step")
55 {
56   static Standard_Boolean init = Standard_False;
57   if (!init) {
58     RWHeaderSection::Init();  RWStepAP214::Init();
59
60     Interface_Static::Init ("step","write.step.product.name",'t',"Open CASCADE STEP translator " OCC_VERSION_STRING);
61     Interface_Static::Init ("step","write.step.assembly",'e',"");
62     Interface_Static::Init ("step","write.step.assembly",'&',"enum 0");
63     Interface_Static::Init ("step","write.step.assembly",'&',"eval Off");
64     Interface_Static::Init ("step","write.step.assembly",'&',"eval On");
65     Interface_Static::Init ("step","write.step.assembly",'&',"eval Auto");
66     Interface_Static::SetCVal("write.step.assembly","Auto"); 
67
68     Interface_Static::Init("step","step.angleunit.mode", 'e',"");
69     Interface_Static::Init("step","step.angleunit.mode", '&',"enum 0");
70     Interface_Static::Init("step","step.angleunit.mode", '&',"eval File");
71     Interface_Static::Init("step","step.angleunit.mode", '&',"eval Rad");
72     Interface_Static::Init("step","step.angleunit.mode", '&',"eval Deg");
73     Interface_Static::SetCVal("step.angleunit.mode","File"); 
74
75     Interface_Static::Init("step","write.step.schema", 'e',"");  
76     Interface_Static::Init("step","write.step.schema",'&',"enum 1");
77     Interface_Static::Init("step","write.step.schema",'&',"eval AP214CD");
78     Interface_Static::Init("step","write.step.schema",'&',"eval AP214DIS");
79     Interface_Static::Init("step","write.step.schema",'&',"eval AP203");
80     Interface_Static::Init("step","write.step.schema",'&',"eval AP214IS");
81     Interface_Static::Init("step","write.step.schema",'&',"eval AP242DIS");
82     Interface_Static::SetCVal("write.step.schema","AP214IS"); 
83
84     // Type of Product Definition for reading
85     // Note: the numbers should be consistent with function FindShapeReprType()
86     // in STEPControl_ActorRead.cxx
87     Interface_Static::Init("step","read.step.shape.repr",'e',"");
88     Interface_Static::Init("step","read.step.shape.repr",'&',"enum 1");
89     Interface_Static::Init("step","read.step.shape.repr",'&',"eval All");   // 1
90     Interface_Static::Init("step","read.step.shape.repr",'&',"eval ABSR");  // 2
91     Interface_Static::Init("step","read.step.shape.repr",'&',"eval MSSR");  // 3
92     Interface_Static::Init("step","read.step.shape.repr",'&',"eval GBSSR"); // 4
93     Interface_Static::Init("step","read.step.shape.repr",'&',"eval FBSR");  // 5
94     Interface_Static::Init("step","read.step.shape.repr",'&',"eval EBWSR"); // 6
95     Interface_Static::Init("step","read.step.shape.repr",'&',"eval GBWSR"); // 7
96     Interface_Static::SetCVal("read.step.shape.repr","All");
97
98     // Mode for reading shapes attached to main SDR by SRR
99     // (hybrid model representation in AP203 since 1998)
100     Interface_Static::Init("step","read.step.shape.relationship",'e',"");
101     Interface_Static::Init("step","read.step.shape.relationship",'&',"enum 0");
102     Interface_Static::Init("step","read.step.shape.relationship",'&',"eval OFF");
103     Interface_Static::Init("step","read.step.shape.relationship",'&',"eval ON");
104     Interface_Static::SetCVal("read.step.shape.relationship","ON");
105
106     // Mode for reading shapes attached to Product by ShapeAspect 
107     // (hybrid model representation in AP203 before 1998)
108     Interface_Static::Init("step","read.step.shape.aspect",'e',"");
109     Interface_Static::Init("step","read.step.shape.aspect",'&',"enum 0");
110     Interface_Static::Init("step","read.step.shape.aspect",'&',"eval OFF");
111     Interface_Static::Init("step","read.step.shape.aspect",'&',"eval ON");
112     Interface_Static::SetCVal("read.step.shape.aspect","ON");
113
114     // Mode for reading SDR and ShapeRepr if it is necessary
115     Interface_Static::Init("step","read.step.product.mode",'e',"");
116     Interface_Static::Init("step","read.step.product.mode",'&',"enum 0");
117     Interface_Static::Init("step","read.step.product.mode",'&',"eval OFF");
118     Interface_Static::Init("step","read.step.product.mode",'&',"eval ON");
119     Interface_Static::SetCVal("read.step.product.mode","ON");
120
121     // Order of reading ShapeDefinitionRepresentation in ProductDefinition
122     Interface_Static::Init("step","read.step.product.context",'e',"");
123     Interface_Static::Init("step","read.step.product.context",'&',"enum 1");
124     Interface_Static::Init("step","read.step.product.context",'&',"eval all");     // 1
125     Interface_Static::Init("step","read.step.product.context",'&',"eval design");  // 2
126     Interface_Static::Init("step","read.step.product.context",'&',"eval analysis");// 3
127     Interface_Static::SetCVal("read.step.product.context","all");
128
129     // What we try to read in ProductDefinition
130     Interface_Static::Init("step","read.step.assembly.level",'e',"");
131     Interface_Static::Init("step","read.step.assembly.level",'&',"enum 1");
132     Interface_Static::Init("step","read.step.assembly.level",'&',"eval all");      // 1
133     Interface_Static::Init("step","read.step.assembly.level",'&',"eval assembly"); // 2
134     Interface_Static::Init("step","read.step.assembly.level",'&',"eval structure");// 3
135     Interface_Static::Init("step","read.step.assembly.level",'&',"eval shape");    // 4
136     Interface_Static::SetCVal("read.step.assembly.level","all");
137
138     // unit: supposed to be cascade unit (target unit for reading)
139     Interface_Static::Init("step","write.step.unit", 'e',"");
140     Interface_Static::Init("step","write.step.unit",'&',"enum 1");
141     Interface_Static::Init("step","write.step.unit",'&',"eval INCH");  // 1
142     Interface_Static::Init("step","write.step.unit",'&',"eval MM");    // 2
143     Interface_Static::Init("step","write.step.unit",'&',"eval ??");    // 3
144     Interface_Static::Init("step","write.step.unit",'&',"eval FT");    // 4
145     Interface_Static::Init("step","write.step.unit",'&',"eval MI");    // 5
146     Interface_Static::Init("step","write.step.unit",'&',"eval M");     // 6
147     Interface_Static::Init("step","write.step.unit",'&',"eval KM");    // 7
148     Interface_Static::Init("step","write.step.unit",'&',"eval MIL");   // 8
149     Interface_Static::Init("step","write.step.unit",'&',"eval UM");    // 9
150     Interface_Static::Init("step","write.step.unit",'&',"eval CM");    //10
151     Interface_Static::Init("step","write.step.unit",'&',"eval UIN");   //11
152     Interface_Static::SetCVal ("write.step.unit","MM");
153
154     // Non-manifold topology reading: OFF by default (ssv; 26.11.2010)
155     Interface_Static::Init ("step","read.step.nonmanifold",'e',"");
156     Interface_Static::Init ("step","read.step.nonmanifold",'&',"enum 0");
157     Interface_Static::Init ("step","read.step.nonmanifold",'&',"eval Off");
158     Interface_Static::Init ("step","read.step.nonmanifold",'&',"eval On");
159     Interface_Static::SetIVal("read.step.nonmanifold",0); 
160
161     // Non-manifold topology writing: OFF by default (ssv; 26.11.2010)
162     Interface_Static::Init ("step","write.step.nonmanifold",'e',"");
163     Interface_Static::Init ("step","write.step.nonmanifold",'&',"enum 0");
164     Interface_Static::Init ("step","write.step.nonmanifold",'&',"eval Off");
165     Interface_Static::Init ("step","write.step.nonmanifold",'&',"eval On");
166     Interface_Static::SetIVal("write.step.nonmanifold",0); 
167
168     // I-Deas-like STEP processing: OFF by default (ssv; 22.11.2010)
169     Interface_Static::Init ("step","read.step.ideas",'e',"");
170     Interface_Static::Init ("step","read.step.ideas",'&',"enum 0");
171     Interface_Static::Init ("step","read.step.ideas",'&',"eval Off");
172     Interface_Static::Init ("step","read.step.ideas",'&',"eval On");
173     Interface_Static::SetIVal("read.step.ideas",0); 
174
175     //Parameter to write all free vertices in one SDR (name and style of vertex are lost) (default) 
176     //or each vertex in its own SDR (name and style of vertex are exported). (ika; 21.07.2014) 
177     Interface_Static::Init ("step","write.step.vertex.mode",'e',"");
178     Interface_Static::Init ("step","write.step.vertex.mode",'&',"enum 0");
179     Interface_Static::Init ("step","write.step.vertex.mode",'&',"eval One Compound");
180     Interface_Static::Init ("step","write.step.vertex.mode",'&',"eval Single Vertex");
181     Interface_Static::SetIVal("write.step.vertex.mode",0);
182
183     // abv 15.11.00: ShapeProcessing
184     Interface_Static::Init ("XSTEP", "write.step.resource.name",                      't', "STEP");
185     Interface_Static::Init ("XSTEP", "read.step.resource.name",                       't', "STEP");
186     Interface_Static::Init ("XSTEP", "write.step.sequence",                           't', "ToSTEP");
187     Interface_Static::Init ("XSTEP", "read.step.sequence",                            't', "FromSTEP");
188     Interface_Static::Init ("XSTEP", "ToSTEP.exec.op",                                't', "SplitCommonVertex,DirectFaces");
189     Interface_Static::Init ("XSTEP", "FromSTEP.exec.op",                              't', "FixShape");
190     Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.Tolerance3d",                 't', "&Runtime.Tolerance");
191     Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.MaxTolerance3d",              't', "&Runtime.MaxTolerance");
192     Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.MinTolerance3d",              't', "1.e-7");
193     Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixFreeShellMode",            't', "-1");
194     Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixFreeFaceMode",             't', "-1");
195     Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixFreeWireMode",             't', "-1");
196     Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixSameParameterMode",        't', "-1");
197     Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixSolidMode",                't', "-1");
198     Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixShellOrientationMode",     't', "-1");
199     Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.CreateOpenSolidMode",         't', "0");
200     Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixShellMode",                't', "-1");
201     Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixFaceOrientationMode",      't', "-1");
202     Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixFaceMode",                 't', "-1");
203     Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixWireMode",                 't', "-1");
204     Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixOrientationMode",          't', "-1");
205     Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixAddNaturalBoundMode",      't', "-1");
206     Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixMissingSeamMode",          't', "-1");
207     Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixSmallAreaWireMode",        't', "-1");
208     Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.RemoveSmallAreaFaceMode",     't', "-1");
209     Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixIntersectingWiresMode",    't', "-1");
210     Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixLoopWiresMode",            't', "-1");
211     Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixSplitFaceMode",            't', "-1");
212     Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.AutoCorrectPrecisionMode",    't', "1");
213     Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.ModifyTopologyMode",          't', "0");
214     Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.ModifyGeometryMode",          't', "1");
215     Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.ClosedWireMode",              't', "1");
216     Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.PreferencePCurveMode",        't', "1");
217     Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixReorderMode",              't', "-1");
218     Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixSmallMode",                't', "-1");
219     Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixConnectedMode",            't', "-1");
220     Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixEdgeCurvesMode",           't', "-1");
221     Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixDegeneratedMode",          't', "-1");
222     Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixLackingMode",              't', "-1");
223     Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixSelfIntersectionMode",     't', "-1");
224     Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.RemoveLoopMode",              't', "-1");
225     Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixReversed2dMode",           't', "-1");
226     Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixRemovePCurveMode",         't', "-1");
227     Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixRemoveCurve3dMode",        't', "-1");
228     Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixAddPCurveMode",            't', "-1");
229     Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixAddCurve3dMode",           't', "-1");
230     Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixSeamMode",                 't', "-1");
231     Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixShiftedMode",              't', "-1");
232     Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixEdgeSameParameterMode",    't', "0");
233     Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixNotchedEdgesMode",         't', "-1");
234     Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixTailMode",                 't', "0");
235     Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.MaxTailAngle",                't', "0.0");
236     Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.MaxTailWidth",                't', "-1.0");
237     Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixSelfIntersectingEdgeMode", 't', "-1");
238     Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixIntersectingEdgesMode",    't', "-1");
239     Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixNonAdjacentIntersectingEdgesMode", 't', "-1");
240     Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixVertexPositionMode",       't', "0");
241     Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixVertexToleranceMode",      't', "-1"); 
242
243     // ika 28.07.16: Parameter to read all top level solids and shells,
244     // should be used only in case of invalid shape_representation without links to shapes.
245     Interface_Static::Init("step", "read.step.all.shapes", 'e', "");
246     Interface_Static::Init("step", "read.step.all.shapes", '&', "enum 0");
247     Interface_Static::Init("step", "read.step.all.shapes", '&', "eval Off");
248     Interface_Static::Init("step", "read.step.all.shapes", '&', "eval On");
249     Interface_Static::SetIVal("read.step.all.shapes", 0);
250
251      // Mode for reading constructive geometry representation relationship to read
252     //StepRepr_ConstructiveGeometryRepresentation method implemented only for StepGeom_MakeAxis2Placement3d
253     //for axis placements representing axis for suplemented geometry. Axis placements are translated to planar faces with CS 
254     //equal to translated axis placements
255     Interface_Static::Init("step","read.step.constructivegeom.relationship",'e',"");
256     Interface_Static::Init("step","read.step.constructivegeom.relationship",'&',"enum 0");
257     Interface_Static::Init("step","read.step.constructivegeom.relationship",'&',"eval OFF");
258     Interface_Static::Init("step","read.step.constructivegeom.relationship",'&',"eval ON");
259     Interface_Static::SetCVal("read.step.constructivegeom.relationship","OFF");
260
261     // Mode to variate apply or not transformation placed in the root shape representation.
262     // Issues #29068 and #31491.
263     Interface_Static::Init("step", "read.step.root.transformation", 'e', "");
264     Interface_Static::Init("step", "read.step.root.transformation", '&', "enum 0");
265     Interface_Static::Init("step", "read.step.root.transformation", '&', "eval OFF");
266     Interface_Static::Init("step", "read.step.root.transformation", '&', "eval ON");
267     Interface_Static::SetCVal("read.step.root.transformation", "ON");
268
269     // STEP file encoding for names translation
270     // Note: the numbers should be consistent with Resource_FormatType enumeration
271     Interface_Static::Init("step", "read.step.codepage", 'e', "");
272     Interface_Static::Init("step", "read.step.codepage", '&', "enum 0");
273     Interface_Static::Init("step", "read.step.codepage", '&', "eval SJIS");         // Resource_FormatType_SJIS 0
274     Interface_Static::Init("step", "read.step.codepage", '&', "eval EUC");          // Resource_FormatType_EUC 1
275     Interface_Static::Init("step", "read.step.codepage", '&', "eval NoConversion"); // Resource_FormatType_NoConversion 2
276     Interface_Static::Init("step", "read.step.codepage", '&', "eval GB");           // Resource_FormatType_GB 3
277     Interface_Static::Init("step", "read.step.codepage", '&', "eval UTF8");         // Resource_FormatType_UTF8 4
278     Interface_Static::Init("step", "read.step.codepage", '&', "eval SystemLocale"); // Resource_FormatType_SystemLocale 5 
279     Interface_Static::Init("step", "read.step.codepage", '&', "eval CP1250");       // Resource_FormatType_CP1250 6
280     Interface_Static::Init("step", "read.step.codepage", '&', "eval CP1251");       // Resource_FormatType_CP1251 7
281     Interface_Static::Init("step", "read.step.codepage", '&', "eval CP1252");       // Resource_FormatType_CP1252 8
282     Interface_Static::Init("step", "read.step.codepage", '&', "eval CP1253");       // Resource_FormatType_CP1253 9
283     Interface_Static::Init("step", "read.step.codepage", '&', "eval CP1254");       // Resource_FormatType_CP1254 10
284     Interface_Static::Init("step", "read.step.codepage", '&', "eval CP1255");       // Resource_FormatType_CP1255 11
285     Interface_Static::Init("step", "read.step.codepage", '&', "eval CP1256");       // Resource_FormatType_CP1256 12
286     Interface_Static::Init("step", "read.step.codepage", '&', "eval CP1257");       // Resource_FormatType_CP1257 13
287     Interface_Static::Init("step", "read.step.codepage", '&', "eval CP1258");       // Resource_FormatType_CP1258 14 
288     Interface_Static::Init("step", "read.step.codepage", '&', "eval iso8859-1");    // Resource_FormatType_iso8859_1 15
289     Interface_Static::Init("step", "read.step.codepage", '&', "eval iso8859-2");    // Resource_FormatType_iso8859_2 16 
290     Interface_Static::Init("step", "read.step.codepage", '&', "eval iso8859-3");    // Resource_FormatType_iso8859_3 17
291     Interface_Static::Init("step", "read.step.codepage", '&', "eval iso8859-4");    // Resource_FormatType_iso8859_4 18
292     Interface_Static::Init("step", "read.step.codepage", '&', "eval iso8859-5");    // Resource_FormatType_iso8859_5 19
293     Interface_Static::Init("step", "read.step.codepage", '&', "eval iso8859-6");    // Resource_FormatType_iso8859_6 20
294     Interface_Static::Init("step", "read.step.codepage", '&', "eval iso8859-7");    // Resource_FormatType_iso8859_7 21
295     Interface_Static::Init("step", "read.step.codepage", '&', "eval iso8859-8");    // Resource_FormatType_iso8859_8 22
296     Interface_Static::Init("step", "read.step.codepage", '&', "eval iso8859-9");    // Resource_FormatType_iso8859_9 23
297     Interface_Static::Init("step", "read.step.codepage", '&', "eval CP850");        // Resource_FormatType_CP850 24
298     Interface_Static::SetCVal("read.step.codepage", "UTF8");
299
300     // Tessellated geometry reading: Off by default
301     Interface_Static::Init("step", "read.step.tessellated", 'e', "");
302     Interface_Static::Init("step", "read.step.tessellated", '&', "enum 0");
303     Interface_Static::Init("step", "read.step.tessellated", '&', "eval Off");       // 0
304     Interface_Static::Init("step", "read.step.tessellated", '&', "eval On");        // 1
305     Interface_Static::Init("step", "read.step.tessellated", '&', "eval OnNoBRep");  // 2
306     Interface_Static::SetCVal("read.step.tessellated", "On");
307
308     // Tessellated geometry writing: Off by default
309     Interface_Static::Init("step", "write.step.tessellated", 'e', "");
310     Interface_Static::Init("step", "write.step.tessellated", '&', "enum 0");
311     Interface_Static::Init("step", "write.step.tessellated", '&', "eval Off");      // 0
312     Interface_Static::Init("step", "write.step.tessellated", '&', "eval On");       // 1
313     Interface_Static::Init("step", "write.step.tessellated", '&', "eval OnNoBRep"); // 2
314     Interface_Static::SetCVal("write.step.tessellated", "OnNoBRep");
315
316     Standard_STATIC_ASSERT((int)Resource_FormatType_CP850 - (int)Resource_FormatType_CP1250 == 18); // "Error: Invalid Codepage Enumeration"
317
318     init = Standard_True;
319   }
320
321   Handle(STEPControl_ActorWrite) ActWrite = new STEPControl_ActorWrite;
322   ActWrite->SetGroupMode (Interface_Static::IVal("write.step.assembly"));
323   myAdaptorWrite = ActWrite;
324
325   Handle(StepSelect_WorkLibrary) swl = new StepSelect_WorkLibrary;
326   swl->SetDumpLabel(1);
327   myAdaptorLibrary  = swl;
328   myAdaptorProtocol = STEPEdit::Protocol();
329   myAdaptorRead     = new STEPControl_ActorRead;  // par ex pour Recognize
330
331   SetModeWrite (0,4);
332   SetModeWriteHelp (0,"As Is");
333   SetModeWriteHelp (1,"Faceted Brep");
334   SetModeWriteHelp (2,"Shell Based");
335   SetModeWriteHelp (3,"Manifold Solid");
336   SetModeWriteHelp (4,"Wireframe");
337   TraceStatic ("read.surfacecurve.mode",5);
338
339   //   ---  SELECTIONS, SIGNATURES, COMPTEURS, EDITEURS
340
341   DeclareAndCast(IFSelect_Selection,xmr,SessionItem("xst-model-roots"));
342   if (!xmr.IsNull()) {
343     Handle(IFSelect_Signature) sty = STEPEdit::SignType();
344     AddSessionItem (sty,"step-type");
345     Handle(IFSelect_SignCounter) tys = new IFSelect_SignCounter(sty,Standard_False,Standard_True);
346     AddSessionItem (tys,"step-types");
347
348     //szv:mySignType = sty;
349     
350     //pdn S4133 18.02.99
351     AddSessionItem (new IFSelect_SignAncestor(),"xst-derived");
352
353     Handle(STEPSelections_SelectDerived) stdvar = new STEPSelections_SelectDerived();
354     stdvar->SetProtocol(STEPEdit::Protocol());
355     AddSessionItem (stdvar,"step-derived");
356     
357     Handle(IFSelect_SelectSignature) selsdr = STEPEdit::NewSelectSDR();
358     selsdr->SetInput (xmr);
359     AddSessionItem (selsdr,"step-shape-def-repr");
360
361     AddSessionItem (STEPEdit::NewSelectPlacedItem(),"step-placed-items");
362     // input deja pret avec ModelAll
363     AddSessionItem (STEPEdit::NewSelectShapeRepr(),"step-shape-repr");
364   }
365   
366   //pdn
367   Handle(STEPSelections_SelectFaces) stfaces = new STEPSelections_SelectFaces;
368   stfaces->SetInput (xmr);
369   AddSessionItem (stfaces,"step-faces");
370   
371   Handle(STEPSelections_SelectInstances) stinst = new STEPSelections_SelectInstances;
372   AddSessionItem (stinst,"step-instances");
373   
374   Handle(STEPSelections_SelectGSCurves) stcurves = new STEPSelections_SelectGSCurves;
375   stcurves->SetInput (xmr);
376   AddSessionItem (stcurves,"step-GS-curves");
377   
378   Handle(STEPSelections_SelectAssembly) assembly = new STEPSelections_SelectAssembly;
379   assembly->SetInput (xmr);
380   AddSessionItem (assembly,"step-assembly");
381   
382   Handle(APIHeaderSection_EditHeader) edhead = new APIHeaderSection_EditHeader;
383   Handle(IFSelect_EditForm) edheadf = new IFSelect_EditForm (edhead,Standard_False,Standard_True,"Step Header");
384   AddSessionItem (edhead,"step-header-edit");
385   AddSessionItem (edheadf,"step-header");
386
387   Handle(STEPEdit_EditContext) edctx = new STEPEdit_EditContext;
388   Handle(IFSelect_EditForm) edctxf = new IFSelect_EditForm (edctx,Standard_False,Standard_True,"STEP Product Definition Context");
389   AddSessionItem (edctx,"step-context-edit");
390   AddSessionItem (edctxf,"step-context");
391
392
393   Handle(STEPEdit_EditSDR) edsdr = new STEPEdit_EditSDR;
394   Handle(IFSelect_EditForm) edsdrf = new IFSelect_EditForm (edsdr,Standard_False,Standard_True,"STEP Product Data (SDR)");
395   AddSessionItem (edsdr,"step-SDR-edit");
396   AddSessionItem (edsdrf,"step-SDR-data");
397 }
398
399 Handle(Interface_InterfaceModel)  STEPControl_Controller::NewModel () const
400 {
401   return STEPEdit::NewModel();
402 }
403
404 //  ####    PROVISOIRE ???   ####
405
406 IFSelect_ReturnStatus  STEPControl_Controller::TransferWriteShape
407   (const TopoDS_Shape& shape,
408    const Handle(Transfer_FinderProcess)& FP,
409    const Handle(Interface_InterfaceModel)& model,
410    const Standard_Integer modeshape,
411    const Message_ProgressRange& theProgress) const
412 {
413   if (modeshape < 0 || modeshape > 4) return IFSelect_RetError;
414   Handle(STEPControl_ActorWrite) ActWrite =
415     Handle(STEPControl_ActorWrite)::DownCast(myAdaptorWrite);
416 //    A PRESENT ON PASSE PAR LE PROFILE
417   if (!ActWrite.IsNull()) 
418     ActWrite->SetGroupMode (Interface_Static::IVal("write.step.assembly"));
419
420   return XSControl_Controller::TransferWriteShape(shape, FP, model, modeshape, theProgress);
421 }
422
423 Standard_Boolean STEPControl_Controller::Init ()
424 {
425   static Standard_Boolean inic = Standard_False;
426   if (!inic) {
427     Handle(STEPControl_Controller) STEPCTL = new STEPControl_Controller;
428     STEPCTL->AutoRecord();  // avec les noms donnes a la construction
429     XSAlgo::Init();                                                                                                        
430     inic = Standard_True;
431   }
432   return Standard_True;
433 }
434 //=======================================================================
435 //function : Customise
436 //purpose  : 
437 //=======================================================================
438
439 void STEPControl_Controller::Customise(Handle(XSControl_WorkSession)& WS) 
440 {
441   XSControl_Controller::Customise(WS);
442
443   Handle(IFSelect_SelectModelRoots) slr;
444   Handle(Standard_Transient) slr1 = WS->NamedItem("xst-model-roots");
445   if(!slr1.IsNull())
446     slr = Handle(IFSelect_SelectModelRoots)::DownCast(slr1);
447   else  {
448     slr = new IFSelect_SelectModelRoots;
449     WS->AddNamedItem ("xst-model-roots",slr);
450   }
451
452   Handle(STEPSelections_SelectForTransfer) st1= new STEPSelections_SelectForTransfer;
453   st1->SetReader (WS->TransferReader());
454   WS->AddNamedItem ("xst-transferrable-roots",st1);
455
456   if (!slr.IsNull()) {
457     Handle(IFSelect_Signature) sty = STEPEdit::SignType();
458     WS->AddNamedItem ("step-type",sty);
459     
460     Handle(IFSelect_SignCounter) tys = new IFSelect_SignCounter(sty,Standard_False,Standard_True);
461     WS->AddNamedItem ("step-types",tys);
462
463         //szv:mySignType = sty;
464     WS->SetSignType( sty );
465     
466     //pdn S4133 18.02.99
467     WS->AddNamedItem ("xst-derived",new IFSelect_SignAncestor());
468     Handle(STEPSelections_SelectDerived) stdvar = new STEPSelections_SelectDerived();
469     stdvar->SetProtocol(STEPEdit::Protocol());
470     WS->AddNamedItem ("step-derived",stdvar);
471     
472     Handle(IFSelect_SelectSignature) selsdr = STEPEdit::NewSelectSDR();
473     selsdr->SetInput (slr);
474     WS->AddNamedItem ("step-shape-def-repr",selsdr);
475     Handle(IFSelect_SelectSignature) selrrs = STEPEdit::NewSelectPlacedItem();
476     WS->AddNamedItem ("step-placed-items",selrrs);
477     Handle(IFSelect_SelectSignature) selsr = STEPEdit::NewSelectShapeRepr();
478     // input deja pret avec ModelAll
479     WS->AddNamedItem ("step-shape-repr",selsr);
480   }
481   
482   //pdn
483   Handle(STEPSelections_SelectFaces) stfaces = new STEPSelections_SelectFaces;
484   stfaces->SetInput (slr);
485   WS->AddNamedItem ("step-faces",stfaces);
486   
487   Handle(STEPSelections_SelectInstances) stinst = new STEPSelections_SelectInstances;
488   WS->AddNamedItem ("step-instances",stinst);
489   
490   Handle(STEPSelections_SelectGSCurves) stcurves = new STEPSelections_SelectGSCurves;
491   stcurves->SetInput (slr);
492   WS->AddNamedItem ("step-GS-curves",stcurves);
493   
494   Handle(STEPSelections_SelectAssembly) assembly = new STEPSelections_SelectAssembly;
495   assembly->SetInput (slr);
496   WS->AddNamedItem ("step-assembly",assembly);
497   
498   Handle(APIHeaderSection_EditHeader) edhead = new APIHeaderSection_EditHeader;
499   Handle(IFSelect_EditForm) edheadf = new IFSelect_EditForm (edhead,Standard_False,Standard_True,"Step Header");
500   WS->AddNamedItem ("step-header-edit",edhead);
501   WS->AddNamedItem ("step-header",edheadf);
502
503   Handle(STEPEdit_EditContext) edctx = new STEPEdit_EditContext;
504   Handle(IFSelect_EditForm) edctxf = new IFSelect_EditForm (edctx,Standard_False,Standard_True,"STEP Product Definition Context");
505   WS->AddNamedItem ("step-context-edit",edctx);
506   WS->AddNamedItem ("step-context",edctxf);
507
508
509   Handle(STEPEdit_EditSDR) edsdr = new STEPEdit_EditSDR;
510   Handle(IFSelect_EditForm) edsdrf = new IFSelect_EditForm (edsdr,Standard_False,Standard_True,"STEP Product Data (SDR)");
511   WS->AddNamedItem ("step-SDR-edit",edsdr);
512   WS->AddNamedItem ("step-SDR-data",edsdrf);
513
514   
515   
516 }