973c2be1 |
1 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
2 | // |
973c2be1 |
3 | // This file is part of Open CASCADE Technology software library. |
b311480e |
4 | // |
d5f74e42 |
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 |
973c2be1 |
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. |
b311480e |
10 | // |
973c2be1 |
11 | // Alternatively, this file may be used under the terms of Open CASCADE |
12 | // commercial license or contractual agreement. |
b311480e |
13 | |
7fd59977 |
14 | // Integration to ensure SCCS base integrity |
15 | //#58 rln 28.12.98 changing default values for Global Section |
16 | //pdn 11.01.99 including <stdio.h> for compilation on NT |
17 | //gka 19.01.99 changing date parameters and number of IGES version, adding parameter(ApllicationProtocol) |
18 | //#65 rln 12.02.99 S4151 (explicitly force YYMMDD.HHMMSS before Y2000 and YYYYMMDD.HHMMSS after Y2000) |
19 | |
20 | #include <stdio.h> |
21 | #include <IGESData.ixx> |
22 | #include <IGESData_Protocol.hxx> |
23 | #include <IGESData_DefaultGeneral.hxx> |
24 | #include <IGESData_DefaultSpecific.hxx> |
25 | |
26 | #include <TCollection_HAsciiString.hxx> |
27 | #include <IGESData_GlobalSection.hxx> |
28 | #include <IGESData_IGESModel.hxx> |
29 | #include <Interface_InterfaceModel.hxx> |
30 | |
31 | #include <Interface_Static.hxx> |
32 | #include <Message_MsgFile.hxx> |
33 | #include <Standard_Integer.hxx> |
34 | #include <Standard_Real.hxx> |
35 | #include <OSD_Process.hxx> |
36 | |
37 | #include <Interface_Version.hxx> |
38 | #include <Quantity_Date.hxx> |
39 | |
40 | |
41 | static Handle(IGESData_Protocol) proto; |
42 | |
43 | static Handle(IGESData_DefaultGeneral) stmod; |
44 | static Handle(IGESData_DefaultSpecific) speci; |
45 | |
46 | |
47 | void IGESData::Init () |
48 | { |
49 | if (proto.IsNull()) proto = new IGESData_Protocol; |
50 | if (stmod.IsNull()) stmod = new IGESData_DefaultGeneral; |
51 | if (speci.IsNull()) speci = new IGESData_DefaultSpecific; |
52 | // et modele template "iges" |
53 | if (Interface_InterfaceModel::HasTemplate("iges")) return; |
54 | |
55 | OSD_Process process; |
56 | |
57 | // Static Parameters - see also Static Standards |
58 | // ----------------- |
59 | Interface_Static::Standards(); |
60 | |
61 | Interface_Static::Init ("XSTEP","read.iges.bspline.approxd1.mode",'e',""); |
62 | Interface_Static::Init ("XSTEP","read.iges.bspline.approxd1.mode",'&',"ematch 0"); |
63 | Interface_Static::Init ("XSTEP","read.iges.bspline.approxd1.mode",'&',"eval Off"); |
64 | Interface_Static::Init ("XSTEP","read.iges.bspline.approxd1.mode",'&',"eval On"); |
65 | Interface_Static::SetIVal ("read.iges.bspline.approxd1.mode",0); |
66 | |
67 | Interface_Static::Init ("XSTEP","read.iges.bspline.continuity",'i',"1"); |
68 | Interface_Static::Init ("XSTEP","read.iges.bspline.continuity",'&',"imin 0"); |
69 | Interface_Static::Init ("XSTEP","read.iges.bspline.continuity",'&',"imax 2"); |
70 | |
71 | //#58 rln Interface_Static::Init ("XSTEP","write.iges.header.product" ,'t',""); |
72 | Interface_Static::Init ("XSTEP","write.iges.header.receiver",'t',"");//58 rln Unknown |
73 | Interface_Static::Init ("XSTEP","write.iges.header.author" ,'t',process.UserName().ToCString()); |
74 | Interface_Static::Init ("XSTEP","write.iges.header.company" ,'t',"");//58 rln Matra Datavision |
75 | |
76 | Interface_Static::Init ("XSTEP","write.iges.unit",'e',""); |
77 | Interface_Static::Init ("XSTEP","write.iges.unit",'&',"enum 1"); |
78 | Interface_Static::Init ("XSTEP","write.iges.unit",'&',"eval INCH"); // 1 |
79 | Interface_Static::Init ("XSTEP","write.iges.unit",'&',"eval MM"); // 2 |
80 | Interface_Static::Init ("XSTEP","write.iges.unit",'&',"eval ??"); // 3 |
81 | Interface_Static::Init ("XSTEP","write.iges.unit",'&',"eval FT"); // 4 |
82 | Interface_Static::Init ("XSTEP","write.iges.unit",'&',"eval MI"); // 5 |
83 | Interface_Static::Init ("XSTEP","write.iges.unit",'&',"eval M"); // 6 |
84 | Interface_Static::Init ("XSTEP","write.iges.unit",'&',"eval KM"); // 7 |
85 | Interface_Static::Init ("XSTEP","write.iges.unit",'&',"eval MIL"); // 8 |
86 | Interface_Static::Init ("XSTEP","write.iges.unit",'&',"eval UM"); // 9 |
87 | Interface_Static::Init ("XSTEP","write.iges.unit",'&',"eval CM"); //10 |
88 | Interface_Static::Init ("XSTEP","write.iges.unit",'&',"eval UIN"); //11 |
89 | Interface_Static::SetCVal ("write.iges.unit","MM"); |
90 | |
91 | Interface_Static::Init ("XSTEP","write.iges.brep.mode",'e',""); |
92 | Interface_Static::Init ("XSTEP","write.iges.brep.mode",'&',"ematch 0"); |
93 | Interface_Static::Init ("XSTEP","write.iges.brep.mode",'&',"eval Faces"); |
94 | Interface_Static::Init ("XSTEP","write.iges.brep.mode",'&',"eval BRep"); |
95 | Interface_Static::SetIVal ("write.iges.brep.mode",0); |
96 | |
97 | //S4181 pdn 23.04.99: adding new parameter handling writing of elementary surfaces |
98 | Interface_Static::Init ("XSTEP","write.convertsurface.mode",'e',""); |
99 | Interface_Static::Init ("XSTEP","write.convertsurface.mode",'&',"ematch 0"); |
100 | Interface_Static::Init ("XSTEP","write.convertsurface.mode",'&',"eval Off"); |
101 | Interface_Static::Init ("XSTEP","write.convertsurface.mode",'&',"eval On"); |
102 | Interface_Static::SetIVal ("write.convertsurface.mode",0); |
103 | |
104 | // abv 15.11.00: ShapeProcessing |
105 | Interface_Static::Init ("XSTEP","write.iges.resource.name",'t',"IGES"); |
106 | Interface_Static::Init ("XSTEP","read.iges.resource.name",'t',"IGES"); |
107 | Interface_Static::Init ("XSTEP","write.iges.sequence",'t',"ToIGES"); |
108 | Interface_Static::Init ("XSTEP","read.iges.sequence",'t',"FromIGES"); |
109 | |
110 | // sln 11.06.2002 OCC448 : Initialize "read.onlyvisible" parameter to control transfering |
111 | // invisiable sub entities which logicaly depend on the grouping entities |
112 | Interface_Static::Init ("XSTEP","read.iges.onlyvisible",'e',""); |
113 | Interface_Static::Init ("XSTEP","read.iges.onlyvisible",'&',"ematch 0"); |
114 | Interface_Static::Init ("XSTEP","read.iges.onlyvisible",'&',"eval Off"); |
115 | Interface_Static::Init ("XSTEP","read.iges.onlyvisible",'&',"eval On"); |
116 | Interface_Static::SetIVal ("read.iges.onlyvisible",0); |
117 | |
118 | //gka added parameter for reading failed entities. 19.07 |
119 | Interface_Static::Init ("XSTEP","read.iges.faulty.entities",'e',""); |
120 | Interface_Static::Init ("XSTEP","read.iges.faulty.entities",'&',"ematch 0"); |
121 | Interface_Static::Init ("XSTEP","read.iges.faulty.entities",'&',"eval Off"); |
122 | Interface_Static::Init ("XSTEP","read.iges.faulty.entities",'&',"eval On"); |
123 | Interface_Static::SetIVal ("read.iges.faulty.entities",0); |
a8fcd8d0 |
124 | |
125 | //ika added parameter for writing planes mode 2.11.2012 |
126 | Interface_Static::Init ("XSTEP","write.iges.plane.mode",'e',""); |
127 | Interface_Static::Init ("XSTEP","write.iges.plane.mode",'&',"ematch 0"); |
128 | Interface_Static::Init ("XSTEP","write.iges.plane.mode",'&',"eval Plane"); |
129 | Interface_Static::Init ("XSTEP","write.iges.plane.mode",'&',"eval BSpline"); |
130 | Interface_Static::SetIVal ("write.iges.plane.mode",0); |
1939140c |
131 | |
132 | //ika added parameter for writing offset curves like BSplines 12.04.2013 |
133 | Interface_Static::Init ("XSTEP","write.iges.offset.mode",'e',""); |
134 | Interface_Static::Init ("XSTEP","write.iges.offset.mode",'&',"ematch 0"); |
135 | Interface_Static::Init ("XSTEP","write.iges.offset.mode",'&',"eval On"); |
136 | Interface_Static::Init ("XSTEP","write.iges.offset.mode",'&',"eval Off"); |
137 | Interface_Static::SetIVal ("write.iges.offset.mode",0); |
7fd59977 |
138 | // Message File for IGES |
139 | // ----------------- |
140 | |
141 | Message_MsgFile::LoadFromEnv ("CSF_XSMessage","IGES"); |
142 | |
143 | // Creating the Global Section |
144 | //---------------------------- |
145 | |
146 | IGESData_GlobalSection GS; |
147 | //#58 rln 28.12.98 changing default values for Global Section |
148 | char procver[80]; |
149 | sprintf (procver, XSTEP_PROCESSOR_VERSION, "IGES"); |
150 | Handle(TCollection_HAsciiString) gsys = new TCollection_HAsciiString (procver); |
151 | Interface_Static::Init ("XSTEP","write.iges.header.product" ,'t',procver); |
152 | |
153 | /* Handle(TCollection_HAsciiString) gsys = new TCollection_HAsciiString |
154 | (XSTEP_VERSION); |
155 | gsys->AssignCat(" on "); |
156 | gsys->AssignCat |
157 | #ifdef HPUX |
158 | ("HP-UX"); |
159 | cout<<"-- OSD_Path::SystemVersion, does not work well on HP-UX"<<endl; |
160 | #endif |
161 | #ifndef HPUX |
162 | (host.SystemVersion().ToCString()); |
163 | #endif |
164 | |
165 | // SendName : nom significatif de la piece transmise par exemple |
166 | // SystemId : c est MDTV etc |
167 | // InterfaceVersion : la version en cours de XSTEP; incluant la plateforme |
168 | |
169 | char nomsys[100]; int istat; long lstat; |
170 | struct utsname infosy; |
171 | istat = uname (&infosy); |
172 | lstat = sysinfo (SI_HW_PROVIDER,nomsys,99); |
173 | Handle(TCollection_HAsciiString) gsys = new TCollection_HAsciiString(nomsys); |
174 | gsys->AssignCat(" "); |
175 | lstat = sysinfo (SI_ARCHITECTURE,nomsys,99); |
176 | gsys->AssignCat(nomsys); |
177 | gsys->AssignCat("/"); |
178 | gsys->AssignCat(infosy.sysname); |
179 | gsys->AssignCat(" "); |
180 | gsys->AssignCat(infosy.release); |
181 | */ |
182 | Standard_Integer year; //gka 19.01.99 |
183 | OSD_Process system; |
184 | Quantity_Date ladate = system.SystemDate(); |
185 | year = ladate.Year(); |
186 | Handle(TCollection_HAsciiString) datestr; |
187 | if( year < 2000 ) |
188 | //#65 rln 12.02.99 S4151 (explicitly force YYMMDD.HHMMSS before Y2000) |
189 | datestr = GS.NewDateString(0,0,0,0,0,0,0); |
190 | else |
191 | //#65 rln 12.02.99 S4151 (explicitly force YYYYMMDD.HHMMSS after Y2000) |
192 | datestr = GS.NewDateString(0,0,0,0,0,0,-1); |
193 | GS.SetSeparator (','); |
194 | GS.SetEndMark (';'); |
195 | GS.SetSendName (new TCollection_HAsciiString(Interface_Static::CVal("write.iges.header.product"))); |
196 | GS.SetFileName (new TCollection_HAsciiString("Filename.iges")); |
197 | GS.SetSystemId (new TCollection_HAsciiString(XSTEP_SYSTEM_VERSION));//#58 rln "MATRA-DATAVISION EUCLID-QUANTUM" |
198 | GS.SetInterfaceVersion (gsys); |
199 | GS.SetIntegerBits ( IntegerSize() ); |
200 | GS.SetMaxPower10Single ( RealLast10Exp() ); |
201 | GS.SetMaxDigitsSingle ( RealDigits() ); |
202 | GS.SetMaxPower10Double ( RealLast10Exp() ); |
203 | GS.SetMaxDigitsDouble ( RealDigits() ); |
204 | GS.SetReceiveName (Interface_Static::Static("write.iges.header.receiver")->HStringValue()); |
205 | // new TCollection_HAsciiString("Unknown"); |
206 | GS.SetScale (1.0); |
207 | GS.SetUnitFlag (Interface_Static::IVal("write.iges.unit")); |
208 | GS.SetUnitName (new TCollection_HAsciiString(Interface_Static::CVal("write.iges.unit"))); |
209 | GS.SetLineWeightGrad (1); |
210 | GS.SetMaxLineWeight (0.01); |
211 | GS.SetDate (datestr); |
212 | GS.SetResolution (0.0001); |
213 | GS.SetMaxCoord (0.0 /*1000.0*/);//22.10.98 rln BUC60081 |
214 | GS.SetAuthorName (Interface_Static::Static("write.iges.header.author")->HStringValue()); |
215 | // new TCollection_HAsciiString (process.UserName()); |
216 | GS.SetCompanyName (Interface_Static::Static("write.iges.header.company")->HStringValue()); |
217 | // new TCollection_HAsciiString("Matra Datavision"); |
218 | GS.SetIGESVersion (11); // pour IGES-5.3 //gka 19.01.99 |
219 | GS.SetDraftingStandard (0); |
220 | GS.SetLastChangeDate (datestr); |
221 | GS.SetApplicationProtocol(new TCollection_HAsciiString("")); //gka 19.01.99 |
222 | |
223 | // Interface_Check check; |
224 | // GS.Init(params, check); |
225 | |
226 | // Creating the Model |
227 | //------------------- |
228 | |
229 | Handle(IGESData_IGESModel) model = new IGESData_IGESModel; |
230 | model->SetGlobalSection(GS); |
231 | Interface_InterfaceModel::SetTemplate ("iges", model); |
232 | } |
233 | |
234 | Handle(IGESData_Protocol) IGESData::Protocol () |
235 | { |
236 | return proto; |
237 | } |