b311480e |
1 | // Created on: 2010-01-15 |
2 | // Created by: Sergey ZARITCHNY |
973c2be1 |
3 | // Copyright (c) 2010-2014 OPEN CASCADE SAS |
b311480e |
4 | // |
973c2be1 |
5 | // This file is part of Open CASCADE Technology software library. |
b311480e |
6 | // |
d5f74e42 |
7 | // This library is free software; you can redistribute it and/or modify it under |
8 | // the terms of the GNU Lesser General Public License version 2.1 as published |
973c2be1 |
9 | // by the Free Software Foundation, with special exception defined in the file |
10 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
11 | // distribution for complete text of the license and disclaimer of any warranty. |
b311480e |
12 | // |
973c2be1 |
13 | // Alternatively, this file may be used under the terms of Open CASCADE |
14 | // commercial license or contractual agreement. |
b311480e |
15 | |
91322f44 |
16 | #include <Draw.hxx> |
7fd59977 |
17 | #include <Draw_Interpretor.hxx> |
18 | #include <Standard_ErrorHandler.hxx> |
19 | #include <DNaming.hxx> |
20 | #include <DBRep.hxx> |
21 | |
22 | #include <BRepTools.hxx> |
23 | #include <BRep_Builder.hxx> |
24 | #include <gp_Trsf.hxx> |
d99f0355 |
25 | #include <Message.hxx> |
7fd59977 |
26 | #include <TopAbs.hxx> |
27 | #include <TopoDS.hxx> |
28 | #include <TopoDS_Shape.hxx> |
29 | #include <TopoDS_Iterator.hxx> |
30 | #include <TopExp_Explorer.hxx> |
31 | #include <TopTools_MapOfShape.hxx> |
32 | #include <TopTools_MapIteratorOfMapOfShape.hxx> |
33 | #include <TopTools_MapOfOrientedShape.hxx> |
34 | #include <TopTools_DataMapOfOrientedShapeShape.hxx> |
35 | #include <TopTools_ListOfShape.hxx> |
36 | #include <TopTools_ListIteratorOfListOfShape.hxx> |
37 | #include <TCollection_AsciiString.hxx> |
38 | #include <Standard_GUID.hxx> |
39 | |
40 | #include <DDF.hxx> |
41 | #include <DDocStd.hxx> |
42 | #include <TDF_TagSource.hxx> |
43 | #include <TDF_Tool.hxx> |
44 | #include <TDF_Reference.hxx> |
45 | #include <TDF_ChildIterator.hxx> |
46 | #include <TDF_ChildIDIterator.hxx> |
47 | #include <TDF_MapIteratorOfLabelMap.hxx> |
48 | #include <TDataStd_Real.hxx> |
49 | #include <TDataStd_Integer.hxx> |
50 | #include <TDataStd_TreeNode.hxx> |
51 | #include <TDataStd_Name.hxx> |
52 | #include <TDataStd_UAttribute.hxx> |
53 | #include <TFunction_Function.hxx> |
54 | #include <TFunction_Logbook.hxx> |
55 | #include <TFunction_Driver.hxx> |
56 | #include <TFunction_DriverTable.hxx> |
57 | #include <TNaming_NamedShape.hxx> |
58 | #include <TNaming_Selector.hxx> |
59 | #include <TNaming_Builder.hxx> |
60 | #include <TNaming_Naming.hxx> |
61 | #include <TNaming_Name.hxx> |
62 | #include <TDocStd_Document.hxx> |
63 | |
64 | #include <DNaming_BoxDriver.hxx> |
65 | #include <DNaming_CylinderDriver.hxx> |
66 | #include <DNaming_SelectionDriver.hxx> |
67 | #include <DNaming_BooleanOperationDriver.hxx> |
68 | #include <DNaming_FilletDriver.hxx> |
69 | #include <DNaming_TransformationDriver.hxx> |
70 | #include <DNaming_PrismDriver.hxx> |
71 | #include <DNaming_RevolutionDriver.hxx> |
72 | #include <DNaming_SphereDriver.hxx> |
73 | #include <DNaming_PointDriver.hxx> |
74 | #include <DNaming_Line3DDriver.hxx> |
57c28b61 |
75 | #ifdef _WIN32 |
7fd59977 |
76 | #define EXCEPTION ... |
77 | #else |
a738b534 |
78 | #define EXCEPTION Standard_Failure const& |
7fd59977 |
79 | #endif |
80 | #include <ModelDefinitions.hxx> |
81 | //#define DEBUG |
82 | //======================================================================= |
83 | static Handle(TDataStd_UAttribute) AddObject(const Handle(TDocStd_Document)& aDoc) |
84 | { |
85 | Handle(TDataStd_TreeNode) aRootNode = TDataStd_TreeNode::Set(aDoc->Main()); |
86 | const TDF_Label& aLabel = TDF_TagSource::NewChild(aDoc->Main()); |
87 | |
88 | Handle(TDataStd_UAttribute) anObj = TDataStd_UAttribute::Set(aLabel,GEOMOBJECT_GUID); |
89 | Handle(TDataStd_TreeNode) aNode = TDataStd_TreeNode::Set(aLabel); |
90 | aRootNode->Append(aNode); |
91 | return anObj; |
92 | } |
93 | //======================================================================= |
94 | //function : DNaming_AddObject |
95 | //purpose : AddObject D [Name] |
96 | // - adds new object (UAttribute) under main label |
97 | //======================================================================= |
98 | static Standard_Integer DNaming_AddObject(Draw_Interpretor& di, |
99 | Standard_Integer nb, |
100 | const char** a) |
101 | { |
102 | if(nb > 1) { |
103 | Handle(TDocStd_Document) aDoc; |
104 | if (!DDocStd::GetDocument(a[1],aDoc)) return 1; |
105 | Handle(TDataStd_UAttribute) anObj = AddObject (aDoc); |
106 | if(!anObj.IsNull()) { |
107 | if(nb == 3) |
94f16a89 |
108 | TDataStd_Name::Set(anObj->Label(), TCollection_ExtendedString (a[2], Standard_True)); |
7fd59977 |
109 | DDF::ReturnLabel(di, anObj->Label()); |
110 | return 0; |
111 | } |
112 | } |
586db386 |
113 | di << "DNaming_AddObject: Error\n"; |
7fd59977 |
114 | return 1; |
115 | } |
116 | |
117 | #include <NCollection_DataMap.hxx> |
118 | typedef NCollection_DataMap <TCollection_AsciiString, |
119 | Standard_GUID> DataMapOfAStringGUID; |
120 | static Standard_Boolean isBuilt(Standard_False); |
121 | static DataMapOfAStringGUID aDMap; |
122 | //======================================================================= |
123 | static Standard_Boolean GetFuncGUID(Standard_CString aKey,Standard_GUID& GUID) |
124 | { |
125 | Standard_Boolean aRes(Standard_False); |
126 | |
127 | if(!isBuilt) { |
372ceec4 |
128 | aDMap.Bind("PntXYZ", PNTXYZ_GUID); |
129 | aDMap.Bind("PntRLT", PNTRLT_GUID); |
130 | aDMap.Bind("Line3D", LINE3D_GUID); |
131 | aDMap.Bind("Box", BOX_GUID); |
132 | aDMap.Bind("Sph", SPH_GUID); |
133 | aDMap.Bind("Cyl", CYL_GUID); |
134 | aDMap.Bind("Cut", CUT_GUID); |
135 | aDMap.Bind("Fuse", FUSE_GUID); |
136 | aDMap.Bind("Comm", COMMON_GUID); |
137 | aDMap.Bind("Prism", PRISM_GUID); |
138 | aDMap.Bind("FulRevol", FULREVOL_GUID); |
139 | aDMap.Bind("SecRevol", SECREVOL_GUID); |
140 | aDMap.Bind("PMirr", PMIRR_GUID); |
141 | aDMap.Bind("PTxyz", PTXYZ_GUID); |
142 | aDMap.Bind("PTALine", PTALINE_GUID); |
143 | aDMap.Bind("PRLine", PRRLINE_GUID); |
144 | aDMap.Bind("Fillet", FILLT_GUID); |
145 | aDMap.Bind("Attach", ATTCH_GUID); |
146 | aDMap.Bind("XAttach", XTTCH_GUID); |
147 | aDMap.Bind("Section", SECTION_GUID); |
7fd59977 |
148 | isBuilt = Standard_True; |
149 | } |
150 | |
151 | if(aDMap.IsBound(aKey)) { |
152 | GUID = aDMap.Find(aKey); |
153 | aRes = Standard_True; |
154 | } |
155 | return aRes; |
156 | } |
157 | //======================================================================= |
158 | static Handle(TFunction_Driver) GetDriver(const TCollection_AsciiString& name) |
159 | { |
160 | Handle(TFunction_Driver) aDrv; |
161 | if(name == "Box") |
162 | aDrv = new DNaming_BoxDriver(); |
163 | else if(name == "Cyl") |
164 | aDrv = new DNaming_CylinderDriver(); |
165 | else if(name == "Sph") |
166 | aDrv = new DNaming_SphereDriver(); |
167 | else if(name == "Cut") |
168 | aDrv = new DNaming_BooleanOperationDriver(); |
169 | else if(name == "Fuse") |
170 | aDrv = new DNaming_BooleanOperationDriver(); |
171 | else if(name == "Comm") |
172 | aDrv = new DNaming_BooleanOperationDriver(); |
173 | else if(name == "Prism") |
174 | aDrv = new DNaming_PrismDriver(); |
175 | else if(name == "FulRevol") |
176 | aDrv = new DNaming_RevolutionDriver(); |
177 | else if(name == "SecRevol") |
178 | aDrv = new DNaming_RevolutionDriver(); |
179 | else if(name == "PTxyz") |
180 | aDrv = new DNaming_TransformationDriver(); |
181 | else if(name == "PTALine") |
182 | aDrv = new DNaming_TransformationDriver(); |
183 | else if(name == "PRLine") |
184 | aDrv = new DNaming_TransformationDriver(); |
185 | else if(name == "PMirr") |
186 | aDrv = new DNaming_TransformationDriver(); |
187 | else if(name == "Fillet") |
188 | aDrv = new DNaming_FilletDriver(); |
189 | else if(name == "Attach") |
190 | aDrv = new DNaming_SelectionDriver(); |
191 | else if(name == "XAttach") |
192 | aDrv = new DNaming_SelectionDriver(); |
193 | else if(name == "PntXYZ") |
194 | aDrv = new DNaming_PointDriver(); |
195 | else if(name == "PntRLT") |
196 | aDrv = new DNaming_PointDriver(); |
372ceec4 |
197 | else if(name == "Line3D") |
7fd59977 |
198 | aDrv = new DNaming_Line3DDriver(); |
372ceec4 |
199 | else if(name == "Section") |
200 | aDrv = new DNaming_BooleanOperationDriver(); |
7fd59977 |
201 | else |
04232180 |
202 | std::cout << "the specified driver is not supported" <<std::endl; |
7fd59977 |
203 | return aDrv; |
204 | } |
205 | //======================================================================= |
206 | //function : DNaming_AddDriver |
207 | //purpose : "AddDriver Doc Name1 Name2 ..." |
208 | //======================================================================= |
35e08fe8 |
209 | static Standard_Integer DNaming_AddDriver (Draw_Interpretor& /*theDI*/, |
7fd59977 |
210 | Standard_Integer theNb, |
211 | const char** theArg) |
212 | { |
213 | if (theNb >= 3) { |
214 | Handle(TDocStd_Document) aDoc; |
215 | Standard_CString aDocS(theArg[1]); |
216 | if (!DDocStd::GetDocument(aDocS, aDoc)) return 1; |
217 | Handle(TFunction_DriverTable) aFunctionDrvTable = TFunction_DriverTable::Get(); |
218 | for(int i = 2; i < theNb; i++) { |
219 | Standard_GUID drvGUID; |
220 | if(!GetFuncGUID(theArg[i],drvGUID)) continue; |
221 | aFunctionDrvTable->AddDriver(drvGUID, GetDriver(theArg[i])); |
0797d9d3 |
222 | #ifdef OCCT_DEBUG |
04232180 |
223 | std::cout << "DNaming_AddDriver : " << theArg[i] << " driver is added" <<std::endl; |
7fd59977 |
224 | #endif |
225 | } |
226 | return 0; |
227 | } |
0797d9d3 |
228 | #ifdef OCCT_DEBUG |
04232180 |
229 | std::cout << "DNaming_AddDriver : Error" << std::endl; |
63c629aa |
230 | #endif |
7fd59977 |
231 | return 1; |
232 | } |
233 | |
234 | //======================================================================= |
235 | static Handle(TFunction_Function) SetFunctionDS(const TDF_Label& objLabel, |
236 | const Standard_GUID& funGUID) |
237 | { |
238 | //set function |
239 | const TDF_Label& aLabel = TDF_TagSource::NewChild(objLabel); |
240 | Handle(TFunction_Function) aFun = TFunction_Function::Set(aLabel,funGUID); |
241 | |
242 | Handle(TDataStd_TreeNode) aNode = TDataStd_TreeNode::Set(aLabel); |
243 | Handle(TDataStd_TreeNode) objNode; |
244 | objLabel.FindAttribute(TDataStd_TreeNode::GetDefaultTreeID(), objNode); |
245 | if(!objNode.IsNull()) |
246 | objNode->Append(aNode); |
247 | |
248 | //set function data sub-structure |
249 | const TDF_Label& aLab1 = TDF_TagSource::NewChild(aLabel); |
250 | Handle(TDataStd_TreeNode) aNode1 = TDataStd_TreeNode::Set(aLab1); |
251 | TDataStd_Name::Set(aLab1, "Arguments"); |
252 | if(!aNode.IsNull()) |
253 | aNode->Append(aNode1); |
254 | |
255 | const TDF_Label& aLab2 = TDF_TagSource::NewChild(aLabel); |
256 | Handle(TDataStd_TreeNode) aNode2 = TDataStd_TreeNode::Set(aLab2); |
257 | TDataStd_Name::Set(aLab2, "Result"); |
258 | if(!aNode.IsNull()) |
259 | aNode->Append(aNode2); |
260 | return aFun; |
261 | } |
262 | //======================================================================= |
263 | //function : DNaming_AddFunction |
264 | //purpose : AddFunction D ObjEntry FunNane |
265 | // : - adds new function specified by FunName to an object |
266 | // : specified by ObjEntry |
267 | //======================================================================= |
268 | static Standard_Integer DNaming_AddFunction(Draw_Interpretor& di, |
269 | Standard_Integer nb, |
270 | const char** a) |
271 | { |
272 | if(nb == 4) { |
273 | Handle(TDocStd_Document) aDoc; |
274 | if (!DDocStd::GetDocument(a[1],aDoc)) return 1; |
275 | TDF_Label objLabel; |
276 | if (!DDF::FindLabel(aDoc->GetData(),a[2], objLabel)) return 1; |
277 | |
278 | Handle(TDataStd_UAttribute) anObj; |
279 | if(!objLabel.FindAttribute(GEOMOBJECT_GUID, anObj)) { |
280 | di << "DNaming_AddFunction: Object is not found at the specified label: "<< a[2] << "\n"; |
281 | return 1; |
282 | } |
283 | Standard_GUID funGUID; |
284 | if(!GetFuncGUID(a[3],funGUID)) { |
285 | di << "DNaming_AddFunction: the specified function is not supported: "<< a[3] << "\n"; |
286 | return 1; |
287 | } |
288 | Handle(TFunction_Function) aFun = SetFunctionDS(objLabel, funGUID); |
289 | if(!aFun.IsNull()) { |
290 | TCollection_AsciiString aFName = TCollection_AsciiString(a[3]) + "_Function"; |
291 | TDataStd_Name::Set(aFun->Label(), aFName); |
292 | TDF_Reference::Set(objLabel, aFun->Label().FindChild(FUNCTION_RESULT_LABEL)); //result is here |
293 | DDF::ReturnLabel(di, aFun->Label()); |
294 | return 0; |
295 | } |
296 | } |
586db386 |
297 | di << "DNaming_AddObject: Error\n"; |
7fd59977 |
298 | return 1; |
299 | } |
300 | |
301 | |
302 | //======================================================================= |
303 | //function : DNaming_AddBox |
304 | //purpose : "AddBox Doc dx dy dz" |
305 | //======================================================================= |
306 | static Standard_Integer DNaming_AddBox (Draw_Interpretor& theDI, |
307 | Standard_Integer theNb, |
308 | const char** theArg) |
309 | { |
310 | if (theNb >= 4) { |
311 | |
312 | Handle(TDocStd_Document) aDocument; |
313 | Standard_CString aDocS(theArg[1]); |
314 | if (!DDocStd::GetDocument(aDocS, aDocument)) return 1; |
315 | Handle(TDataStd_UAttribute) anObj = AddObject(aDocument); |
316 | if(anObj.IsNull()) return 1; |
317 | Standard_GUID funGUID; |
318 | if(!GetFuncGUID("Box",funGUID)) return 1; |
319 | |
320 | Handle(TFunction_Function) aFun = SetFunctionDS(anObj->Label(), funGUID); |
321 | if(aFun.IsNull()) return 1; |
322 | TDataStd_Name::Set(aFun->Label(), "Box_Function"); |
323 | |
324 | TDF_Reference::Set(anObj->Label(), aFun->Label().FindChild(FUNCTION_RESULT_LABEL)); //result is here |
325 | Standard_Real dx,dy,dz; |
91322f44 |
326 | dx = Draw::Atof(theArg[2]); |
327 | dy = Draw::Atof(theArg[3]); |
328 | dz = Draw::Atof(theArg[4]); |
7fd59977 |
329 | |
330 | DNaming::GetReal(aFun,BOX_DX)->Set(dx); |
331 | DNaming::GetReal(aFun,BOX_DY)->Set(dy); |
332 | DNaming::GetReal(aFun,BOX_DZ)->Set(dz); |
333 | |
334 | DDF::ReturnLabel(theDI, anObj->Label()); |
335 | return 0; |
336 | } |
d99f0355 |
337 | Message::SendFail() << "DNaming_AddBox : Error"; |
7fd59977 |
338 | return 1; |
339 | } |
340 | |
341 | //======================================================================= |
342 | static Handle(TFunction_Function) GetFunction(const TDF_Label& objLabel, const Standard_GUID& funGUID) { |
343 | Handle(TFunction_Function) aFun; |
344 | Handle(TDataStd_TreeNode) aNode; |
345 | objLabel.FindAttribute(TDataStd_TreeNode::GetDefaultTreeID(), aNode); |
346 | if(aNode.IsNull()) return aFun; |
347 | if(!aNode->HasFirst()) return aFun; |
348 | else |
349 | aNode = aNode->First(); |
350 | while(!aNode.IsNull()) { |
351 | if(aNode->FindAttribute(TFunction_Function::GetID(), aFun)) { |
352 | const Standard_GUID& aGUID = aFun->GetDriverGUID(); |
353 | if(aGUID == funGUID) break; |
354 | else aFun.Nullify(); |
355 | } |
356 | aNode = aNode->Next(); |
357 | } |
358 | return aFun; |
359 | } |
360 | //======================================================================= |
361 | //function : DNaming_BoxDX |
362 | //purpose : "BoxDX Doc BoxLabel NewDX" |
363 | //======================================================================= |
364 | |
365 | static Standard_Integer DNaming_BoxDX (Draw_Interpretor& theDI, |
366 | Standard_Integer theNb, |
367 | const char** theArg) |
368 | { |
369 | if (theNb == 4) { |
370 | Handle(TDocStd_Document) aDoc; |
371 | Standard_CString aDocS(theArg[1]); |
372 | if (!DDocStd::GetDocument(aDocS, aDoc)) return 1; |
373 | TDF_Label objLabel; |
374 | if (!DDF::FindLabel(aDoc->GetData(),theArg[2], objLabel)) return 1; |
375 | |
376 | Handle(TDataStd_UAttribute) anObj; |
377 | if(!objLabel.FindAttribute(GEOMOBJECT_GUID, anObj)) return 1; |
378 | Standard_GUID funGUID; |
379 | if(!GetFuncGUID("Box",funGUID)) return 1; |
380 | |
381 | Handle(TFunction_Function) aFun = GetFunction(objLabel,funGUID); |
382 | if(!aFun.IsNull()) { |
91322f44 |
383 | Standard_Real value = Draw::Atof(theArg[3]); |
7fd59977 |
384 | DNaming::GetReal(aFun,BOX_DX)->Set(value); |
385 | DDF::ReturnLabel(theDI, DNaming::GetReal(aFun,BOX_DX)->Label()); |
386 | return 0; |
387 | } |
388 | } |
d99f0355 |
389 | Message::SendFail() << "DNaming_BoxDX : Error"; |
7fd59977 |
390 | return 1; |
391 | } |
392 | |
393 | //======================================================================= |
394 | //function : DNaming_BoxDY |
395 | //purpose : "BoxDY Doc BoxLabel NewDY" |
396 | //======================================================================= |
397 | |
398 | static Standard_Integer DNaming_BoxDY (Draw_Interpretor& theDI, |
399 | Standard_Integer theNb, |
400 | const char** theArg) |
401 | { |
402 | if (theNb == 4) { |
403 | Handle(TDocStd_Document) aDoc; |
404 | Standard_CString aDocS(theArg[1]); |
405 | if (!DDocStd::GetDocument(aDocS, aDoc)) return 1; |
406 | TDF_Label objLabel; |
407 | if (!DDF::FindLabel(aDoc->GetData(),theArg[2], objLabel)) return 1; |
408 | |
409 | Handle(TDataStd_UAttribute) anObj; |
410 | if(!objLabel.FindAttribute(GEOMOBJECT_GUID, anObj)) return 1; |
411 | Standard_GUID funGUID; |
412 | if(!GetFuncGUID("Box",funGUID)) return 1; |
413 | |
414 | Handle(TFunction_Function) aFun = GetFunction(objLabel,funGUID); |
415 | if(!aFun.IsNull()) { |
91322f44 |
416 | Standard_Real value = Draw::Atof(theArg[3]); |
7fd59977 |
417 | DNaming::GetReal(aFun,BOX_DY)->Set(value); |
418 | DDF::ReturnLabel(theDI, DNaming::GetReal(aFun,BOX_DY)->Label()); |
419 | return 0; |
420 | } |
421 | } |
d99f0355 |
422 | Message::SendFail() << "DNaming_BoxDY : Error"; |
7fd59977 |
423 | return 1; |
424 | } |
425 | |
426 | //======================================================================= |
427 | //function : DNaming_BoxDZ |
428 | //purpose : "BoxDZ Doc BoxLabel NewDZ" |
429 | //======================================================================= |
430 | |
431 | static Standard_Integer DNaming_BoxDZ (Draw_Interpretor& theDI, |
432 | Standard_Integer theNb, |
433 | const char** theArg) |
434 | { |
435 | if (theNb == 4) { |
436 | Handle(TDocStd_Document) aDoc; |
437 | Standard_CString aDocS(theArg[1]); |
438 | if (!DDocStd::GetDocument(aDocS, aDoc)) return 1; |
439 | TDF_Label objLabel; |
440 | if (!DDF::FindLabel(aDoc->GetData(),theArg[2], objLabel)) return 1; |
441 | |
442 | Handle(TDataStd_UAttribute) anObj; |
443 | if(!objLabel.FindAttribute(GEOMOBJECT_GUID, anObj)) return 1; |
444 | Standard_GUID funGUID; |
445 | if(!GetFuncGUID("Box",funGUID)) return 1; |
446 | |
447 | Handle(TFunction_Function) aFun = GetFunction(objLabel,funGUID); |
448 | if(!aFun.IsNull()) { |
91322f44 |
449 | Standard_Real value = Draw::Atof(theArg[3]); |
7fd59977 |
450 | DNaming::GetReal(aFun,BOX_DZ)->Set(value); |
451 | DDF::ReturnLabel(theDI, DNaming::GetReal(aFun,BOX_DZ)->Label()); |
452 | return 0; |
453 | } |
454 | } |
d99f0355 |
455 | Message::SendFail() << "DNaming_BoxDZ : Error"; |
7fd59977 |
456 | return 1; |
457 | } |
458 | |
7fd59977 |
459 | //======================================================================= |
460 | //function : Compute |
461 | //purpose : Performs the calling to a driver with the given Function ID. |
462 | //======================================================================= |
463 | static Standard_Integer ComputeFunction(const Handle(TFunction_Function)& theFun, |
f486f64d |
464 | Handle(TFunction_Logbook)& theLog) |
7fd59977 |
465 | { |
466 | Handle(TFunction_DriverTable) aTable = TFunction_DriverTable::Get(); |
467 | Handle(TFunction_Driver) aDriver; |
468 | Standard_Integer aRes(-1); |
469 | if (aTable->FindDriver(theFun->GetDriverGUID(),aDriver)) |
470 | { |
471 | aDriver->Init(theFun->Label()); |
472 | aRes = aDriver->Execute(theLog); |
473 | } |
474 | else |
475 | aRes = 1; |
476 | return aRes; |
477 | } |
478 | |
479 | |
480 | //======================================================================= |
481 | //function : DNaming_SolveFlatFrom |
482 | //purpose : Performs sequential recomputation of all Aux Object starting from the specified. |
483 | // : "SolveFlatFrom Doc FistAuxObjLabel" |
484 | //======================================================================= |
485 | |
35e08fe8 |
486 | static Standard_Integer DNaming_SolveFlatFrom (Draw_Interpretor& /*theDI*/, |
7fd59977 |
487 | Standard_Integer theNb, |
488 | const char** theArg) |
489 | { |
490 | if (theNb == 3) { |
491 | Handle(TDocStd_Document) aDoc; |
492 | Standard_CString aDocS(theArg[1]); |
493 | if (!DDocStd::GetDocument(aDocS, aDoc)) return 1; |
494 | TDF_Label ObjLabel; |
495 | if (!DDF::FindLabel(aDoc->GetData(),theArg[2], ObjLabel)) return 1; |
496 | const TDF_Label& FatherLab = ObjLabel.Father(); |
497 | if(FatherLab.IsNull()) |
498 | goto ERR; |
499 | TCollection_AsciiString entry; |
500 | TDF_Tool::Entry(FatherLab, entry); |
0797d9d3 |
501 | #ifdef OCCT_DEBUG |
04232180 |
502 | std::cout << "DNaming_SolveFlatFrom: Father label = " << entry << std::endl; |
7fd59977 |
503 | #endif |
f486f64d |
504 | Handle(TFunction_Logbook) logbook = TFunction_Logbook::Set(FatherLab); |
7fd59977 |
505 | Standard_Boolean found(Standard_False); |
506 | TDF_ChildIterator it(FatherLab, Standard_False); |
507 | for(;it.More(); it.Next()) { |
508 | const TDF_Label& aLabel = it.Value(); |
509 | if(!found) { |
510 | if(aLabel == ObjLabel) { |
511 | found = Standard_True; |
512 | } else |
513 | continue; |
514 | } |
515 | const TDF_Label& funLabel = aLabel.FindChild(FUNCTION_ARGUMENTS_LABEL, Standard_True); |
516 | Handle(TFunction_Function) aFun; |
517 | funLabel.FindAttribute(TFunction_Function::GetID(), aFun); |
518 | if(aFun.IsNull()) { |
04232180 |
519 | std::cout << "DNaming_SolveFlatFrom:: Null function is found!" << std::endl; |
7fd59977 |
520 | continue; |
521 | } |
522 | else { |
523 | TDF_Tool::Entry(funLabel, entry); |
524 | try { |
f486f64d |
525 | // We clear the logbook because the execution starts not from the begining of the function list (some functions ar skipped). |
526 | logbook->Clear(); |
527 | Standard_Integer aRes = ComputeFunction(aFun, logbook); |
7fd59977 |
528 | if(aRes != 0) { |
d99f0355 |
529 | Message::SendFail() << "DNaming_SolveFlatFrom: Driver failed at label = " << entry; |
7fd59977 |
530 | return 1; |
531 | } |
0797d9d3 |
532 | #ifdef OCCT_DEBUG |
04232180 |
533 | std::cout <<"DNaming_SolveFlatFrom : function from label " << entry << " is recomputed" << std::endl; |
7fd59977 |
534 | #endif |
535 | } catch (EXCEPTION) { |
04232180 |
536 | std::cout <<"DNaming_SolveFlatFrom : Exception computing function at label " << entry << std::endl; |
7fd59977 |
537 | } |
538 | } |
539 | } |
540 | return 0; |
541 | } |
542 | ERR: |
d99f0355 |
543 | Message::SendFail() << "DNaming_SolveFlatFrom : Error"; |
7fd59977 |
544 | return 1; |
545 | } |
546 | |
547 | //======================================================================= |
548 | //function : DNaming_InitLogBook |
549 | //purpose : "InitLogBook Doc " |
550 | //======================================================================= |
35e08fe8 |
551 | static Standard_Integer DNaming_InitLogBook (Draw_Interpretor& /*theDI*/, |
7fd59977 |
552 | Standard_Integer theNb, |
553 | const char** theArg) |
554 | { |
555 | if (theNb == 2) { |
556 | Handle(TDocStd_Document) aDoc; |
557 | Standard_CString aDocS(theArg[1]); |
558 | if (!DDocStd::GetDocument(aDocS, aDoc)) return 1; |
f486f64d |
559 | Handle(TFunction_Logbook) logbook = TFunction_Logbook::Set(aDoc->Main()); |
560 | if(logbook->IsEmpty()) { |
0797d9d3 |
561 | #ifdef OCCT_DEBUG |
04232180 |
562 | std::cout << "DNaming_InitLogBook : is empty" <<std::endl; |
7fd59977 |
563 | #endif |
564 | } |
565 | else { |
f486f64d |
566 | logbook->Clear(); |
0797d9d3 |
567 | #ifdef OCCT_DEBUG |
04232180 |
568 | std::cout << "DNaming_InitLogBook : cleaned" <<std::endl; |
7fd59977 |
569 | #endif |
570 | } |
571 | return 0; |
572 | } |
d99f0355 |
573 | Message::SendFail() << "DNaming_InitLogBook : Error - No document ==> " << theNb; |
7fd59977 |
574 | return 1; |
575 | } |
576 | |
577 | //======================================================================= |
578 | //function : DNaming_CheckLogBook |
579 | //purpose : "CheckLogBook Doc" |
580 | //======================================================================= |
35e08fe8 |
581 | static Standard_Integer DNaming_CheckLogBook (Draw_Interpretor& /*theDI*/, |
7fd59977 |
582 | Standard_Integer theNb, |
583 | const char** theArg) |
584 | { |
585 | if (theNb == 2) { |
586 | Handle(TDocStd_Document) aDoc; |
587 | Standard_CString aDocS(theArg[1]); |
f486f64d |
588 | if (!DDocStd::GetDocument(aDocS, aDoc)) return 1; |
589 | Handle(TFunction_Logbook) logbook = TFunction_Logbook::Set(aDoc->Main()); |
590 | if(logbook->IsEmpty()) |
04232180 |
591 | std::cout << "DNaming_CheckLogBook : is empty" <<std::endl; |
7fd59977 |
592 | else { |
f486f64d |
593 | const TDF_LabelMap& aMap = logbook->GetValid(); |
7fd59977 |
594 | TDF_MapIteratorOfLabelMap it(aMap); |
595 | TCollection_AsciiString entry; |
04232180 |
596 | std::cout << "DNaming_CheckLogBook : LogBook current state:" <<std::endl; |
7fd59977 |
597 | for (;it.More();it.Next()) { |
598 | TDF_Tool::Entry(it.Key(), entry); |
04232180 |
599 | std::cout << entry <<std::endl; |
7fd59977 |
600 | } |
601 | } |
602 | return 0; |
603 | } |
d99f0355 |
604 | Message::SendFail() << "DNaming_CheckLogBook : Error - No document ==> " << theNb; |
7fd59977 |
605 | return 1; |
606 | } |
607 | |
608 | //======================================================================= |
609 | //function : DNaming_ComputeFun |
610 | //purpose : "ComputeFun Doc FunctionLabel" |
611 | //======================================================================= |
35e08fe8 |
612 | static Standard_Integer DNaming_ComputeFun (Draw_Interpretor& /*theDI*/, |
7fd59977 |
613 | Standard_Integer theNb, |
614 | const char** theArg) |
615 | { |
616 | if (theNb == 3) { |
617 | Handle(TDocStd_Document) aDoc; |
618 | Standard_CString aDocS(theArg[1]); |
619 | if (!DDocStd::GetDocument(aDocS, aDoc)) return 1; |
620 | TDF_Label funLabel; |
621 | if (!DDF::FindLabel(aDoc->GetData(),theArg[2], funLabel)) return 1; |
622 | |
623 | Handle(TFunction_Function) aFun; |
624 | funLabel.FindAttribute(TFunction_Function::GetID(), aFun); |
625 | if(aFun.IsNull()) return 1; |
626 | if(!aFun.IsNull()) { |
f486f64d |
627 | Handle(TFunction_Logbook) logbook = TFunction_Logbook::Set(funLabel); |
628 | Standard_Integer aRes = ComputeFunction(aFun, logbook); |
d99f0355 |
629 | if(aRes != 0) |
630 | { |
631 | Message::SendFail() << "DNaming_ComputeFun : No Driver or Driver failed"; |
632 | return 1; |
633 | } |
0797d9d3 |
634 | #ifdef OCCT_DEBUG |
04232180 |
635 | std::cout <<"DNaming_ComputeFun : function from label " << theArg[2] << " is recomputed" << std::endl; |
7fd59977 |
636 | #endif |
637 | return 0; |
638 | } |
639 | } |
d99f0355 |
640 | Message::SendFail() << "DNaming_ComputeFun : Error"; |
7fd59977 |
641 | return 1; |
642 | } |
643 | |
644 | //======================================================================= |
645 | //function : DNaming_AttachShape |
646 | //purpose : "AttachShape Doc Shape Context [Container [KeepOrientation [Geometry]]]" |
647 | //======================================================================= |
648 | static Standard_Integer DNaming_AttachShape (Draw_Interpretor& di, |
649 | Standard_Integer nb, |
650 | const char** a) |
651 | { |
652 | if (nb >= 4) { |
653 | Handle(TDocStd_Document) aDoc; |
654 | Standard_CString aDocS(a[1]); |
655 | if (!DDocStd::GetDocument(aDocS, aDoc)) return 1; |
656 | Standard_CString aSS(a[2]); |
657 | const TopoDS_Shape& aShape = DBRep::Get(aSS); //shape to be attached |
658 | if(aShape.IsNull()) return 1; |
659 | |
660 | Handle(TDataStd_UAttribute) aContainer, aContext; |
661 | if (!DDocStd::Find(aDoc, a[3], GEOMOBJECT_GUID, aContext)) return 1; |
662 | if(nb > 4) |
663 | DDocStd::Find(aDoc, a[4], GEOMOBJECT_GUID, aContainer); |
664 | |
665 | if(aContainer.IsNull()) aContainer = aContext; |
666 | |
667 | Handle(TDataStd_UAttribute) anObj = AddObject (aDoc); |
668 | if(!anObj.IsNull()) { |
669 | Handle(TDataStd_TreeNode) aNode,RNode; |
670 | anObj->Label().FindAttribute(TDataStd_TreeNode::GetDefaultTreeID(), aNode); |
671 | if(aNode.IsNull()) |
672 | aNode = TDataStd_TreeNode::Set(anObj->Label()); |
673 | aNode->Remove(); |
674 | if(aContainer->Label().FindAttribute(TDataStd_TreeNode::GetDefaultTreeID(), RNode)) |
675 | RNode->Append(aNode); |
676 | TDataStd_Name::Set(anObj->Label(), "Auxiliary_Object"); |
677 | Standard_GUID funGUID; |
678 | if(GetFuncGUID("Attach",funGUID)) { |
679 | Handle(TFunction_Function) aFun = SetFunctionDS(anObj->Label(), funGUID); |
680 | if(!aFun.IsNull()) { |
681 | TDataStd_Name::Set(aFun->Label(), "ISelection"); |
682 | TDF_Label aResultLabel = aFun->Label().FindChild(FUNCTION_RESULT_LABEL, Standard_True); |
683 | TDF_Reference::Set(anObj->Label(), aResultLabel ); //result of the object |
684 | aResultLabel.ForgetAllAttributes(Standard_True); |
685 | Standard_Boolean aKeepOrientation(Standard_False); |
686 | if (nb >= 6) |
dde68833 |
687 | aKeepOrientation = Draw::Atoi(a[5]) != 0; |
7fd59977 |
688 | Standard_Boolean aGeometry(Standard_False); |
689 | if (nb == 7) |
dde68833 |
690 | aGeometry = Draw::Atoi(a[6]) != 0; |
7fd59977 |
691 | Handle(TNaming_NamedShape) aCont = DNaming::GetObjectValue(aContext); |
0797d9d3 |
692 | #ifdef OCCT_DEBUG |
7fd59977 |
693 | if(aCont.IsNull() || aCont->IsEmpty()) |
04232180 |
694 | std::cout <<"Wrong Context ..." <<std::endl; |
7fd59977 |
695 | #endif |
696 | try{ |
697 | TopoDS_Shape aCONTEXT = aCont->Get(); |
698 | TNaming_Selector aSelector(aResultLabel); |
699 | if(!aSelector.Select(aShape, aCONTEXT, aGeometry, aKeepOrientation)) |
700 | return 1; |
b350f6ee |
701 | } |
a738b534 |
702 | catch (Standard_Failure const&) { |
04232180 |
703 | std::cout << "EXCEPTION: SELECTION_IMPOSSIBLE" <<std::endl; |
7fd59977 |
704 | } |
705 | |
706 | if(!aCont.IsNull()) { |
0797d9d3 |
707 | #ifdef OCCT_DEBUG |
7fd59977 |
708 | TCollection_AsciiString entry; |
709 | TDF_Tool::Entry(aCont->Label(), entry); |
04232180 |
710 | std::cout << "ContextNS Label = " << entry <<std::endl; |
7fd59977 |
711 | #endif |
712 | Handle(TFunction_Function) aCntFun; |
713 | if(aCont->Label().Father().FindAttribute(TFunction_Function::GetID(), aCntFun)) { //Fun:2 ==> result |
714 | // First argument of Selection function refers to father function (of context object) |
715 | // to which selection is attached (because sel obj. itself already has refrence to result NS |
716 | TDF_Reference::Set(aFun->Label().FindChild(FUNCTION_ARGUMENTS_LABEL).FindChild(ATTACH_ARG), |
717 | aCntFun->Label()); //ref to function produced Context shape |
718 | |
719 | } |
720 | } |
721 | |
722 | DDF::ReturnLabel(di, anObj->Label()); |
723 | return 0; |
724 | } |
725 | } |
726 | } //### |
727 | } |
d99f0355 |
728 | Message::SendFail() << "DNaming_AttachShape : Error"; |
7fd59977 |
729 | return 1; |
730 | } |
731 | |
732 | //======================================================================= |
733 | //function : DNaming_XAttachShape |
734 | //purpose : "AttachShape Doc Shape Context [KeepOrientation [Geometry]]" |
735 | //======================================================================= |
736 | static Standard_Integer DNaming_XAttachShape (Draw_Interpretor& di, |
737 | Standard_Integer nb, |
738 | const char** a) |
739 | { |
740 | if (nb >= 4) { |
741 | Handle(TDocStd_Document) aDoc; |
742 | Standard_CString aDocS(a[1]); |
743 | if (!DDocStd::GetDocument(aDocS, aDoc)) return 1; |
744 | Standard_CString aSS(a[2]); |
745 | const TopoDS_Shape& aShape = DBRep::Get(aSS); |
746 | if(aShape.IsNull()) return 1; |
747 | |
748 | Handle(TDataStd_UAttribute) aContext; |
749 | if (!DDocStd::Find(aDoc, a[3], GEOMOBJECT_GUID, aContext)) return 1; |
750 | |
751 | Handle(TDataStd_UAttribute) anObj = AddObject (aDoc); |
752 | if(!anObj.IsNull()) { |
753 | TDataStd_Name::Set(anObj->Label(), "Auxiliary_Object"); |
754 | Standard_GUID funGUID; |
755 | if(GetFuncGUID("XAttach",funGUID)) { |
756 | Handle(TFunction_Function) aFun = SetFunctionDS(anObj->Label(), funGUID); |
757 | if(!aFun.IsNull()) { |
758 | TDataStd_Name::Set(aFun->Label(), "XSelection"); |
759 | TDF_Label aResultLabel = aFun->Label().FindChild(FUNCTION_RESULT_LABEL, Standard_True); |
760 | TDF_Reference::Set(anObj->Label(), aResultLabel ); //result |
761 | aResultLabel.ForgetAllAttributes(Standard_True); |
762 | Standard_Boolean aKeepOrientation(Standard_False); |
763 | if (nb >= 5) |
dde68833 |
764 | aKeepOrientation = Draw::Atoi(a[4]) != 0; |
7fd59977 |
765 | Standard_Boolean aGeometry(Standard_False); |
766 | if (nb == 6) |
dde68833 |
767 | aGeometry = Draw::Atoi(a[5]) != 0; |
7fd59977 |
768 | Handle(TNaming_NamedShape) aCont = DNaming::GetObjectValue(aContext); |
769 | |
770 | if(aCont.IsNull() || aCont->IsEmpty()) |
04232180 |
771 | std::cout <<"Wrong Context ..." <<std::endl; |
7fd59977 |
772 | else { |
773 | TopoDS_Shape aCONTEXT = aCont->Get(); |
774 | try{ |
775 | TNaming_Selector aSelector(aResultLabel); |
776 | if(!aSelector.Select(aShape, aCONTEXT, aGeometry, aKeepOrientation)) |
777 | return 1; |
b350f6ee |
778 | } |
a738b534 |
779 | catch (Standard_Failure const&) { |
04232180 |
780 | std::cout << "EXCEPTION: SELECTION_IMPOSSIBLE" <<std::endl; |
7fd59977 |
781 | } |
782 | |
783 | TDF_Reference::Set(aFun->Label().FindChild(FUNCTION_ARGUMENTS_LABEL).FindChild(ATTACH_ARG), |
784 | aContext->Label()); //ref to Context object |
785 | |
786 | DDF::ReturnLabel(di, anObj->Label()); |
787 | return 0; |
788 | } |
789 | } |
790 | } |
791 | } |
792 | } |
d99f0355 |
793 | Message::SendFail() << "DNaming_XAttachShape : Error"; |
7fd59977 |
794 | return 1; |
795 | } |
796 | |
797 | //======================================================================= |
798 | //function : DNaming_AddCyl |
799 | //purpose : "AddCyl Doc Radius Height Axis |
800 | //======================================================================= |
801 | static Standard_Integer DNaming_AddCylinder (Draw_Interpretor& theDI, |
802 | Standard_Integer theNb, |
803 | const char** theArg) |
804 | { |
805 | if (theNb == 5) { |
806 | |
807 | Handle(TDocStd_Document) aDocument; |
808 | Standard_CString aDocS(theArg[1]); |
809 | if (!DDocStd::GetDocument(aDocS, aDocument)) return 1; |
810 | Handle(TDataStd_UAttribute) anObj = AddObject(aDocument); |
811 | if(anObj.IsNull()) return 1; |
812 | Standard_GUID funGUID; |
813 | if(!GetFuncGUID("Cyl",funGUID)) return 1; |
814 | |
815 | Handle(TFunction_Function) aFun = SetFunctionDS(anObj->Label(), funGUID); |
816 | if(aFun.IsNull()) return 1; |
817 | TDataStd_Name::Set(aFun->Label(), "Cyl_Function"); |
818 | |
819 | TDF_Reference::Set(anObj->Label(), aFun->Label().FindChild(FUNCTION_RESULT_LABEL)); //result is here |
820 | |
821 | Standard_Real aR, aH; |
91322f44 |
822 | aR = Draw::Atof(theArg[2]); |
823 | aH = Draw::Atof(theArg[3]); |
7fd59977 |
824 | |
825 | Handle(TDataStd_UAttribute) Axis; |
826 | if (!DDocStd::Find(aDocument, theArg[4], GEOMOBJECT_GUID, Axis)) return 1; |
827 | DNaming::GetReal(aFun,CYL_RADIUS)->Set(aR); |
828 | DNaming::GetReal(aFun,CYL_HEIGHT)->Set(aH); |
829 | DNaming::SetObjectArg(aFun, CYL_AXIS, Axis); |
830 | |
831 | DDF::ReturnLabel(theDI, anObj->Label()); |
832 | return 0; |
833 | } |
d99f0355 |
834 | Message::SendFail() << "DNaming_AddCylinder : Error"; |
7fd59977 |
835 | return 1; |
836 | } |
837 | |
838 | //======================================================================= |
839 | //function : DNaming_CylRad |
840 | //purpose : "CylRad Doc CylLabel NewRad" |
841 | //======================================================================= |
842 | |
843 | static Standard_Integer DNaming_CylRad (Draw_Interpretor& theDI, |
844 | Standard_Integer theNb, |
845 | const char** theArg) |
846 | { |
847 | if (theNb == 4) { |
848 | Handle(TDocStd_Document) aDoc; |
849 | Standard_CString aDocS(theArg[1]); |
850 | if (!DDocStd::GetDocument(aDocS, aDoc)) return 1; |
851 | TDF_Label objLabel; |
852 | if (!DDF::FindLabel(aDoc->GetData(),theArg[2], objLabel)) return 1; |
853 | |
854 | Handle(TDataStd_UAttribute) anObj; |
855 | if(!objLabel.FindAttribute(GEOMOBJECT_GUID, anObj)) return 1; |
856 | Standard_GUID funGUID; |
857 | if(!GetFuncGUID("Cyl",funGUID)) return 1; |
858 | |
859 | Handle(TFunction_Function) aFun = GetFunction(objLabel,funGUID); |
860 | if(!aFun.IsNull()) { |
91322f44 |
861 | Standard_Real value = Draw::Atof(theArg[3]); |
7fd59977 |
862 | DNaming::GetReal(aFun,CYL_RADIUS)->Set(value); |
863 | DDF::ReturnLabel(theDI, DNaming::GetReal(aFun,CYL_RADIUS)->Label()); |
864 | return 0; |
865 | } |
866 | } |
d99f0355 |
867 | Message::SendFail() << "DNaming_CylRadius : Error"; |
7fd59977 |
868 | return 1; |
869 | } |
870 | |
871 | //======================================================================= |
872 | //function : DNaming_AddFuse |
873 | //purpose : "AddFuse Doc Object Tool" |
874 | //======================================================================= |
875 | |
876 | static Standard_Integer DNaming_AddFuse (Draw_Interpretor& theDI, |
877 | Standard_Integer theNb, |
878 | const char** theArg) |
879 | { |
880 | if (theNb == 4) { |
881 | |
882 | Handle(TDocStd_Document) aDocument; |
883 | Standard_CString aDocS(theArg[1]); |
884 | if (!DDocStd::GetDocument(aDocS, aDocument)) return 1; |
885 | |
886 | Handle(TDataStd_UAttribute) anObject, aTool; |
887 | if (!DDocStd::Find(aDocument, theArg[2], GEOMOBJECT_GUID, anObject)) return 1; |
888 | if (!DDocStd::Find(aDocument, theArg[3], GEOMOBJECT_GUID, aTool)) return 1; |
889 | Standard_GUID funGUID; |
890 | if(!GetFuncGUID("Fuse",funGUID)) return 1; |
891 | Handle(TFunction_Function) aFun = SetFunctionDS(anObject->Label(), funGUID); |
892 | if(aFun.IsNull()) return 1; |
893 | TDataStd_Name::Set(aFun->Label(), "Fuse"); |
894 | |
895 | TDF_Reference::Set(anObject->Label(), aFun->Label().FindChild(FUNCTION_RESULT_LABEL)); //result is here |
896 | DNaming::SetObjectArg(aFun, BOOL_TOOL, aTool); |
897 | DDF::ReturnLabel(theDI, aFun->Label()); |
898 | return 0; |
899 | } |
d99f0355 |
900 | Message::SendFail() << "DModel_AddFuse : Error"; |
7fd59977 |
901 | return 1; |
902 | } |
903 | |
904 | |
905 | //======================================================================= |
906 | //function : DNaming_AddCut |
907 | //purpose : "AddCut Doc Object Tool" |
908 | //======================================================================= |
909 | |
910 | static Standard_Integer DNaming_AddCut (Draw_Interpretor& theDI, |
911 | Standard_Integer theNb, |
912 | const char** theArg) |
913 | { |
914 | if (theNb == 4) { |
915 | |
916 | Handle(TDocStd_Document) aDocument; |
917 | Standard_CString aDocS(theArg[1]); |
918 | if (!DDocStd::GetDocument(aDocS, aDocument)) return 1; |
919 | |
920 | Handle(TDataStd_UAttribute) anObject, aTool; |
921 | if (!DDocStd::Find(aDocument, theArg[2], GEOMOBJECT_GUID, anObject)) return 1; |
922 | if (!DDocStd::Find(aDocument, theArg[3], GEOMOBJECT_GUID, aTool)) return 1; |
923 | Standard_GUID funGUID; |
924 | if(!GetFuncGUID("Cut",funGUID)) return 1; |
925 | Handle(TFunction_Function) aFun = SetFunctionDS(anObject->Label(), funGUID); |
926 | if(aFun.IsNull()) return 1; |
927 | TDataStd_Name::Set(aFun->Label(), "Cut"); |
928 | |
929 | TDF_Reference::Set(anObject->Label(), aFun->Label().FindChild(FUNCTION_RESULT_LABEL)); //result is here |
930 | DNaming::SetObjectArg(aFun, BOOL_TOOL, aTool); |
931 | DDF::ReturnLabel(theDI, aFun->Label()); |
932 | return 0; |
933 | } |
d99f0355 |
934 | Message::SendFail() << "DModel_AddCut : Error"; |
7fd59977 |
935 | return 1; |
936 | } |
937 | |
938 | //======================================================================= |
939 | //function : DNaming_AddCommon |
940 | //purpose : "AddCommon Doc Object Tool" |
941 | //======================================================================= |
942 | |
943 | static Standard_Integer DNaming_AddCommon (Draw_Interpretor& theDI, |
944 | Standard_Integer theNb, |
945 | const char** theArg) |
946 | { |
947 | if (theNb == 4) { |
948 | |
949 | Handle(TDocStd_Document) aDocument; |
950 | Standard_CString aDocS(theArg[1]); |
951 | if (!DDocStd::GetDocument(aDocS, aDocument)) return 1; |
952 | |
953 | Handle(TDataStd_UAttribute) anObject, aTool; |
954 | if (!DDocStd::Find(aDocument, theArg[2], GEOMOBJECT_GUID, anObject)) return 1; |
955 | if (!DDocStd::Find(aDocument, theArg[3], GEOMOBJECT_GUID, aTool)) return 1; |
956 | Standard_GUID funGUID; |
957 | if(!GetFuncGUID("Comm",funGUID)) return 1; |
958 | Handle(TFunction_Function) aFun = SetFunctionDS(anObject->Label(), funGUID); |
959 | if(aFun.IsNull()) return 1; |
960 | TDataStd_Name::Set(aFun->Label(), "Common"); |
961 | |
962 | TDF_Reference::Set(anObject->Label(), aFun->Label().FindChild(FUNCTION_RESULT_LABEL)); //result is here |
963 | DNaming::SetObjectArg(aFun, BOOL_TOOL, aTool); |
964 | DDF::ReturnLabel(theDI, aFun->Label()); |
965 | return 0; |
966 | } |
d99f0355 |
967 | Message::SendFail() << "DModel_AddComm : Error"; |
7fd59977 |
968 | return 1; |
969 | } |
970 | |
372ceec4 |
971 | //======================================================================= |
972 | //function : DNaming_AddSection |
973 | //purpose : "AddSection Doc Object Tool" |
974 | //======================================================================= |
975 | |
976 | static Standard_Integer DNaming_AddSection (Draw_Interpretor& theDI, |
977 | Standard_Integer theNb, const char** theArg) |
978 | { |
979 | if (theNb == 4) { |
980 | |
981 | Handle(TDocStd_Document) aDocument; |
982 | Standard_CString aDocS(theArg[1]); |
983 | if (!DDocStd::GetDocument(aDocS, aDocument)) return 1; |
984 | |
985 | Handle(TDataStd_UAttribute) anObject, aTool; |
986 | if (!DDocStd::Find(aDocument, theArg[2], GEOMOBJECT_GUID, anObject)) return 1; |
987 | if (!DDocStd::Find(aDocument, theArg[3], GEOMOBJECT_GUID, aTool)) return 1; |
988 | Standard_GUID funGUID; |
989 | if(!GetFuncGUID("Section",funGUID)) return 1; |
990 | Handle(TFunction_Function) aFun = SetFunctionDS(anObject->Label(), funGUID); |
991 | if(aFun.IsNull()) return 1; |
992 | TDataStd_Name::Set(aFun->Label(), "Section"); |
993 | |
994 | TDF_Reference::Set(anObject->Label(), aFun->Label().FindChild(FUNCTION_RESULT_LABEL)); //result is here |
995 | DNaming::SetObjectArg(aFun, BOOL_TOOL, aTool); |
996 | DDF::ReturnLabel(theDI, aFun->Label()); |
997 | return 0; |
998 | } |
d99f0355 |
999 | Message::SendFail() << "DModel_AddSection : Error"; |
372ceec4 |
1000 | return 1; |
1001 | } |
1002 | |
7fd59977 |
1003 | //======================================================================= |
1004 | //function : DNaming_AddFillet |
1005 | //purpose : "AddFillet Doc Object Radius Path " |
1006 | //======================================================================= |
1007 | static Standard_Integer DNaming_AddFillet (Draw_Interpretor& theDI, |
1008 | Standard_Integer theNb, |
1009 | const char** theArg) |
1010 | { |
1011 | if (theNb < 5) { |
d99f0355 |
1012 | Message::SendFail() << "DNaming_AddFillet(): Wrong number of arguments"; |
7fd59977 |
1013 | return 1; |
1014 | } |
1015 | |
1016 | Handle(TDocStd_Document) aDocument; |
1017 | Standard_CString aDocS(theArg[1]); |
1018 | if (!DDocStd::GetDocument(aDocS, aDocument)) return 1; |
1019 | |
1020 | Handle(TDataStd_UAttribute) anObject; |
1021 | if (!DDocStd::Find(aDocument, theArg[2], GEOMOBJECT_GUID, anObject)) return 1; |
1022 | Standard_GUID funGUID; |
1023 | if(!GetFuncGUID("Fillet",funGUID)) return 1; |
1024 | Handle(TFunction_Function) aFun = SetFunctionDS(anObject->Label(), funGUID); |
1025 | if(aFun.IsNull()) return 1; |
1026 | TDataStd_Name::Set(aFun->Label(), "Fillet"); |
1027 | |
1028 | TDF_Reference::Set(anObject->Label(), aFun->Label().FindChild(FUNCTION_RESULT_LABEL)); //result is here |
1029 | |
91322f44 |
1030 | Standard_Real aRadius = Draw::Atof(theArg[3]); |
7fd59977 |
1031 | DNaming::GetReal(aFun,FILLET_RADIUS)->Set(aRadius); |
1032 | |
1033 | Handle(TDataStd_UAttribute) aPath; |
1034 | if (!DDocStd::Find(aDocument, theArg[4], GEOMOBJECT_GUID, aPath)) return 1; |
1035 | DNaming::SetObjectArg(aFun, FILLET_PATH, aPath); |
1036 | DDF::ReturnLabel(theDI, aFun->Label()); |
1037 | return 0; |
1038 | } |
1039 | |
1040 | //======================================================================= |
1041 | //function : DNaming_TranslatePar |
1042 | //purpose : "TranslatePar Doc ShapeEntry dx dy dz" |
1043 | //======================================================================= |
1044 | static Standard_Integer DNaming_PTranslateDXYZ (Draw_Interpretor& di, |
1045 | Standard_Integer nb, |
1046 | const char** a) |
1047 | { |
1048 | if (nb > 3) { |
0797d9d3 |
1049 | #ifdef OCCT_DEBUG |
04232180 |
1050 | std::cout << "NB = " << nb <<std::endl; |
7fd59977 |
1051 | #endif |
1052 | Handle(TDocStd_Document) aDocument; |
1053 | Standard_CString aDocS(a[1]); |
1054 | if (!DDocStd::GetDocument(aDocS, aDocument)) return 1; |
1055 | |
1056 | Handle(TDataStd_UAttribute) anObject;// aShape; |
1057 | if (!DDocStd::Find(aDocument, a[2], GEOMOBJECT_GUID, anObject)) return 1; |
1058 | |
1059 | Standard_GUID funGUID; |
1060 | if(!GetFuncGUID("PTxyz",funGUID)) return 1; |
1061 | Handle(TFunction_Function) aFun = SetFunctionDS(anObject->Label(), funGUID); |
1062 | if(aFun.IsNull()) return 1; |
1063 | TDataStd_Name::Set(aFun->Label(), "ParTranslation"); |
1064 | |
1065 | Standard_Real aDx=0., aDy=0., aDz=0.; |
91322f44 |
1066 | aDx = Draw::Atof(a[3]); |
04232180 |
1067 | //std::cout << "DX = " << aDx<<std::endl; |
7fd59977 |
1068 | if(nb > 4) { |
91322f44 |
1069 | aDy = Draw::Atof(a[4]); |
04232180 |
1070 | //std::cout << "DY = " << aDy<<std::endl; |
7fd59977 |
1071 | if(nb > 5) { |
91322f44 |
1072 | aDz = Draw::Atof(a[5]); |
04232180 |
1073 | //std::cout << "DZ = " << aDz<<std::endl; |
7fd59977 |
1074 | } |
1075 | } |
1076 | |
1077 | DNaming::GetReal(aFun,PTRANSF_DX)->Set(aDx); |
1078 | DNaming::GetReal(aFun,PTRANSF_DY)->Set(aDy); |
1079 | DNaming::GetReal(aFun,PTRANSF_DZ)->Set(aDz); |
1080 | TDF_Reference::Set(anObject->Label(), aFun->Label().FindChild(FUNCTION_RESULT_LABEL)); |
1081 | DDF::ReturnLabel(di, aFun->Label()); |
1082 | return 0; |
1083 | } |
d99f0355 |
1084 | Message::SendFail() << "DNaming_Translate : Error"; |
7fd59977 |
1085 | return 1; |
1086 | } |
1087 | //======================================================================= |
1088 | //function : DNaming_PTranslateLine |
1089 | //purpose : "PTranslateAlongLine Doc ShapeEntry Line off" |
1090 | //======================================================================= |
1091 | static Standard_Integer DNaming_PTranslateLine (Draw_Interpretor& di, |
1092 | Standard_Integer nb, |
1093 | const char** a) |
1094 | { |
1095 | if (nb > 4) { |
0797d9d3 |
1096 | #ifdef OCCT_DEBUG |
04232180 |
1097 | std::cout << "NB = " << nb <<std::endl; |
7fd59977 |
1098 | #endif |
1099 | Handle(TDocStd_Document) aDocument; |
1100 | Standard_CString aDocS(a[1]); |
1101 | if (!DDocStd::GetDocument(aDocS, aDocument)) return 1; |
1102 | |
1103 | Handle(TDataStd_UAttribute) anObject, aLine;// aShape, aLine; |
1104 | if (!DDocStd::Find(aDocument, a[2], GEOMOBJECT_GUID, anObject)) return 1; |
1105 | if (!DDocStd::Find(aDocument, a[3], GEOMOBJECT_GUID, aLine)) return 1; |
1106 | |
1107 | Standard_GUID funGUID; |
1108 | if(!GetFuncGUID("PTALine",funGUID)) return 1; |
1109 | Handle(TFunction_Function) aFun = SetFunctionDS(anObject->Label(), funGUID); |
1110 | if(aFun.IsNull()) return 1; |
1111 | TDataStd_Name::Set(aFun->Label(), "ParTranslationAlongLine"); |
1112 | |
1113 | Standard_Real anOff = 0.; |
91322f44 |
1114 | anOff = Draw::Atof(a[4]); |
7fd59977 |
1115 | DNaming::GetReal(aFun,PTRANSF_OFF)->Set(anOff); |
1116 | |
1117 | DNaming::SetObjectArg(aFun, PTRANSF_LINE, aLine); |
1118 | TDF_Reference::Set(anObject->Label(), aFun->Label().FindChild(FUNCTION_RESULT_LABEL)); |
1119 | |
1120 | DDF::ReturnLabel(di, aFun->Label()); |
1121 | return 0; |
1122 | } |
d99f0355 |
1123 | Message::SendFail() << "DNaming_PTranslateAlongLine : Error"; |
7fd59977 |
1124 | return 1; |
1125 | } |
1126 | |
1127 | //======================================================================= |
1128 | //function : DNaming_PRotateLine |
1129 | //purpose : "PRotateRoundLine Doc ShapeEntry Line Angle" |
1130 | //======================================================================= |
1131 | static Standard_Integer DNaming_PRotateLine(Draw_Interpretor& di, |
1132 | Standard_Integer nb, |
1133 | const char** a) |
1134 | { |
1135 | if (nb > 4) { |
1136 | Handle(TDocStd_Document) aDocument; |
1137 | Standard_CString aDocS(a[1]); |
1138 | if (!DDocStd::GetDocument(aDocS, aDocument)) return 1; |
1139 | |
1140 | Handle(TDataStd_UAttribute) anObject, aLine;// aShape, aLine; |
1141 | if (!DDocStd::Find(aDocument, a[2], GEOMOBJECT_GUID, anObject)) return 1; |
1142 | if (!DDocStd::Find(aDocument, a[3], GEOMOBJECT_GUID, aLine)) return 1; |
1143 | |
1144 | Standard_GUID funGUID; |
1145 | if(!GetFuncGUID("PRLine",funGUID)) return 1; |
1146 | Handle(TFunction_Function) aFun = SetFunctionDS(anObject->Label(), funGUID); |
1147 | if(aFun.IsNull()) return 1; |
1148 | TDataStd_Name::Set(aFun->Label(), "ParRotationAroundLine"); |
1149 | |
1150 | DNaming::SetObjectArg(aFun, PTRANSF_LINE, aLine); |
1151 | TDF_Reference::Set(anObject->Label(), aFun->Label().FindChild(FUNCTION_RESULT_LABEL)); |
1152 | |
1153 | Standard_Real anAngle = 0.; |
91322f44 |
1154 | anAngle = Draw::Atof(a[4]); |
c6541a0c |
1155 | Standard_Real aK = 2*M_PI/360; |
7fd59977 |
1156 | anAngle = anAngle * aK; |
1157 | DNaming::GetReal(aFun,PTRANSF_ANG)->Set(anAngle); |
1158 | |
1159 | DDF::ReturnLabel(di, aFun->Label()); |
1160 | return 0; |
1161 | } |
d99f0355 |
1162 | Message::SendFail() << "DNaming_PRotateRoundLine : Error"; |
7fd59977 |
1163 | return 1; |
1164 | } |
1165 | |
1166 | //======================================================================= |
1167 | //function : DNaming_PMirrorObject |
1168 | //purpose : "PMirror Doc ShapeEntry PlaneObj" |
1169 | //======================================================================= |
1170 | static Standard_Integer DNaming_PMirrorObject(Draw_Interpretor& di, |
1171 | Standard_Integer nb, |
1172 | const char** a) |
1173 | { |
1174 | if (nb > 3) { |
1175 | Handle(TDocStd_Document) aDocument; |
1176 | Standard_CString aDocS(a[1]); |
1177 | if (!DDocStd::GetDocument(aDocS, aDocument)) return 1; |
1178 | |
1179 | Handle(TDataStd_UAttribute) anObject, aPlane; |
1180 | if (!DDocStd::Find(aDocument, a[2], GEOMOBJECT_GUID, anObject)) return 1; |
1181 | if (!DDocStd::Find(aDocument, a[3], GEOMOBJECT_GUID, aPlane)) return 1; |
1182 | |
1183 | Standard_GUID funGUID; |
1184 | if(!GetFuncGUID("PMirr",funGUID)) return 1; |
1185 | Handle(TFunction_Function) aFun = SetFunctionDS(anObject->Label(), funGUID); |
1186 | if(aFun.IsNull()) return 1; |
1187 | TDataStd_Name::Set(aFun->Label(), "ParMirror"); |
1188 | |
1189 | DNaming::SetObjectArg(aFun, PTRANSF_PLANE, aPlane); |
1190 | TDF_Reference::Set(anObject->Label(), aFun->Label().FindChild(FUNCTION_RESULT_LABEL)); |
1191 | |
1192 | DDF::ReturnLabel(di, aFun->Label()); |
1193 | return 0; |
1194 | } |
d99f0355 |
1195 | Message::SendFail() << "DNaming_PMirrorObject : Error"; |
7fd59977 |
1196 | return 1; |
1197 | } |
1198 | //======================================================================= |
1199 | //function : DModel_AddPrism |
1200 | //purpose : "AddPrism Doc BasisLabel Height Reverse(0/1)" |
1201 | //======================================================================= |
1202 | static Standard_Integer DNaming_AddPrism (Draw_Interpretor& theDI, |
1203 | Standard_Integer theNb, |
1204 | const char** theArg) |
1205 | { |
1206 | if (theNb < 5 ) { |
d99f0355 |
1207 | Message::SendFail() << "DNaming_AddPrism(): Wrong number of arguments"; |
7fd59977 |
1208 | return 1; |
1209 | } |
1210 | // |
1211 | Handle(TDocStd_Document) aDocument; |
1212 | Standard_CString aDocS(theArg[1]); |
1213 | if (!DDocStd::GetDocument(aDocS, aDocument)) return 1; |
1214 | |
1215 | Handle(TDataStd_UAttribute) anObj = AddObject(aDocument); |
1216 | if(anObj.IsNull()) return 1; |
1217 | Standard_GUID funGUID; |
1218 | if(!GetFuncGUID("Prism",funGUID)) return 1; |
1219 | Handle(TFunction_Function) aFun = SetFunctionDS(anObj->Label(), funGUID); |
1220 | if(aFun.IsNull()) return 1; |
1221 | TDataStd_Name::Set(aFun->Label(), "Prism_Function"); |
1222 | TDF_Reference::Set(anObj->Label(), aFun->Label().FindChild(FUNCTION_RESULT_LABEL)); //result is here |
1223 | |
1224 | // arguments |
1225 | Handle(TDataStd_UAttribute) aBasisObj; |
1226 | if (!DDocStd::Find(aDocument, theArg[2], GEOMOBJECT_GUID, aBasisObj)) return 1; |
1227 | DNaming::SetObjectArg(aFun, PRISM_BASIS, aBasisObj); |
91322f44 |
1228 | Standard_Real height = Draw::Atof(theArg[3]); |
7fd59977 |
1229 | DNaming::GetReal(aFun,PRISM_HEIGHT)->Set(height); |
91322f44 |
1230 | Standard_Integer reverse = Draw::Atoi(theArg[4]); |
7fd59977 |
1231 | DNaming::GetInteger(aFun,PRISM_DIR)->Set(reverse); |
1232 | DDF::ReturnLabel(theDI, anObj->Label()); |
1233 | return 0; |
1234 | } |
1235 | |
1236 | //======================================================================= |
1237 | //function : DNaming_PrismHeight |
1238 | //purpose : "PrismHeight Doc PrismLabel NewHeight" |
1239 | //======================================================================= |
1240 | static Standard_Integer DNaming_PrismHeight (Draw_Interpretor& theDI, |
1241 | Standard_Integer theNb, |
1242 | const char** theArg) |
1243 | { |
1244 | if (theNb == 4) { |
1245 | Handle(TDocStd_Document) aDoc; |
1246 | Standard_CString aDocS(theArg[1]); |
1247 | if (!DDocStd::GetDocument(aDocS, aDoc)) return 1; |
1248 | TDF_Label objLabel; |
1249 | if (!DDF::FindLabel(aDoc->GetData(),theArg[2], objLabel)) return 1; |
1250 | |
1251 | Handle(TDataStd_UAttribute) anObj; |
1252 | if(!objLabel.FindAttribute(GEOMOBJECT_GUID, anObj)) return 1; |
1253 | Standard_GUID funGUID; |
1254 | if(!GetFuncGUID("Prism",funGUID)) return 1; |
1255 | |
1256 | Handle(TFunction_Function) aFun = GetFunction(objLabel,funGUID); |
1257 | if(!aFun.IsNull()) { |
91322f44 |
1258 | Standard_Real value = Draw::Atof(theArg[3]); |
7fd59977 |
1259 | DNaming::GetReal(aFun, PRISM_HEIGHT)->Set(value); |
1260 | DDF::ReturnLabel(theDI, DNaming::GetReal(aFun,PRISM_HEIGHT)->Label()); |
1261 | return 0; |
1262 | } |
1263 | |
1264 | } |
d99f0355 |
1265 | Message::SendFail() << "DNaming_PrismHeight : Error"; |
7fd59977 |
1266 | return 1; |
1267 | } |
1268 | |
1269 | |
1270 | //======================================================================= |
1271 | //function : DModel_AddRevol |
1272 | //purpose : "AddRevol Doc BasisLabel AxisLabel [Angle [Reverse(0/1)]] " |
1273 | // : if Angle is presented - sectioned revolution, else - full |
1274 | //======================================================================= |
1275 | static Standard_Integer DNaming_AddRevol (Draw_Interpretor& theDI, |
1276 | Standard_Integer theNb, |
1277 | const char** theArg) |
1278 | { |
1279 | if (theNb < 4 ) { |
d99f0355 |
1280 | Message::SendFail() << "DNaming_AddRevol(): Wrong number of arguments"; |
7fd59977 |
1281 | return 1; |
1282 | } |
1283 | |
1284 | Handle(TDocStd_Document) aDocument; |
1285 | Standard_CString aDocS(theArg[1]); |
1286 | if (!DDocStd::GetDocument(aDocS, aDocument)) return 1; |
1287 | |
1288 | Handle(TDataStd_UAttribute) aBasisObj; |
1289 | if (!DDocStd::Find(aDocument, theArg[2], GEOMOBJECT_GUID, aBasisObj)) return 1; |
1290 | |
1291 | Handle(TDataStd_UAttribute) anAxObj; |
1292 | if (!DDocStd::Find(aDocument, theArg[3], GEOMOBJECT_GUID, anAxObj)) return 1; |
1293 | |
1294 | Standard_Boolean aFull = Standard_True; |
1295 | Handle(TDataStd_UAttribute) anObj = AddObject(aDocument); |
1296 | if(anObj.IsNull()) return 1; |
1297 | if(theNb > 4 ) |
1298 | aFull = Standard_False; |
1299 | Standard_GUID funGUID; |
1300 | if(aFull) { |
1301 | if(!GetFuncGUID("FulRevol",funGUID)) return 1; |
1302 | } |
1303 | else |
1304 | if(!GetFuncGUID("SecRevol",funGUID)) return 1; |
1305 | Handle(TFunction_Function) aFun = SetFunctionDS(anObj->Label(), funGUID); |
1306 | if(aFun.IsNull()) return 1; |
1307 | if(aFull) |
1308 | TDataStd_Name::Set(aFun->Label(), "FulRevol_Function"); |
1309 | else |
1310 | TDataStd_Name::Set(aFun->Label(), "SecRevol_Function"); |
1311 | TDF_Reference::Set(anObj->Label(), aFun->Label().FindChild(FUNCTION_RESULT_LABEL)); //result is here |
1312 | DNaming::SetObjectArg(aFun, REVOL_BASIS, aBasisObj); |
1313 | DNaming::SetObjectArg(aFun, REVOL_AXIS, anAxObj); |
1314 | |
1315 | if(theNb > 4 ) { |
91322f44 |
1316 | Standard_Real angle = Draw::Atof(theArg[4]); |
c6541a0c |
1317 | Standard_Real aK = 2*M_PI/360; |
7fd59977 |
1318 | angle = angle * aK; |
1319 | DNaming::GetReal(aFun,REVOL_ANGLE)->Set(angle); |
1320 | if( theNb == 6) { |
91322f44 |
1321 | Standard_Integer reverse = Draw::Atoi(theArg[5]); |
7fd59977 |
1322 | DNaming::GetInteger(aFun, REVOL_REV)->Set(reverse); |
1323 | } |
1324 | } |
1325 | DDF::ReturnLabel(theDI, anObj->Label()); |
1326 | return 0; |
1327 | } |
1328 | |
1329 | //======================================================================= |
1330 | //function : DNaming_RevolutionAngle |
1331 | //purpose : "RevolutionAngle Doc RevolutionLabel NewAngle" |
1332 | //======================================================================= |
1333 | static Standard_Integer DNaming_RevolutionAngle (Draw_Interpretor& theDI, |
1334 | Standard_Integer theNb, |
1335 | const char** theArg) |
1336 | { |
1337 | if (theNb == 4) { |
1338 | Handle(TDocStd_Document) aDoc; |
1339 | Standard_CString aDocS(theArg[1]); |
1340 | if (!DDocStd::GetDocument(aDocS, aDoc)) return 1; |
1341 | TDF_Label objLabel; |
1342 | if (!DDF::FindLabel(aDoc->GetData(),theArg[2], objLabel)) return 1; |
1343 | |
1344 | Handle(TDataStd_UAttribute) anObj; |
1345 | if(!objLabel.FindAttribute(GEOMOBJECT_GUID, anObj)) return 1; |
1346 | Standard_GUID funGUID; |
1347 | if(!GetFuncGUID("SecRevol",funGUID)) return 1; |
1348 | |
1349 | Handle(TFunction_Function) aFun = GetFunction(objLabel,funGUID); |
1350 | if(!aFun.IsNull()) { |
91322f44 |
1351 | Standard_Real value = Draw::Atof(theArg[3]); |
7fd59977 |
1352 | DNaming::GetReal(aFun, REVOL_ANGLE)->Set(value); |
1353 | DDF::ReturnLabel(theDI, DNaming::GetReal(aFun,REVOL_ANGLE)->Label()); |
1354 | return 0; |
1355 | } |
1356 | } |
d99f0355 |
1357 | Message::SendFail() << "DNaming_RevolutionAngle : Error"; |
7fd59977 |
1358 | return 1; |
1359 | } |
1360 | |
1361 | //======================================================================= |
1362 | //function : DNaming_AddSphere |
1363 | //purpose : "AddSphere Doc CenterLabel Radius " |
1364 | //======================================================================= |
1365 | static Standard_Integer DNaming_AddSphere (Draw_Interpretor& theDI, |
1366 | Standard_Integer theNb, |
1367 | const char** theArg) |
1368 | { |
1369 | if (theNb != 4) { |
d99f0355 |
1370 | Message::SendFail() << "DNaming_AddSphere(): Wrong number of arguments"; |
7fd59977 |
1371 | return 1; |
1372 | } |
1373 | Handle(TDocStd_Document) aDocument; |
1374 | Standard_CString aDocS(theArg[1]); |
1375 | if (!DDocStd::GetDocument(aDocS, aDocument)) return 1; |
1376 | |
1377 | Handle(TDataStd_UAttribute) anObj = AddObject(aDocument); |
1378 | if(anObj.IsNull()) return 1; |
1379 | Standard_GUID funGUID; |
1380 | if(!GetFuncGUID("Sph",funGUID)) return 1; |
1381 | Handle(TFunction_Function) aFun = SetFunctionDS(anObj->Label(), funGUID); |
1382 | if(aFun.IsNull()) return 1; |
1383 | TDataStd_Name::Set(aFun->Label(), "Sphere_Function"); |
1384 | TDF_Reference::Set(anObj->Label(), aFun->Label().FindChild(FUNCTION_RESULT_LABEL)); //result is here |
1385 | |
1386 | Handle(TDataStd_UAttribute) aCenterObj; |
1387 | if (!DDocStd::Find(aDocument, theArg[2], GEOMOBJECT_GUID, aCenterObj)) return 1; |
1388 | DNaming::SetObjectArg(aFun, SPHERE_CENTER, aCenterObj); |
1389 | |
91322f44 |
1390 | Standard_Real aRadius = Draw::Atof(theArg[3]); |
7fd59977 |
1391 | DNaming::GetReal(aFun,SPHERE_RADIUS)->Set(aRadius); |
1392 | |
1393 | DDF::ReturnLabel(theDI, anObj->Label()); |
1394 | return 0; |
1395 | } |
1396 | |
1397 | //======================================================================= |
1398 | //function : DNaming_SphereRadius |
1399 | //purpose : "SphereRadius Doc SphLabel NewRadius" |
1400 | //======================================================================= |
1401 | static Standard_Integer DNaming_SphereRadius (Draw_Interpretor& theDI, |
1402 | Standard_Integer theNb, |
1403 | const char** theArg) |
1404 | { |
1405 | if (theNb == 4) { |
1406 | Handle(TDocStd_Document) aDoc; |
1407 | Standard_CString aDocS(theArg[1]); |
1408 | if (!DDocStd::GetDocument(aDocS, aDoc)) return 1; |
1409 | TDF_Label objLabel; |
1410 | if (!DDF::FindLabel(aDoc->GetData(),theArg[2], objLabel)) return 1; |
1411 | |
1412 | Handle(TDataStd_UAttribute) anObj; |
1413 | if(!objLabel.FindAttribute(GEOMOBJECT_GUID, anObj)) return 1; |
1414 | Standard_GUID funGUID; |
1415 | if(!GetFuncGUID("Sph",funGUID)) return 1; |
1416 | |
1417 | Handle(TFunction_Function) aFun = GetFunction(objLabel,funGUID); |
1418 | if(!aFun.IsNull()) { |
91322f44 |
1419 | Standard_Real value = Draw::Atof(theArg[3]); |
7fd59977 |
1420 | DNaming::GetReal(aFun, SPHERE_RADIUS)->Set(value); |
1421 | DDF::ReturnLabel(theDI, DNaming::GetReal(aFun, SPHERE_RADIUS)->Label()); |
1422 | return 0; |
1423 | } |
1424 | } |
6e6cd5d9 |
1425 | |
d99f0355 |
1426 | Message::SendFail() << "DNaming_SphRadius : Error"; |
7fd59977 |
1427 | return 1; |
1428 | } |
1429 | //======================================================================= |
1430 | //function : DNaming_AddPoint |
1431 | //purpose : "AddPoint Doc x y z" |
1432 | //======================================================================= |
1433 | static Standard_Integer DNaming_AddPoint (Draw_Interpretor& theDI, |
1434 | Standard_Integer theNb, |
1435 | const char** theArg) |
1436 | { |
1437 | if (theNb >= 4) { |
1438 | |
1439 | Handle(TDocStd_Document) aDocument; |
1440 | Standard_CString aDocS(theArg[1]); |
1441 | if (!DDocStd::GetDocument(aDocS, aDocument)) return 1; |
1442 | Handle(TDataStd_UAttribute) anObj = AddObject(aDocument); |
1443 | if(anObj.IsNull()) return 1; |
1444 | Standard_GUID funGUID; |
1445 | if(!GetFuncGUID("PntXYZ",funGUID)) return 1; |
1446 | |
1447 | Handle(TFunction_Function) aFun = SetFunctionDS(anObj->Label(), funGUID); |
1448 | if(aFun.IsNull()) return 1; |
1449 | TDataStd_Name::Set(aFun->Label(), "PntXYZ_Function"); |
1450 | |
1451 | TDF_Reference::Set(anObj->Label(), aFun->Label().FindChild(FUNCTION_RESULT_LABEL)); //result is here |
1452 | Standard_Real x,y,z; |
91322f44 |
1453 | x = Draw::Atof(theArg[2]); |
1454 | y = Draw::Atof(theArg[3]); |
1455 | z = Draw::Atof(theArg[4]); |
7fd59977 |
1456 | |
1457 | DNaming::GetReal(aFun,PNT_DX)->Set(x); |
1458 | DNaming::GetReal(aFun,PNT_DY)->Set(y); |
1459 | DNaming::GetReal(aFun,PNT_DZ)->Set(z); |
1460 | |
1461 | DDF::ReturnLabel(theDI, anObj->Label()); |
1462 | return 0; |
1463 | } |
d99f0355 |
1464 | |
1465 | Message::SendFail() << "DNaming_AddPoint : Error"; |
7fd59977 |
1466 | return 1; |
1467 | } |
1468 | |
1469 | //======================================================================= |
1470 | //function : DNaming_AddPointRlt |
1471 | //purpose : "AddPointRlt Doc RefPnt dx dy dz" |
1472 | //======================================================================= |
1473 | static Standard_Integer DNaming_AddPointRlt (Draw_Interpretor& theDI, |
1474 | Standard_Integer theNb, |
1475 | const char** theArg) |
1476 | { |
1477 | if (theNb >= 5) { |
1478 | |
1479 | Handle(TDocStd_Document) aDocument; |
1480 | Standard_CString aDocS(theArg[1]); |
1481 | if (!DDocStd::GetDocument(aDocS, aDocument)) return 1; |
1482 | Handle(TDataStd_UAttribute) anObj = AddObject(aDocument); |
1483 | if(anObj.IsNull()) return 1; |
1484 | Standard_GUID funGUID; |
1485 | if(!GetFuncGUID("PntRLT",funGUID)) return 1; |
1486 | |
1487 | Handle(TFunction_Function) aFun = SetFunctionDS(anObj->Label(), funGUID); |
1488 | if(aFun.IsNull()) return 1; |
1489 | TDataStd_Name::Set(aFun->Label(), "PntRLT_Function"); |
1490 | |
1491 | TDF_Reference::Set(anObj->Label(), aFun->Label().FindChild(FUNCTION_RESULT_LABEL)); //result is here |
1492 | |
1493 | Handle(TDataStd_UAttribute) aRefPnt; |
1494 | if (!DDocStd::Find(aDocument, theArg[2], GEOMOBJECT_GUID, aRefPnt)) return 1; |
1495 | |
1496 | Standard_Real dx,dy,dz; |
91322f44 |
1497 | dx = Draw::Atof(theArg[3]); |
1498 | dy = Draw::Atof(theArg[4]); |
1499 | dz = Draw::Atof(theArg[5]); |
7fd59977 |
1500 | |
1501 | DNaming::GetReal(aFun,PNT_DX)->Set(dx); |
1502 | DNaming::GetReal(aFun,PNT_DY)->Set(dy); |
1503 | DNaming::GetReal(aFun,PNT_DZ)->Set(dz); |
1504 | |
1505 | DNaming::SetObjectArg(aFun, PNTRLT_REF, aRefPnt); |
1506 | |
1507 | DDF::ReturnLabel(theDI, anObj->Label()); |
1508 | return 0; |
1509 | } |
d99f0355 |
1510 | |
1511 | Message::SendFail() << "DNaming_AddPoint : Error"; |
7fd59977 |
1512 | return 1; |
1513 | } |
1514 | |
1515 | //======================================================================= |
1516 | //function : DNaming_PntOffset |
1517 | //purpose : "PntOffset Doc PntLabel newDX newDY newDZ " |
1518 | //======================================================================= |
1519 | |
1520 | static Standard_Integer DNaming_PntOffset (Draw_Interpretor& theDI, |
1521 | Standard_Integer theNb, |
1522 | const char** theArg) |
1523 | { |
1524 | if (theNb == 6) { |
1525 | Handle(TDocStd_Document) aDoc; |
1526 | Standard_CString aDocS(theArg[1]); |
1527 | if (!DDocStd::GetDocument(aDocS, aDoc)) return 1; |
1528 | TDF_Label objLabel; |
1529 | if (!DDF::FindLabel(aDoc->GetData(),theArg[2], objLabel)) return 1; |
1530 | |
1531 | Handle(TDataStd_UAttribute) anObj; |
1532 | if(!objLabel.FindAttribute(GEOMOBJECT_GUID, anObj)) return 1; |
1533 | Standard_GUID funGUID; |
1534 | |
1535 | if(!GetFuncGUID("PntXYZ",funGUID)) { |
1536 | if(!GetFuncGUID("PntRLT",funGUID)) |
1537 | return 1; |
1538 | } |
1539 | |
1540 | Handle(TFunction_Function) aFun = GetFunction(objLabel,funGUID); |
1541 | if(!aFun.IsNull()) { |
1542 | Standard_Real value(0.0); |
dde68833 |
1543 | Standard_Boolean isDX = strcmp(theArg[3],"skip") != 0; |
7fd59977 |
1544 | if(isDX) { |
91322f44 |
1545 | value = Draw::Atof(theArg[3]); |
7fd59977 |
1546 | DNaming::GetReal(aFun,PNT_DX)->Set(value); |
1547 | } |
dde68833 |
1548 | Standard_Boolean isDY = strcmp(theArg[4],"skip") != 0; |
7fd59977 |
1549 | if(isDY) { |
91322f44 |
1550 | value = Draw::Atof(theArg[4]); |
7fd59977 |
1551 | DNaming::GetReal(aFun,PNT_DY)->Set(value); |
1552 | } |
dde68833 |
1553 | Standard_Boolean isDZ = strcmp(theArg[5],"skip") != 0; |
7fd59977 |
1554 | if(isDZ) { |
91322f44 |
1555 | value = Draw::Atof(theArg[5]); |
7fd59977 |
1556 | DNaming::GetReal(aFun,PNT_DZ)->Set(value); |
1557 | } |
1558 | if(isDX || isDY || isDZ) |
1559 | DDF::ReturnLabel(theDI, objLabel); |
1560 | else |
04232180 |
1561 | std::cout <<"DNaming_PntOffset : Nothing changed" << std::endl; |
7fd59977 |
1562 | return 0; |
1563 | } |
1564 | } |
d99f0355 |
1565 | |
1566 | Message::SendFail() << "DNaming_PntOffset : Error"; |
7fd59977 |
1567 | return 1; |
1568 | } |
1569 | |
1570 | //======================================================================= |
1571 | //function : DNaming_AddLine3D |
1572 | //purpose : "AddLine3D Doc CurveType(0|1) Pnt1Lab Pnt2Lab [Pnt3Lab [Pnt4Lab [...]]]" |
1573 | // : Type = 0 - open, Type = 1 - closed |
1574 | //======================================================================= |
1575 | static Standard_Integer DNaming_Line3D (Draw_Interpretor& theDI, |
1576 | Standard_Integer theNb, |
1577 | const char** theArg) |
1578 | { |
1579 | if (theNb < 5) { |
d99f0355 |
1580 | Message::SendFail() << "DNaming_AddLine3D: Wrong number of arguments"; |
7fd59977 |
1581 | return 1; |
1582 | } |
1583 | Handle(TDocStd_Document) aDocument; |
1584 | Standard_CString aDocS(theArg[1]); |
1585 | if (!DDocStd::GetDocument(aDocS, aDocument)) return 1; |
1586 | |
1587 | Handle(TDataStd_UAttribute) anObj = AddObject(aDocument); |
1588 | if(anObj.IsNull()) return 1; |
1589 | Standard_GUID funGUID; |
1590 | if(!GetFuncGUID("Line3D",funGUID)) return 1; |
1591 | Handle(TFunction_Function) aFun = SetFunctionDS(anObj->Label(), funGUID); |
1592 | if(aFun.IsNull()) return 1; |
1593 | TDataStd_Name::Set(aFun->Label(), "Line3D_Function"); |
1594 | TDF_Reference::Set(anObj->Label(), aFun->Label().FindChild(FUNCTION_RESULT_LABEL)); //result is here |
1595 | |
91322f44 |
1596 | Standard_Integer aType = Draw::Atoi(theArg[2]); |
7fd59977 |
1597 | DNaming::GetInteger(aFun,LINE3D_TYPE)->Set(aType); |
1598 | |
1599 | //LINE3D_PNTNB |
1600 | //set Pnts |
1601 | Standard_Integer aPos = LINE3D_TYPE; |
1602 | for(Standard_Integer i=3; i < theNb; i++) { |
1603 | Handle(TDataStd_UAttribute) aPntObj; |
1604 | if (!DDocStd::Find(aDocument, theArg[i], GEOMOBJECT_GUID, aPntObj)) return 1; |
1605 | aPos++; |
1606 | DNaming::SetObjectArg(aFun, aPos, aPntObj); |
1607 | } |
1608 | |
1609 | DNaming::GetInteger(aFun,LINE3D_PNTNB)->Set(aPos - 1);//set number of points |
1610 | |
1611 | DDF::ReturnLabel(theDI, anObj->Label()); |
1612 | return 0; |
1613 | } |
1614 | // *** |
1615 | //========================================================================================== |
1616 | inline static void MapOfOrientedShapes(const TopoDS_Shape& S, TopTools_MapOfOrientedShape& M) |
1617 | { |
1618 | M.Add(S); |
1619 | TopoDS_Iterator It(S,Standard_True,Standard_True); |
1620 | while (It.More()) { |
1621 | MapOfOrientedShapes(It.Value(),M); |
1622 | It.Next(); |
1623 | } |
1624 | } |
1625 | //========================================================================================== |
1626 | static void MapOfOrientedShapes(const TopoDS_Shape& S1, const TopoDS_Shape& S2, |
1627 | TopTools_MapOfOrientedShape& M) { |
1628 | |
1629 | TopoDS_Iterator it(S2,Standard_True,Standard_True); |
1630 | while (it.More()) { |
1631 | if(it.Value().ShapeType() == S1.ShapeType()) |
1632 | M.Add(it.Value()); |
1633 | it.Next(); |
1634 | } |
1635 | } |
1636 | |
1637 | //========================================================================================== |
1638 | static void MapOfShapes(const TopoDS_Shape& S1, const TopoDS_Shape& S2, |
1639 | TopTools_MapOfShape& M) { |
1640 | |
1641 | TopoDS_Iterator it(S2,Standard_True,Standard_True); |
1642 | while (it.More()) { |
1643 | if(it.Value().ShapeType() == S1.ShapeType()) |
1644 | M.Add(it.Value()); |
1645 | it.Next(); |
1646 | } |
1647 | } |
1648 | //========================================================================================== |
1649 | inline static void CollectShapes(const TopoDS_Shape& S, TopTools_ListOfShape& List) |
1650 | { |
1651 | List.Append(S); |
1652 | TopoDS_Iterator It(S,Standard_True,Standard_True); |
1653 | while (It.More()) { |
1654 | CollectShapes(It.Value(),List); |
1655 | It.Next(); |
1656 | } |
1657 | } |
1658 | |
1659 | //========================================================================================== |
1660 | inline static void CollectMultShapes(const TopoDS_Shape& S, TopTools_ListOfShape& List) |
1661 | { |
1662 | TopAbs_ShapeEnum aType = S.ShapeType(); |
1663 | Standard_Integer aStop (TopAbs_SHAPE); |
1664 | for(Standard_Integer i = (Standard_Integer)aType +1; i < aStop; i++) { |
1665 | BRep_Builder aBuilder; |
1666 | TopoDS_Compound aCompound; |
1667 | aBuilder.MakeCompound(aCompound); |
1668 | TopExp_Explorer exp(S,(TopAbs_ShapeEnum)i); |
1669 | for (;exp.More();exp.Next()) |
1670 | aBuilder.Add(aCompound, exp.Current()); |
1671 | List.Append(aCompound); |
1672 | } |
1673 | } |
1674 | //========================================================================================== |
1675 | static Standard_Boolean MakeSelection (const Handle(TDataStd_UAttribute)& Obj, |
1676 | const TopoDS_Shape& Selection, |
1677 | const Handle(TDataStd_UAttribute)& ContextObj, |
1678 | const Standard_Boolean Geometry, |
1679 | const Standard_Boolean KeepOrientation) |
1680 | { |
1681 | if(!Obj.IsNull()) { |
1682 | Handle(TDataStd_TreeNode) aNode,RNode; |
1683 | Obj->Label().FindAttribute(TDataStd_TreeNode::GetDefaultTreeID(), aNode); |
1684 | if(aNode.IsNull()) |
1685 | aNode = TDataStd_TreeNode::Set(Obj->Label()); |
1686 | aNode->Remove(); |
1687 | Handle(TDataStd_UAttribute) aContainer = ContextObj; |
1688 | if(aContainer->Label().FindAttribute(TDataStd_TreeNode::GetDefaultTreeID(), RNode)) |
1689 | RNode->Append(aNode); |
1690 | TDataStd_Name::Set(Obj->Label(), "Auxiliary_Object"); |
1691 | Standard_GUID funGUID; |
1692 | if(GetFuncGUID("Attach",funGUID)) { |
1693 | Handle(TFunction_Function) aFun = SetFunctionDS(Obj->Label(), funGUID); |
1694 | if(!aFun.IsNull()) { |
1695 | TDataStd_Name::Set(aFun->Label(), "ISelection"); |
1696 | TDF_Label aResultLabel = aFun->Label().FindChild(FUNCTION_RESULT_LABEL, Standard_True); |
1697 | TDF_Reference::Set(Obj->Label(), aResultLabel ); //result of the object |
1698 | aResultLabel.ForgetAllAttributes(Standard_True); |
7fd59977 |
1699 | Handle(TNaming_NamedShape) aNS = DNaming::GetObjectValue( ContextObj); |
1700 | try{ |
1701 | const TopoDS_Shape& aContext = aNS->Get(); |
1702 | TNaming_Selector aSelector(aResultLabel); |
1703 | if(!aSelector.Select(Selection, aContext, Geometry, KeepOrientation)) |
1704 | return Standard_False; |
1705 | }catch (...) { |
04232180 |
1706 | std::cout << "EXCEPTION: SELECTION_IMPOSSIBLE" <<std::endl; |
7fd59977 |
1707 | } |
1708 | |
1709 | if(!aNS.IsNull()) { |
1710 | |
1711 | //TCollection_AsciiString entry; |
1712 | //TDF_Tool::Entry(aNS->Label(), entry); |
04232180 |
1713 | //std::cout << "ContextNS Label = " << entry <<std::endl; |
7fd59977 |
1714 | Handle(TFunction_Function) aCntFun; |
1715 | if(aNS->Label().Father().FindAttribute(TFunction_Function::GetID(), aCntFun)) { //Fun:2 ==> result |
1716 | // First argument of Selection function refers to father function (of context object) |
1717 | // to which selection is attached (because sel obj. itself already has refrence to result NS |
1718 | TDF_Reference::Set(aFun->Label().FindChild(FUNCTION_ARGUMENTS_LABEL).FindChild(ATTACH_ARG), |
1719 | aCntFun->Label()); //ref to function produced Context shape |
1720 | |
1721 | } |
1722 | } |
1723 | return Standard_True; |
1724 | } |
1725 | } |
1726 | } |
1727 | return Standard_False; |
1728 | } |
1729 | |
1730 | //========================================================================================== |
1731 | static Standard_Boolean MakeXSelection (const Handle(TDataStd_UAttribute)& Obj, |
1732 | const TopoDS_Shape& Selection, |
1733 | const Handle(TDataStd_UAttribute)& ContextObj, |
1734 | const Standard_Boolean Geometry, |
1735 | const Standard_Boolean KeepOrientation) |
1736 | { |
1737 | if(!Obj.IsNull()) { |
1738 | /* Handle(TDataStd_TreeNode) aNode,RNode; |
1739 | Obj->Label().FindAttribute(TDataStd_TreeNode::GetDefaultTreeID(), aNode); |
1740 | if(aNode.IsNull()) |
1741 | aNode = TDataStd_TreeNode::Set(Obj->Label()); |
1742 | aNode->Remove(); |
1743 | Handle(TDataStd_UAttribute) aContainer = ContextObj; |
1744 | if(aContainer->Label().FindAttribute(TDataStd_TreeNode::GetDefaultTreeID(), RNode)) |
1745 | RNode->Append(aNode); |
1746 | */ |
1747 | TDataStd_Name::Set(Obj->Label(), "Auxiliary_Object"); |
1748 | Standard_GUID funGUID; |
1749 | if(GetFuncGUID("XAttach",funGUID)) { |
1750 | Handle(TFunction_Function) aFun = SetFunctionDS(Obj->Label(), funGUID); |
1751 | if(!aFun.IsNull()) { |
1752 | TDataStd_Name::Set(aFun->Label(), "XSelection"); |
1753 | TDF_Label aResultLabel = aFun->Label().FindChild(FUNCTION_RESULT_LABEL, Standard_True); |
1754 | TDF_Reference::Set(Obj->Label(), aResultLabel ); //result of the object |
1755 | aResultLabel.ForgetAllAttributes(Standard_True); |
1756 | |
7fd59977 |
1757 | Handle(TNaming_NamedShape) aNS = DNaming::GetObjectValue( ContextObj); |
1758 | try{ |
1759 | const TopoDS_Shape& aContext = aNS->Get(); |
1760 | TNaming_Selector aSelector(aResultLabel); |
1761 | if(!aSelector.Select(Selection, aContext, Geometry, KeepOrientation)) |
1762 | return Standard_False; |
1763 | }catch (...) { |
04232180 |
1764 | std::cout << "EXCEPTION: SELECTION_IMPOSSIBLE" <<std::endl; |
7fd59977 |
1765 | } |
1766 | |
1767 | if(!aNS.IsNull()) { |
1768 | |
1769 | //TCollection_AsciiString entry; |
1770 | //TDF_Tool::Entry(aNS->Label(), entry); |
04232180 |
1771 | //std::cout << "ContextNS Label = " << entry <<std::endl; |
7fd59977 |
1772 | Handle(TFunction_Function) aCntFun; |
1773 | if(aNS->Label().Father().FindAttribute(TFunction_Function::GetID(), aCntFun)) { //Fun:2 ==> result |
1774 | // First argument of Selection function refers to father function (of context object) |
1775 | // to which selection is attached (because sel obj. itself already has refrence to result NS |
1776 | TDF_Reference::Set(aFun->Label().FindChild(FUNCTION_ARGUMENTS_LABEL).FindChild(ATTACH_ARG), |
1777 | aCntFun->Label()); //ref to function produced Context shape |
1778 | |
1779 | } |
1780 | } |
1781 | return Standard_True; |
1782 | } |
1783 | } |
1784 | } |
1785 | return Standard_False; |
1786 | } |
1787 | //======================================================================= |
1788 | inline static TCollection_ExtendedString compareShapes(const TopoDS_Shape& theShape1, |
1789 | const TopoDS_Shape& theShape2, |
1790 | const Standard_Boolean keepOrientation) |
1791 | { |
1792 | TCollection_ExtendedString aResult(""); |
1793 | |
1794 | if((theShape1.ShapeType() != TopAbs_COMPOUND) && |
1795 | theShape2.ShapeType() == TopAbs_COMPOUND) { |
1796 | if(keepOrientation) { |
1797 | TopTools_MapOfOrientedShape M; |
1798 | MapOfOrientedShapes(theShape1, theShape2, M); |
1799 | if(M.Contains(theShape1)) { |
1800 | aResult+=" Warning => Type migration to Compound"; |
1801 | return aResult; |
1802 | } |
1803 | } else { |
1804 | TopTools_MapOfShape M; |
1805 | MapOfShapes(theShape1, theShape2, M); |
1806 | if(M.Contains(theShape1)) { |
1807 | aResult+=" Warning => Type migration to Compound"; |
1808 | return aResult; |
1809 | } |
1810 | } |
1811 | } |
1812 | Standard_Boolean isComma=Standard_False; |
1813 | if(theShape1.ShapeType() != theShape2.ShapeType()) { |
1814 | aResult+=" Type was changed:"; |
1815 | aResult+=" Initial type = "; aResult+= TCollection_ExtendedString(theShape1.ShapeType()); |
1816 | aResult+="; Resulting type = "; aResult+= TCollection_ExtendedString(theShape2.ShapeType()); |
1817 | isComma = Standard_True; |
1818 | } else if(theShape1.TShape() != theShape2.TShape()) { |
1819 | aResult+=" TShape was changed"; |
1820 | isComma = Standard_True; |
1821 | } else if(theShape1.Location()!=theShape2.Location()) { |
1822 | aResult+=" Location was changed"; |
1823 | isComma = Standard_True; |
1824 | } |
1825 | |
1826 | if(keepOrientation) { |
1827 | if(theShape1.Orientation()!=theShape2.Orientation() && theShape1.ShapeType() != TopAbs_VERTEX) { |
1828 | if(theShape2.ShapeType() != TopAbs_COMPOUND) { |
1829 | if(isComma) |
1830 | aResult+=","; |
1831 | aResult+=" Orientation was changed"; |
1832 | } |
1833 | else { |
1834 | TopoDS_Iterator it(theShape2); |
1835 | for(;it.More(); it.Next()) { |
1836 | if(it.Value().IsSame(theShape1)) |
1837 | if(theShape1.Orientation()!=it.Value().Orientation()) { |
1838 | if(isComma) |
1839 | aResult+=","; |
1840 | aResult+=" Orientation was changed"; |
1841 | } |
1842 | } |
1843 | } |
1844 | } |
1845 | } |
1846 | return aResult; |
1847 | } |
1848 | |
1849 | //======================================================================= |
1850 | inline static TCollection_ExtendedString compareShapes(const TopoDS_Shape& theShape, |
1851 | //theShape - Compound of Multiple selection |
1852 | const TopTools_MapOfOrientedShape& aMap) |
1853 | { |
1854 | TCollection_ExtendedString aResult(""); |
1855 | if(theShape.ShapeType() != TopAbs_COMPOUND) { |
1856 | aResult+="the specified shape is not COMPOUND"; |
1857 | } else { |
1858 | TopoDS_Iterator it(theShape); |
1859 | for(;it.More();it.Next()) { |
1860 | const TopoDS_Shape& newShape = it.Value(); |
1861 | if(!aMap.Contains(newShape)) { |
1862 | aResult+=" Not in the context"; |
1863 | } |
1864 | } |
1865 | } |
1866 | return aResult; |
1867 | } |
7fd59977 |
1868 | |
7fd59977 |
1869 | //======================================================================= |
1870 | //function : DNaming_TestSingle |
1871 | //purpose : "TestSingleSelection Doc ObjectLabel [Orientation [Xselection [Geometry]]]" |
1872 | // : returns DDF::ReturnLabel of a first Aux object |
1873 | //======================================================================= |
1874 | static Standard_Integer DNaming_TestSingle (Draw_Interpretor& theDI, |
1875 | Standard_Integer theNb, |
1876 | const char** theArg) |
1877 | { |
1878 | if (theNb >= 3) { |
1879 | Handle(TDocStd_Document) aDoc; |
1880 | Standard_CString aDocS(theArg[1]); |
1881 | if (!DDocStd::GetDocument(aDocS, aDoc)) return 1; |
1882 | TDF_Label ObjLabel; |
1883 | if (!DDF::FindLabel(aDoc->GetData(),theArg[2], ObjLabel)) return 1; |
1884 | |
1885 | Handle(TDataStd_UAttribute) aCntObj; |
1886 | if(!ObjLabel.FindAttribute(GEOMOBJECT_GUID, aCntObj)) return 1; |
1887 | Standard_Boolean Orientation(Standard_False); |
1888 | Standard_Boolean XSelection(Standard_False); |
1889 | Standard_Boolean Geometry(Standard_False); |
1890 | if(theNb == 4) |
dde68833 |
1891 | Orientation = Draw::Atoi(theArg[3]) != 0; |
7fd59977 |
1892 | if(theNb == 5) |
dde68833 |
1893 | XSelection = Draw::Atoi(theArg[4]) != 0; |
7fd59977 |
1894 | if (theNb == 6) |
dde68833 |
1895 | Geometry = Draw::Atoi(theArg[5]) != 0; |
7fd59977 |
1896 | Handle(TNaming_NamedShape) aNS = DNaming::GetObjectValue( aCntObj); |
1897 | |
1898 | if(!aNS.IsNull() && !aNS->IsEmpty()) { |
1899 | const TopoDS_Shape& aRootShape = aNS->Get(); |
7fd59977 |
1900 | //TopTools_MapOfOrientedShape aMap0; |
1901 | //MapOfOrientedShapes(aRootShape, aMap0); |
1902 | TopTools_ListOfShape aList, aFailedList; |
1903 | CollectShapes(aRootShape, aList); |
1904 | if(aList.Extent()) |
1905 | aList.RemoveFirst(); |
1906 | Standard_Boolean isFirst(Standard_True); |
1907 | Handle(TDataStd_UAttribute) FirstAuxObj; |
1908 | TopTools_ListIteratorOfListOfShape it(aList); |
1909 | for(; it.More(); it.Next()) { |
1910 | const TopoDS_Shape& aCurShape = it.Value(); |
1911 | if(aCurShape.IsNull()) continue; |
1912 | if(aCurShape.ShapeType() == TopAbs_EDGE) { |
1913 | if (BRep_Tool::Degenerated(TopoDS::Edge(aCurShape))) |
1914 | continue; |
1915 | } |
1916 | Handle(TDataStd_UAttribute) auxObj = AddObject (aDoc); |
1917 | if(isFirst) { |
1918 | FirstAuxObj = auxObj; |
1919 | isFirst = Standard_False; |
1920 | TCollection_AsciiString entry; |
1921 | TDF_Tool::Entry(FirstAuxObj->Label(), entry); |
0797d9d3 |
1922 | #ifdef OCCT_DEBUG |
04232180 |
1923 | std::cout << "First Selection function at " << entry <<std::endl; |
7fd59977 |
1924 | #endif |
1925 | } |
1926 | Standard_Boolean isSelected (Standard_False); |
1927 | try { |
1928 | OCC_CATCH_SIGNALS |
1929 | { |
1930 | if(!XSelection) |
1931 | isSelected = MakeSelection(auxObj, aCurShape, aCntObj, Geometry, Orientation); |
1932 | else |
1933 | isSelected = MakeXSelection(auxObj, aCurShape, aCntObj, Geometry, Orientation); |
1934 | } |
1935 | } |
9775fa61 |
1936 | catch (Standard_Failure const& anException) { |
04232180 |
1937 | std::cout << "%%%INFO:Error: ::TestSingleSelection failed :"; |
1938 | std::cout << anException.GetMessageString() << std::endl; |
7fd59977 |
1939 | } |
1940 | catch(...) { |
04232180 |
1941 | std::cout << "%%%INFO:Error: ::TestSingleSelection selection failed : unknown exception type"; |
7fd59977 |
1942 | } |
1943 | TCollection_AsciiString entry; |
1944 | TDF_Tool::Entry(auxObj->Label(), entry); |
1945 | TCollection_ExtendedString aResult(""); |
1946 | if(isSelected) { |
1947 | const Handle(TNaming_NamedShape)& aSelNS = DNaming::GetObjectValue(auxObj); |
1948 | if(!aSelNS.IsNull() && !aSelNS->IsEmpty()) { |
1949 | const TopoDS_Shape& aSelectedShape = aSelNS->Get(); |
1950 | aResult += compareShapes(aCurShape, aSelectedShape,Orientation); |
1951 | TDF_ChildIDIterator itn(auxObj->Label(),TNaming_Naming::GetID(), Standard_True); |
1952 | for(;itn.More();itn.Next()) { |
1953 | Handle(TNaming_Naming) aNaming = Handle(TNaming_Naming)::DownCast(itn.Value()); |
1954 | if(!aNaming.IsNull()) { |
1955 | const TNaming_Name& aName = aNaming->GetName(); |
1956 | if(aName.Type() == TNaming_UNKNOWN) { |
1957 | aResult += " Selection at label = "; |
1958 | aResult += entry; |
1959 | aResult += " has UNKNOWN name type, shape type = "; |
d2e60688 |
1960 | aResult += TopAbs::ShapeTypeToString (aCurShape.ShapeType()); |
7fd59977 |
1961 | } |
1962 | |
1963 | } |
1964 | } |
1965 | } |
1966 | } else { |
1967 | aResult += " Selection at label = "; |
1968 | aResult += entry; |
1969 | aResult += " failed, shape type = "; |
d2e60688 |
1970 | aResult += TopAbs::ShapeTypeToString (aCurShape.ShapeType()); |
7fd59977 |
1971 | aFailedList.Append(aCurShape); |
1972 | } |
1973 | if(aResult.Length()) { |
1974 | if(aResult.Search("Warning") == -1) |
04232180 |
1975 | std::cout << "Failed units: " << aResult << " at " << entry << std::endl; |
7fd59977 |
1976 | else |
04232180 |
1977 | std::cout << aResult << " at " << entry << std::endl; |
7fd59977 |
1978 | TDataStd_Name::Set(auxObj->Label(), aResult); |
1979 | } |
1980 | } |
1981 | if(aFailedList.Extent()) { |
04232180 |
1982 | std::cout << "Failed units are kept at: "; |
7fd59977 |
1983 | TopTools_ListIteratorOfListOfShape it1(aFailedList); |
1984 | for(; it1.More(); it1.Next()) { |
1985 | const TDF_Label& aLabel = TDF_TagSource::NewChild(aDoc->Main()); |
1986 | |
1987 | TNaming_Builder B(aLabel); |
1988 | B.Generated(it1.Value()); |
1989 | TCollection_AsciiString entry; |
1990 | TDF_Tool::Entry(aLabel, entry); |
04232180 |
1991 | std::cout << "\t" <<entry <<std::endl; |
7fd59977 |
1992 | } |
1993 | } |
1994 | if(!FirstAuxObj.IsNull()) |
1995 | DDF::ReturnLabel(theDI, FirstAuxObj->Label()); |
1996 | return 0; |
1997 | } |
1998 | } |
6e6cd5d9 |
1999 | |
d99f0355 |
2000 | Message::SendFail() << "DNaming_TestSingle : Error"; |
7fd59977 |
2001 | return 1; |
2002 | } |
2003 | |
2004 | //======================================================================= |
2005 | //function : DNaming_Multiple |
2006 | //purpose : "TestMultipleSelection Doc ObjectLabel [Orientation [Xselection [Geometry]]]" |
2007 | // : returns DDF::ReturnLabel of a first Aux object |
2008 | //======================================================================= |
2009 | static Standard_Integer DNaming_Multiple (Draw_Interpretor& theDI, |
2010 | Standard_Integer theNb, |
2011 | const char** theArg) |
2012 | { |
2013 | if (theNb >= 3) { |
2014 | Handle(TDocStd_Document) aDoc; |
2015 | Standard_CString aDocS(theArg[1]); |
2016 | if (!DDocStd::GetDocument(aDocS, aDoc)) return 1; |
2017 | TDF_Label ObjLabel; |
2018 | if (!DDF::FindLabel(aDoc->GetData(),theArg[2], ObjLabel)) return 1; |
2019 | |
2020 | Handle(TDataStd_UAttribute) aCntObj; |
2021 | if(!ObjLabel.FindAttribute(GEOMOBJECT_GUID, aCntObj)) return 1; |
2022 | Standard_Boolean Orientation(Standard_False); |
2023 | Standard_Boolean XSelection(Standard_False); |
2024 | Standard_Boolean Geometry(Standard_False); |
2025 | if(theNb == 4) |
dde68833 |
2026 | Orientation = Draw::Atoi(theArg[3]) != 0; |
7fd59977 |
2027 | if(theNb == 5) |
dde68833 |
2028 | XSelection = Draw::Atoi(theArg[4]) != 0; |
7fd59977 |
2029 | if (theNb == 6) |
dde68833 |
2030 | Geometry = Draw::Atoi(theArg[5]) != 0; |
7fd59977 |
2031 | Handle(TNaming_NamedShape) aNS = DNaming::GetObjectValue( aCntObj); |
2032 | |
2033 | if(!aNS.IsNull() && !aNS->IsEmpty()) { |
2034 | const TopoDS_Shape& aRootShape = aNS->Get(); |
7fd59977 |
2035 | TopTools_MapOfOrientedShape aMap0; |
2036 | MapOfOrientedShapes(aRootShape, aMap0); |
2037 | TopTools_ListOfShape aList, aFailedList; |
2038 | CollectMultShapes(aRootShape, aList); |
2039 | |
2040 | Standard_Boolean isFirst(Standard_True); |
2041 | Handle(TDataStd_UAttribute) FirstAuxObj; |
2042 | TopTools_ListIteratorOfListOfShape it(aList); |
2043 | for(; it.More(); it.Next()) { |
2044 | const TopoDS_Shape& aCurShape = it.Value(); |
2045 | if(aCurShape.IsNull()) continue; |
2046 | if(aCurShape.ShapeType() == TopAbs_EDGE) { |
2047 | if (BRep_Tool::Degenerated(TopoDS::Edge(aCurShape))) |
2048 | continue; |
2049 | }// |
2050 | Handle(TDataStd_UAttribute) auxObj = AddObject (aDoc); |
2051 | if(isFirst) { |
2052 | FirstAuxObj = auxObj; |
2053 | isFirst = Standard_False; |
0797d9d3 |
2054 | #ifdef OCCT_DEBUG |
7fd59977 |
2055 | TCollection_AsciiString entry; |
2056 | TDF_Tool::Entry(FirstAuxObj->Label(), entry); |
04232180 |
2057 | std::cout << "First Selection function at " << entry <<std::endl; |
7fd59977 |
2058 | #endif |
2059 | } |
2060 | Standard_Boolean isSelected (Standard_False); |
2061 | try { |
2062 | OCC_CATCH_SIGNALS |
2063 | { |
2064 | if(!XSelection) |
2065 | isSelected = MakeSelection(auxObj, aCurShape, aCntObj, Geometry, Orientation); |
2066 | else |
2067 | isSelected = MakeXSelection(auxObj, aCurShape, aCntObj, Geometry, Orientation); |
2068 | } |
2069 | } |
9775fa61 |
2070 | catch (Standard_Failure const& anException) { |
04232180 |
2071 | std::cout << "%%%INFO:Error: ::TestSingleSelection failed :"; |
2072 | std::cout << anException.GetMessageString() << std::endl; |
7fd59977 |
2073 | } |
2074 | catch(...) { |
04232180 |
2075 | std::cout << "%%%INFO:Error: ::TestSingleSelection selection failed : unknown exception type"; |
7fd59977 |
2076 | } |
2077 | TCollection_AsciiString entry; |
2078 | TDF_Tool::Entry(auxObj->Label(), entry); |
2079 | TCollection_ExtendedString aResult(""); |
2080 | if(isSelected) { |
2081 | const Handle(TNaming_NamedShape)& aSelNS = DNaming::GetObjectValue(auxObj); |
2082 | if(!aSelNS.IsNull() && !aSelNS->IsEmpty()) { |
2083 | const TopoDS_Shape& aSelectedShape = aSelNS->Get(); |
2084 | aResult += compareShapes(aSelectedShape, aMap0); |
2085 | TDF_ChildIDIterator itn(auxObj->Label(),TNaming_Naming::GetID(), Standard_True); |
2086 | for(;itn.More();itn.Next()) { |
2087 | Handle(TNaming_Naming) aNaming = Handle(TNaming_Naming)::DownCast(itn.Value()); |
2088 | if(!aNaming.IsNull()) { |
2089 | const TNaming_Name& aName = aNaming->GetName(); |
2090 | if(aName.Type() == TNaming_UNKNOWN) { |
2091 | aResult += " Selection at label = "; |
2092 | aResult += entry; |
2093 | aResult += " has UNKNOWN name type, shape type = "; |
d2e60688 |
2094 | aResult += TopAbs::ShapeTypeToString (aCurShape.ShapeType()); |
7fd59977 |
2095 | } |
2096 | |
2097 | } |
2098 | } |
2099 | } |
2100 | } else { |
2101 | aResult += " Selection at label = "; |
2102 | aResult += entry; |
2103 | aResult += " failed, shape type = "; |
d2e60688 |
2104 | aResult += TopAbs::ShapeTypeToString (aCurShape.ShapeType()); |
7fd59977 |
2105 | aFailedList.Append(aCurShape); |
2106 | } |
2107 | if(aResult.Length()) |
04232180 |
2108 | std::cout << "Failed units: " << aResult << std::endl; |
7fd59977 |
2109 | } |
2110 | |
2111 | if(aFailedList.Extent()) { |
2112 | TopTools_ListIteratorOfListOfShape it1(aFailedList); |
2113 | for(; it1.More(); it1.Next()) { |
2114 | const TDF_Label& aLabel = TDF_TagSource::NewChild(aDoc->Main()); |
2115 | |
2116 | TNaming_Builder B(aLabel); |
2117 | B.Generated(it1.Value()); |
2118 | } |
2119 | } |
2120 | if(!FirstAuxObj.IsNull()) |
2121 | DDF::ReturnLabel(theDI, FirstAuxObj->Label()); |
2122 | return 0; |
2123 | } |
2124 | } |
6e6cd5d9 |
2125 | |
d99f0355 |
2126 | Message::SendFail() << "DNaming_TestMultiple : Error"; |
7fd59977 |
2127 | return 1; |
2128 | } |
2129 | |
2130 | //======================================================================= |
2131 | //function : ModelingCommands |
2132 | //purpose : |
2133 | //======================================================================= |
2134 | |
2135 | void DNaming::ModelingCommands (Draw_Interpretor& theCommands) |
2136 | { |
2137 | |
2138 | static Standard_Boolean done = Standard_False; |
2139 | if (done) return; |
2140 | done = Standard_True; |
2141 | const char* g2 = "Naming modeling commands" ; |
2142 | |
2143 | theCommands.Add ("AddObject", |
2144 | "AddObject D", |
2145 | __FILE__, DNaming_AddObject, g2); |
2146 | |
2147 | theCommands.Add ("AddFunction", |
f486f64d |
2148 | "AddFunction D ObjEntry FunName[Box|Sph|Cyl|Cut|Fuse|Prism|Revol|PMove|Fillet|Attach|XAttach]", |
7fd59977 |
2149 | __FILE__, DNaming_AddFunction, g2); |
2150 | |
2151 | theCommands.Add ("AddBox", "AddBox Doc dx dy dz", __FILE__, DNaming_AddBox, g2); |
2152 | |
2153 | theCommands.Add ("BoxDX", "BoxDX Doc BoxLabel NewDX", __FILE__, DNaming_BoxDX, g2); |
2154 | |
2155 | theCommands.Add ("BoxDY", "BoxDY Doc BoxLabel NewDY", __FILE__, DNaming_BoxDY, g2); |
2156 | |
2157 | theCommands.Add ("BoxDZ", "BoxDZ Doc BoxLabel NewDZ", __FILE__, DNaming_BoxDZ, g2); |
2158 | |
2159 | theCommands.Add ("ComputeFun", "ComputeFun Doc FunLabel", __FILE__, DNaming_ComputeFun, g2); |
2160 | |
2161 | theCommands.Add ("InitLogBook", "InitLogBook Doc", __FILE__, DNaming_InitLogBook, g2); |
2162 | |
2163 | theCommands.Add ("AddDriver", |
2164 | "AddDriver Doc Name [Box|Sph|Cyl|Cut|Fuse|Prism|Revol|PTxyz|PTALine|PRLine|PMirr|Fillet|Attach|XAttach]", |
2165 | __FILE__, DNaming_AddDriver, g2); |
2166 | |
2167 | theCommands.Add ("AttachShape", |
2168 | "AttachShape Doc Shape Context [Container [KeepOrientation [Geometry]]]", |
2169 | __FILE__, DNaming_AttachShape, g2); |
2170 | |
2171 | theCommands.Add ("XAttachShape", |
2172 | "XAttachShape Doc Shape Context [KeepOrientation [Geometry]]", |
2173 | __FILE__, DNaming_XAttachShape, g2); |
2174 | |
2175 | theCommands.Add ("AddCyl", "AddCyl Doc Radius Height Axis", __FILE__, DNaming_AddCylinder, g2); |
2176 | |
2177 | theCommands.Add ("CylRad", "CylRad Doc CylLabel NewRad", __FILE__, DNaming_CylRad, g2); |
2178 | |
2179 | |
2180 | theCommands.Add ("AddFuse", "AddFuse Doc Object Tool", __FILE__, DNaming_AddFuse, g2); |
2181 | |
2182 | theCommands.Add ("AddCut", "AddCut Doc Object Tool", __FILE__, DNaming_AddCut, g2); |
2183 | |
2184 | theCommands.Add ("AddCommon", "AddCommon Doc Object Tool", __FILE__, DNaming_AddCommon, g2); |
2185 | |
372ceec4 |
2186 | theCommands.Add ("AddSection", "AddSection Doc Object Tool", __FILE__, DNaming_AddSection, g2); |
2187 | |
7fd59977 |
2188 | theCommands.Add ("AddFillet", |
2189 | "AddFillet Doc Object Radius Path [SurfaceType(0-Rational;1-QuasiAngular;2-Polynomial)]", |
2190 | __FILE__, DNaming_AddFillet, g2); |
2191 | |
2192 | theCommands.Add ("PTranslateDXYZ", "PTranslateDXYZ Doc ShapeEntry dx dy dz", |
2193 | __FILE__, DNaming_PTranslateDXYZ, g2); |
2194 | |
2195 | theCommands.Add ("PTranslateAlongLine", "PTranslateAlongLine Doc ShapeEntry Line off", |
2196 | __FILE__, DNaming_PTranslateLine, g2); |
2197 | |
2198 | theCommands.Add ("PRotateRoundLine", "PRotateRoundLine Doc ShapeEntry Line Angle", |
2199 | __FILE__, DNaming_PRotateLine, g2); |
2200 | |
2201 | theCommands.Add ("PMirror", "PMirror Doc ShapeEntry PlaneObj", |
2202 | __FILE__, DNaming_PMirrorObject, g2); |
2203 | |
2204 | |
2205 | theCommands.Add ("AddPrism", "AddPrism Doc BasisLabel Height Reverse(0/1) ", |
2206 | __FILE__, DNaming_AddPrism, g2); |
2207 | |
2208 | theCommands.Add ("PrismHeight", "PrismHeight Doc PrismLabel NewHeight", |
2209 | __FILE__, DNaming_PrismHeight, g2); |
2210 | |
2211 | theCommands.Add ("AddRevol", "AddRevol Doc BasisLabel AxisLabel [Angle [Reverse(0/1)]] ", |
2212 | __FILE__, DNaming_AddRevol, g2); |
2213 | |
2214 | theCommands.Add ("RevolutionAngle", "RevolutionAngle Doc RevolutionLabel NewAngle", |
2215 | __FILE__, DNaming_RevolutionAngle, g2); |
2216 | |
2217 | theCommands.Add ("AddSphere", "AddSphere Doc CenterLabel Radius ", |
2218 | __FILE__, DNaming_AddSphere, g2); |
2219 | |
2220 | theCommands.Add ("SphereRadius", "SphereRadius Doc SphereLabel NewRadius", |
2221 | __FILE__, DNaming_SphereRadius, g2); |
2222 | |
2223 | theCommands.Add ("TestSingleSelection", |
2224 | "TestSingleSelection Doc ObjectLabel [Orientation [Xselection [Geometry]]]", |
2225 | __FILE__, DNaming_TestSingle, g2); |
2226 | |
2227 | theCommands.Add ("SolveFlatFrom", "SolveFlatFrom Doc FistAuxObjLabel", |
2228 | __FILE__, DNaming_SolveFlatFrom, g2); |
2229 | |
2230 | theCommands.Add ("CheckLogBook", "CheckLogBook Doc", __FILE__, DNaming_CheckLogBook, g2); |
2231 | |
2232 | theCommands.Add ("TestMultipleSelection", |
2233 | "TestMultipleSelection Doc ObjectLabel [Orientation [Xselection [Geometry]]]", |
2234 | __FILE__, DNaming_Multiple, g2); |
2235 | |
2236 | theCommands.Add ("AddPoint", "AddPoint Doc x y z", __FILE__, DNaming_AddPoint, g2); |
2237 | |
2238 | theCommands.Add ("AddPointRlt", "AddPointRlt Doc RefPntObj dx dy dz", |
2239 | __FILE__, DNaming_AddPointRlt, g2); |
2240 | |
2241 | theCommands.Add ("PntOffset", "PntOffset Doc PntLabel newDX|skip newDY|skip newDZ|skip", |
2242 | __FILE__, DNaming_PntOffset, g2); |
2243 | |
2244 | theCommands.Add ("AddLine3D", "AddLine3D Doc CurveType(0|1) Pnt1 Pnt2 [Pnt3 [Pnt4 [...]]]", |
2245 | __FILE__, DNaming_Line3D, g2); |
2246 | } |
2247 | |
2248 | |