X3DObject.AddNurbsSurface

Description

Creates a NurbsSurfaceMesh object composed of one surface. This is typically used for creating nurbs surface from a set of geometry data.

Scripting Syntax

oReturn = X3DObject.AddNurbsSurface( ControlPoints, [UKnots], [VKnots], [UClosed], [VClosed], [UDegree], [VDegree], [UParam], [VParam], [NurbsFormat], [Name] );

Return Value

Returns a X3DObject object holding the new geometry, the new X3DObject is parented under this X3DObject.

Parameters

Parameter Type Description
ControlPoints 1D or 3D Array The control points used for creating the nurbs surface. The control points can be stored in a 1-dimensional array or in a 3-dimensional matrix (UxVx4) of x,y,z,w values. The 1-dimensional array should contain the number of points in U and V at the beginning followed by a sequence of x,y,z,w values (e.g. {U,V,Xo,Yo,Zo,...X(uv-1),Y(uv-1),Z(uv-1),W(uv-1)}).
UKnots Array of Doubles A vector of knot values in the U direction.

Default Value: Knots derived from control points.

VKnots Array of Doubles A vector of knot values in the V direction.

Default Value: Knots derived from control points.

UClosed Boolean Specifies whether the nurbs surface is closed or not in U direction.

Default Value: False

VClosed Boolean Specifies whether the nurbs surface is closed or not in V direction.

Default Value: False

UDegree Long Degree of the nurbs surface in U direction.

Default Value: 3

VDegree Long Degree of the nurbs surface in V direction.

Default Value: 3

UParam siKnotParameterization The parameterization factor of the nurbs surface in U direction.

Default Value: siNonUniformParameterization

VParam siKnotParameterization The parameterization factor of the nurbs surface in V direction.

Default Value: siNonUniformParameterization

NurbsFormat siNurbsFormat Specifies how the data is formatted.

Default Value: siSINurbs

Name String name of object

Examples

VBScript Example

NewScene , false
set oRoot = Application.ActiveProject.ActiveScene.Root
set oOrig = oRoot.AddGeometry( "Sphere", "NurbsSurface" )
oOrig.radius.Value = 1.000
oOrig.subdivu.Value = 1.000
oOrig.subdivv.Value = 1.000
oOrig.ActivePrimitive.Geometry.Surfaces(0).Get  _
        siSINurbs, _
        aCV, _
        aUKnots,aVKnots, _
        bUClosed,bVClosed, _
        lUDegree,lVDegree, _
        eUParameterization,eVParameterization
Application.LogMessage "bUClosed: " & bUClosed
Application.LogMessage "bVClosed: " & bVClosed
Application.LogMessage "lUDegree: " & lUDegree
Application.LogMessage "lVDegree: " & lVDegree
Application.LogMessage "eUParameterization: " & eUParameterization
Application.LogMessage "eVParameterization: " & eVParameterization
Application.LogMessage "aCV size:" & ubound(aCV,3)+1 & ":" & ubound(aCV,2)+1 & ":" &ubound(aCV,1)+1
for i = lbound( aCV, 3 ) to ubound( aCV, 3 )
        for j = lbound( aCV, 2 ) to ubound( aCV, 2 )
                Application.LogMessage "aCV(" & i & "," & j &") = " & _
                        aCV( 0, j, i ) & "," & aCV( 1, j, i ) & "," & aCV( 2, j, i ) & "," & aCV( 3, j, i )
        next
next
for i = lbound( aUKnots, 1 ) to ubound( aUKnots, 1 )
        Application.LogMessage "aUKnots(" & i & ") = " & aUKnots( i )
next
for i = lbound( aVKnots, 1 ) to ubound( aVKnots, 1 )
        Application.LogMessage "aVKnots(" & i & ") = " & aVKnots( i )
next
set oNurbsSurface = oRoot.AddNurbsSurface( _
        aCV, _
        aUKnots,aVKnots, _
        bUClosed,bVClosed, _
        lUDegree,lVDegree, _
        eUParameterization,eVParameterization, _
        siSINurbs _
        )
' Expected results:
'INFO : bUClosed: True
'INFO : bVClosed: False
'INFO : lUDegree: 3
'INFO : lVDegree: 3
'INFO : eUParameterization: 1
'INFO : eVParameterization: 1
'INFO : aCV size:3:4:4
'INFO : aCV(0,0) = 0,-1,0,1
'INFO : aCV(0,1) = -2.66666666666667,-1,0,1
'INFO : aCV(0,2) = -2.66666666666667,1,0,1
'INFO : aCV(0,3) = 0,1,0,1
'INFO : aCV(1,0) = 0,-1,0,1
'INFO : aCV(1,1) = 1.33333333333333,-1,2.3094010767585,1
'INFO : aCV(1,2) = 1.33333333333333,1,2.3094010767585,1
'INFO : aCV(1,3) = 0,1,0,1
'INFO : aCV(2,0) = 0,-1,0,1
'INFO : aCV(2,1) = 1.33333333333333,-1,-2.3094010767585,1
'INFO : aCV(2,2) = 1.33333333333333,1,-2.3094010767585,1
'INFO : aCV(2,3) = 0,1,0,1
'INFO : aUKnots(0) = 0
'INFO : aUKnots(1) = 1
'INFO : aUKnots(2) = 2
'INFO : aUKnots(3) = 3
'INFO : aVKnots(0) = 0
'INFO : aVKnots(1) = 0
'INFO : aVKnots(2) = 0
'INFO : aVKnots(3) = 1
'INFO : aVKnots(4) = 1
'INFO : aVKnots(5) = 1

See Also

NurbsSurface