1 // Created on: 1995-03-17
2 // Created by: Dieter THIEMANN
3 // Copyright (c) 1995-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
18 #include <MoniTool_DataMapOfShapeTransient.hxx>
19 #include <StdFail_NotDone.hxx>
20 #include <StepShape_GeometricCurveSet.hxx>
21 #include <StepShape_GeometricSetSelect.hxx>
22 #include <StepShape_HArray1OfGeometricSetSelect.hxx>
23 #include <TCollection_HAsciiString.hxx>
24 #include <TColStd_HSequenceOfTransient.hxx>
26 #include <TopoDS_Shape.hxx>
27 #include <TopoDSToStep.hxx>
28 #include <TopoDSToStep_Builder.hxx>
29 #include <TopoDSToStep_MakeGeometricCurveSet.hxx>
30 #include <TopoDSToStep_Tool.hxx>
31 #include <TopoDSToStep_WireframeBuilder.hxx>
32 #include <Transfer_FinderProcess.hxx>
33 #include <TransferBRep_ShapeMapper.hxx>
35 //=============================================================================
36 // Create a GeometricCurveSet of StepShape from a Shape of TopoDS
37 //=============================================================================
38 TopoDSToStep_MakeGeometricCurveSet::TopoDSToStep_MakeGeometricCurveSet(
39 const TopoDS_Shape& aShape,
40 const Handle(Transfer_FinderProcess)& FP)
42 done = Standard_False;
43 Handle(TColStd_HSequenceOfTransient) itemList;
44 MoniTool_DataMapOfShapeTransient aMap;
45 TopoDSToStep_Tool aTool (aMap, Standard_False);
46 TopoDSToStep_WireframeBuilder wirefB (aShape, aTool, FP);
47 TopoDSToStep::AddResult ( FP, aTool );
49 Handle(StepShape_GeometricCurveSet) aGCSet =
50 new StepShape_GeometricCurveSet;
51 Handle(TCollection_HAsciiString) empty = new TCollection_HAsciiString("");
52 if (wirefB.IsDone()) {
53 itemList = wirefB.Value();
54 Standard_Integer nbItem = itemList->Length();
56 Handle(StepShape_HArray1OfGeometricSetSelect) aGSS =
57 new StepShape_HArray1OfGeometricSetSelect(1,nbItem);
59 for (Standard_Integer i=1; i<=nbItem; i++) {
60 StepShape_GeometricSetSelect select;
61 select.SetValue(itemList->Value(i));
62 aGSS->SetValue(i,select);
64 aGCSet->SetName(empty);
65 aGCSet->SetElements(aGSS);
66 theGeometricCurveSet = aGCSet;
72 const Handle(StepShape_GeometricCurveSet)& TopoDSToStep_MakeGeometricCurveSet::Value() const
74 StdFail_NotDone_Raise_if (!done, "TopoDSToStep_MakeGeometricCurveSet::Value() - no result");
75 return theGeometricCurveSet;
78 //const Handle(StepShape_GeometricCurveSet)& TopoDSToStep_MakeGeometricCurveSet::Operator() const
83 //TopoDSToStep_MakeGeometricCurveSet::operator Handle(StepShape_GeometricCurveSet) () const