1 // Created on: 1993-08-05
2 // Created by: Martine LANGLOIS
3 // Copyright (c) 1993-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.
17 Handle(StepGeom_BSplineCurveWithKnots) BSWK;
18 Standard_Integer Deg, N, i, Nknots, itampon;
19 Standard_Real rtampon;
20 Handle(StepGeom_CartesianPoint) Pt = new StepGeom_CartesianPoint;
21 Handle(StepGeom_HArray1OfCartesianPoint) Listpoints;
22 StepGeom_BSplineCurveForm Form;
23 StepData_Logical Fermeture, Selfinter;
24 Handle(TColStd_HArray1OfInteger) Mult;
25 Handle(TColStd_HArray1OfReal) ListKnots, ListWeights;
26 GeomAbs_BSplKnotDistribution Distribution;
27 StepGeom_KnotType KnotSpec;
32 Array1OfPnt_gen P(1,N);
34 Listpoints = new StepGeom_HArray1OfCartesianPoint(1,N);
35 for ( i=P.Lower(); i<=P.Upper(); i++) {
36 GeomToStep_MakeCartesianPoint MkPoint(P.Value(i));
38 Listpoints->SetValue(i, Pt);
41 Form = StepGeom_bscfUnspecified;
44 Fermeture = StepData_LTrue;
46 Fermeture = StepData_LFalse;
48 Selfinter = StepData_LFalse;
50 Nknots = BS->NbKnots();
51 TColStd_Array1OfInteger M(1,Nknots);
52 BS->Multiplicities(M);
53 Mult = new TColStd_HArray1OfInteger(1,Nknots);
54 for ( i=M.Lower(); i<=M.Upper(); i++) {
56 Mult->SetValue(i, itampon);
59 TColStd_Array1OfReal K(1,Nknots);
61 ListKnots = new TColStd_HArray1OfReal(1,Nknots);
62 for ( i=K.Lower(); i<=K.Upper(); i++) {
64 ListKnots->SetValue(i, rtampon);
67 Distribution = BS->KnotDistribution();
68 if ( Distribution == GeomAbs_NonUniform )
69 KnotSpec = StepGeom_ktUnspecified;
70 else if ( Distribution == GeomAbs_Uniform )
71 KnotSpec = StepGeom_ktUniformKnots;
72 else if ( Distribution == GeomAbs_QuasiUniform )
73 KnotSpec = StepGeom_ktQuasiUniformKnots;
75 KnotSpec = StepGeom_ktPiecewiseBezierKnots;
77 BSWK = new StepGeom_BSplineCurveWithKnots;
78 Handle(TCollection_HAsciiString) name = new TCollection_HAsciiString("");
79 BSWK->Init(name, Deg, Listpoints, Form, Fermeture, Selfinter, Mult,
80 ListKnots, KnotSpec );
82 theBSplineCurveWithKnots = BSWK;