FAQ 003427 EN

6 August 2019

Thomas Günthel Modeling | Structure RF-COM

How can I create NURBS with the COM interface?

Answer

The main object is not a line object but an object of the type NurbSpline.
Here is a short example for creating a NURBS (Non-Uniform Rational B-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 = Default
nodes (0) .CS = Cartesian
nodes (0) .X = 1
nodes (0) .Y = 1
nodes (0) .Z = 0

nodes (1) .No = 2
nodes (1) .Type = Default
nodes (1) .CS = Cartesian
nodes (1) .X = 2
nodes (1) .Y = 1
nodes (1) .Z = -1
    
nodes (2) .No = 3
nodes (2) .Type = Default
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) = 1
darr1 (1) = 2
darr1 (2) = 3
darr1 (3) = 4
darr1 (4) = 5
darr1 (5) = 6
    
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

Keywords

NURBS Spline COM

Downloads

Contact us

Contact to Dlubal

Did you find your question?
If not, contact us via our free e-mail, chat, or forum support, or send us your question via the online form.

+49 9673 9203 0

info@dlubal.com

RFEM Other
RF-COM 5.xx

Add-on Module

Programmable interface (API) based on the COM technology

Price of First License
580.00 USD