AnsweredAssumed Answered

Hot to use CreateSplinesByEqnParams2 with Periodic = 1?

Question asked by Thomas Samoht on Nov 15, 2014
Latest reply on Nov 22, 2014 by Thomas Samoht

Hello,

 

i try to biuld a closed spline using CreateSplinesByEqnParams2.

I consider following rules, applying for closed spline curves:

1) my first n control points are the same than the n last control points (where n is the order)

2) the first n knot values intervals are the same that the last n knot values intervals

3) periodic is set to "1"

4) the knot vector has ControlPointsCount + 1 values

(more information at https://forum.solidworks.com/docs/DOC-1542?q=Hot%20to%20use%20CreateSplinesByEqnParams2%20with%20Periodic%20=%201? )

 

However, the CreateSplinesByEqnParams2 method fails to biuld the spline.

What did i do wrong?

 

Here is a simple example (VBA):

    swSplineParaData.Dimension = 3

    swSplineParaData.Order = 3

    swSplineParaData.Periodic = 1

    swSplineParaData.ControlPointsCount = 8

  

    ' 1

    arrCtrlPts(0) = 0

    arrCtrlPts(1) = 0

    arrCtrlPts(2) = 0

 

    ' 2

    arrCtrlPts(3) = 0

    arrCtrlPts(4) = 2

    arrCtrlPts(5) = 0

 

    ' 3

    arrCtrlPts(6) = 2

    arrCtrlPts(7) = 2

    arrCtrlPts(8) = 0

 

    ' 4

    arrCtrlPts(9) = 2

    arrCtrlPts(10) = 0

    arrCtrlPts(11) = 0

 

    ' 5

    arrCtrlPts(12) = 2

    arrCtrlPts(13) = -2

    arrCtrlPts(14) = 0

   

    ' 6

    arrCtrlPts(15) = 0

    arrCtrlPts(16) = 0

    arrCtrlPts(17) = 0

 

    ' 7

    arrCtrlPts(18) = 0

    arrCtrlPts(19) = 2

    arrCtrlPts(20) = 0

   

    ' 8

    arrCtrlPts(21) = 2

    arrCtrlPts(22) = 2

    arrCtrlPts(23) = 0

   

    boolStatus = swSplineParaData.SetControlPoints(arrCtrlPts)

 

    arrKnotPts(0) = 0

    arrKnotPts(1) = 0.2

    arrKnotPts(2) = 0.3

    arrKnotPts(3) = 0.4

    arrKnotPts(4) = 0.5

    arrKnotPts(5) = 0.6

    arrKnotPts(6) = 0.7

    arrKnotPts(7) = 0.8

    arrKnotPts(8) = 1

 

    boolStatus = swSplineParaData.SetKnotPoints(arrKnotPts)

    varSeg = swSketchMgr.CreateSplinesByEqnParams2(swSplineParaData)

Outcomes