1 // Copyright (c) 1999-2012 OPEN CASCADE SAS
3 // The content of this file is subject to the Open CASCADE Technology Public
4 // License Version 6.5 (the "License"). You may not use the content of this file
5 // except in compliance with the License. Please obtain a copy of the License
6 // at http://www.opencascade.org and read it completely before using this file.
8 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
9 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
11 // The Original Code and all software distributed under the License is
12 // distributed on an "AS IS" basis, without warranty of any kind, and the
13 // Initial Developer hereby disclaims all such warranties, including without
14 // limitation, any warranties of merchantability, fitness for a particular
15 // purpose or non-infringement. Please see the License for the specific terms
16 // and conditions governing the rights and limitations under the License.
18 // Integration to ensure SCCS base integrity
19 //#58 rln 28.12.98 changing default values for Global Section
20 //pdn 11.01.99 including <stdio.h> for compilation on NT
21 //gka 19.01.99 changing date parameters and number of IGES version, adding parameter(ApllicationProtocol)
22 //#65 rln 12.02.99 S4151 (explicitly force YYMMDD.HHMMSS before Y2000 and YYYYMMDD.HHMMSS after Y2000)
25 #include <IGESData.ixx>
26 #include <IGESData_Protocol.hxx>
27 #include <IGESData_DefaultGeneral.hxx>
28 #include <IGESData_DefaultSpecific.hxx>
30 #include <TCollection_HAsciiString.hxx>
31 #include <IGESData_GlobalSection.hxx>
32 #include <IGESData_IGESModel.hxx>
33 #include <Interface_InterfaceModel.hxx>
35 #include <Interface_Static.hxx>
36 #include <Message_MsgFile.hxx>
37 #include <Standard_Integer.hxx>
38 #include <Standard_Real.hxx>
39 #include <OSD_Process.hxx>
41 #include <Interface_Version.hxx>
42 #include <Quantity_Date.hxx>
45 static Handle(IGESData_Protocol) proto;
47 static Handle(IGESData_DefaultGeneral) stmod;
48 static Handle(IGESData_DefaultSpecific) speci;
51 void IGESData::Init ()
53 if (proto.IsNull()) proto = new IGESData_Protocol;
54 if (stmod.IsNull()) stmod = new IGESData_DefaultGeneral;
55 if (speci.IsNull()) speci = new IGESData_DefaultSpecific;
56 // et modele template "iges"
57 if (Interface_InterfaceModel::HasTemplate("iges")) return;
61 // Static Parameters - see also Static Standards
63 Interface_Static::Standards();
65 Interface_Static::Init ("XSTEP","read.iges.bspline.approxd1.mode",'e',"");
66 Interface_Static::Init ("XSTEP","read.iges.bspline.approxd1.mode",'&',"ematch 0");
67 Interface_Static::Init ("XSTEP","read.iges.bspline.approxd1.mode",'&',"eval Off");
68 Interface_Static::Init ("XSTEP","read.iges.bspline.approxd1.mode",'&',"eval On");
69 Interface_Static::SetIVal ("read.iges.bspline.approxd1.mode",0);
71 Interface_Static::Init ("XSTEP","read.iges.bspline.continuity",'i',"1");
72 Interface_Static::Init ("XSTEP","read.iges.bspline.continuity",'&',"imin 0");
73 Interface_Static::Init ("XSTEP","read.iges.bspline.continuity",'&',"imax 2");
75 //#58 rln Interface_Static::Init ("XSTEP","write.iges.header.product" ,'t',"");
76 Interface_Static::Init ("XSTEP","write.iges.header.receiver",'t',"");//58 rln Unknown
77 Interface_Static::Init ("XSTEP","write.iges.header.author" ,'t',process.UserName().ToCString());
78 Interface_Static::Init ("XSTEP","write.iges.header.company" ,'t',"");//58 rln Matra Datavision
80 Interface_Static::Init ("XSTEP","write.iges.unit",'e',"");
81 Interface_Static::Init ("XSTEP","write.iges.unit",'&',"enum 1");
82 Interface_Static::Init ("XSTEP","write.iges.unit",'&',"eval INCH"); // 1
83 Interface_Static::Init ("XSTEP","write.iges.unit",'&',"eval MM"); // 2
84 Interface_Static::Init ("XSTEP","write.iges.unit",'&',"eval ??"); // 3
85 Interface_Static::Init ("XSTEP","write.iges.unit",'&',"eval FT"); // 4
86 Interface_Static::Init ("XSTEP","write.iges.unit",'&',"eval MI"); // 5
87 Interface_Static::Init ("XSTEP","write.iges.unit",'&',"eval M"); // 6
88 Interface_Static::Init ("XSTEP","write.iges.unit",'&',"eval KM"); // 7
89 Interface_Static::Init ("XSTEP","write.iges.unit",'&',"eval MIL"); // 8
90 Interface_Static::Init ("XSTEP","write.iges.unit",'&',"eval UM"); // 9
91 Interface_Static::Init ("XSTEP","write.iges.unit",'&',"eval CM"); //10
92 Interface_Static::Init ("XSTEP","write.iges.unit",'&',"eval UIN"); //11
93 Interface_Static::SetCVal ("write.iges.unit","MM");
95 Interface_Static::Init ("XSTEP","write.iges.brep.mode",'e',"");
96 Interface_Static::Init ("XSTEP","write.iges.brep.mode",'&',"ematch 0");
97 Interface_Static::Init ("XSTEP","write.iges.brep.mode",'&',"eval Faces");
98 Interface_Static::Init ("XSTEP","write.iges.brep.mode",'&',"eval BRep");
99 Interface_Static::SetIVal ("write.iges.brep.mode",0);
101 //S4181 pdn 23.04.99: adding new parameter handling writing of elementary surfaces
102 Interface_Static::Init ("XSTEP","write.convertsurface.mode",'e',"");
103 Interface_Static::Init ("XSTEP","write.convertsurface.mode",'&',"ematch 0");
104 Interface_Static::Init ("XSTEP","write.convertsurface.mode",'&',"eval Off");
105 Interface_Static::Init ("XSTEP","write.convertsurface.mode",'&',"eval On");
106 Interface_Static::SetIVal ("write.convertsurface.mode",0);
108 // abv 15.11.00: ShapeProcessing
109 Interface_Static::Init ("XSTEP","write.iges.resource.name",'t',"IGES");
110 Interface_Static::Init ("XSTEP","read.iges.resource.name",'t',"IGES");
111 Interface_Static::Init ("XSTEP","write.iges.sequence",'t',"ToIGES");
112 Interface_Static::Init ("XSTEP","read.iges.sequence",'t',"FromIGES");
114 // sln 11.06.2002 OCC448 : Initialize "read.onlyvisible" parameter to control transfering
115 // invisiable sub entities which logicaly depend on the grouping entities
116 Interface_Static::Init ("XSTEP","read.iges.onlyvisible",'e',"");
117 Interface_Static::Init ("XSTEP","read.iges.onlyvisible",'&',"ematch 0");
118 Interface_Static::Init ("XSTEP","read.iges.onlyvisible",'&',"eval Off");
119 Interface_Static::Init ("XSTEP","read.iges.onlyvisible",'&',"eval On");
120 Interface_Static::SetIVal ("read.iges.onlyvisible",0);
122 //gka added parameter for reading failed entities. 19.07
123 Interface_Static::Init ("XSTEP","read.iges.faulty.entities",'e',"");
124 Interface_Static::Init ("XSTEP","read.iges.faulty.entities",'&',"ematch 0");
125 Interface_Static::Init ("XSTEP","read.iges.faulty.entities",'&',"eval Off");
126 Interface_Static::Init ("XSTEP","read.iges.faulty.entities",'&',"eval On");
127 Interface_Static::SetIVal ("read.iges.faulty.entities",0);
129 //ika added parameter for writing planes mode 2.11.2012
130 Interface_Static::Init ("XSTEP","write.iges.plane.mode",'e',"");
131 Interface_Static::Init ("XSTEP","write.iges.plane.mode",'&',"ematch 0");
132 Interface_Static::Init ("XSTEP","write.iges.plane.mode",'&',"eval Plane");
133 Interface_Static::Init ("XSTEP","write.iges.plane.mode",'&',"eval BSpline");
134 Interface_Static::SetIVal ("write.iges.plane.mode",0);
135 // Message File for IGES
138 Message_MsgFile::LoadFromEnv ("CSF_XSMessage","IGES");
140 // Creating the Global Section
141 //----------------------------
143 IGESData_GlobalSection GS;
144 //#58 rln 28.12.98 changing default values for Global Section
146 sprintf (procver, XSTEP_PROCESSOR_VERSION, "IGES");
147 Handle(TCollection_HAsciiString) gsys = new TCollection_HAsciiString (procver);
148 Interface_Static::Init ("XSTEP","write.iges.header.product" ,'t',procver);
150 /* Handle(TCollection_HAsciiString) gsys = new TCollection_HAsciiString
152 gsys->AssignCat(" on ");
156 cout<<"-- OSD_Path::SystemVersion, does not work well on HP-UX"<<endl;
159 (host.SystemVersion().ToCString());
162 // SendName : nom significatif de la piece transmise par exemple
163 // SystemId : c est MDTV etc
164 // InterfaceVersion : la version en cours de XSTEP; incluant la plateforme
166 char nomsys[100]; int istat; long lstat;
167 struct utsname infosy;
168 istat = uname (&infosy);
169 lstat = sysinfo (SI_HW_PROVIDER,nomsys,99);
170 Handle(TCollection_HAsciiString) gsys = new TCollection_HAsciiString(nomsys);
171 gsys->AssignCat(" ");
172 lstat = sysinfo (SI_ARCHITECTURE,nomsys,99);
173 gsys->AssignCat(nomsys);
174 gsys->AssignCat("/");
175 gsys->AssignCat(infosy.sysname);
176 gsys->AssignCat(" ");
177 gsys->AssignCat(infosy.release);
179 Standard_Integer year; //gka 19.01.99
181 Quantity_Date ladate = system.SystemDate();
182 year = ladate.Year();
183 Handle(TCollection_HAsciiString) datestr;
185 //#65 rln 12.02.99 S4151 (explicitly force YYMMDD.HHMMSS before Y2000)
186 datestr = GS.NewDateString(0,0,0,0,0,0,0);
188 //#65 rln 12.02.99 S4151 (explicitly force YYYYMMDD.HHMMSS after Y2000)
189 datestr = GS.NewDateString(0,0,0,0,0,0,-1);
190 GS.SetSeparator (',');
192 GS.SetSendName (new TCollection_HAsciiString(Interface_Static::CVal("write.iges.header.product")));
193 GS.SetFileName (new TCollection_HAsciiString("Filename.iges"));
194 GS.SetSystemId (new TCollection_HAsciiString(XSTEP_SYSTEM_VERSION));//#58 rln "MATRA-DATAVISION EUCLID-QUANTUM"
195 GS.SetInterfaceVersion (gsys);
196 GS.SetIntegerBits ( IntegerSize() );
197 GS.SetMaxPower10Single ( RealLast10Exp() );
198 GS.SetMaxDigitsSingle ( RealDigits() );
199 GS.SetMaxPower10Double ( RealLast10Exp() );
200 GS.SetMaxDigitsDouble ( RealDigits() );
201 GS.SetReceiveName (Interface_Static::Static("write.iges.header.receiver")->HStringValue());
202 // new TCollection_HAsciiString("Unknown");
204 GS.SetUnitFlag (Interface_Static::IVal("write.iges.unit"));
205 GS.SetUnitName (new TCollection_HAsciiString(Interface_Static::CVal("write.iges.unit")));
206 GS.SetLineWeightGrad (1);
207 GS.SetMaxLineWeight (0.01);
208 GS.SetDate (datestr);
209 GS.SetResolution (0.0001);
210 GS.SetMaxCoord (0.0 /*1000.0*/);//22.10.98 rln BUC60081
211 GS.SetAuthorName (Interface_Static::Static("write.iges.header.author")->HStringValue());
212 // new TCollection_HAsciiString (process.UserName());
213 GS.SetCompanyName (Interface_Static::Static("write.iges.header.company")->HStringValue());
214 // new TCollection_HAsciiString("Matra Datavision");
215 GS.SetIGESVersion (11); // pour IGES-5.3 //gka 19.01.99
216 GS.SetDraftingStandard (0);
217 GS.SetLastChangeDate (datestr);
218 GS.SetApplicationProtocol(new TCollection_HAsciiString("")); //gka 19.01.99
220 // Interface_Check check;
221 // GS.Init(params, check);
223 // Creating the Model
224 //-------------------
226 Handle(IGESData_IGESModel) model = new IGESData_IGESModel;
227 model->SetGlobalSection(GS);
228 Interface_InterfaceModel::SetTemplate ("iges", model);
231 Handle(IGESData_Protocol) IGESData::Protocol ()