1130x
003427
6.8.2019

Vytváření NURBS křivek pomocí rozhraní COM

Jak mohu pomocí rozhraní COM vytvořit křivky NURBS Spline?


Odpověď:

Hlavním objektem není objekt linie, ale objekt typu NurbSpline.

Zde je krátký příklad pro vytvoření křivky NURBS Spline:

'--------------------------------------------------------------------------------------------------
Sub nurbs_test()
'--------------------------------------------------------------------------------------------------

    Dim model As RFEM5.model
    Set model = GetObject(, "RFEM5.Model")
    model.GetApplication.LockLicense

    On Error GoTo e

    Dim data As IModelData
    Set data = model.GetModelData

    ' define array of nodes
    Dim nodes(0 To 2) As RFEM5.Node
    
    nodes(0).No = 1
    nodes(0).Type = Standard
    nodes(0).CS = Cartesian
    nodes(0).X = 1
    nodes(0).Y = 1
    nodes(0).Z = 0

    nodes(1).No = 2
    nodes(1).Type = Standard
    nodes(1).CS = Cartesian
    nodes(1).X = 2
    nodes(1).Y = 1
    nodes(1).Z = -1
    
    nodes(2).No = 3
    nodes(2).Type = Standard
    nodes(2).CS = Cartesian
    nodes(2).RefObjectNo = 2
    nodes(2).X = 0
    nodes(2).Y = 1
    nodes(2).Z = 0
    
    Dim darr1(0 To 5) As Double
    darr1(0) = 0
    darr1(1) = 0
    darr1(2) = 0
    darr1(3) = 1
    darr1(4) = 1
    darr1(5) = 1
    
    Dim darr2(0 To 2) As Double
    darr2(0) = 1
    darr2(1) = 1
    darr2(2) = 1
    
    Dim ns As NurbSpline
    ns.General.No = 2
    ns.General.Type = NurbSplineType
    ns.General.NodeList = "1,2,3"
    ns.General.Comment = "line 2"
    ns.Knots = darr1
    ns.Order = 3
    ns.Weights = darr2
    
    data.PrepareModification
    data.SetNodes nodes
    data.SetNurbSpline ns
e:  data.FinishModification
    If Err.Number <> 0 Then MsgBox Err.Description, , Err.Source

    Set data = Nothing
    model.GetApplication.UnlockLicense
    Set model = Nothing

End Sub


Autor

Ing. Günthel zajišťuje technickou podporu zákazníkům.

Stahování


;