Navigation: Scripting Reference Manual > Functions & Subroutines > SetNURBSurf

 

SetNURBSurf

 

Contact Us: fredsupport@photonengr.com

 

Description

Sets a NURB surface in the associated FRED document.

 

Syntax

SetNURBSurf n, entity, maxIdxU, maxIdxV, orderU, orderV, knotU, knotV, points, weights

 

Parameters

n As Long

Node number of the surface.

 

entity As T_ENTITY

Structure containing the new basic entity data for the NURB surface.

 

maxIdxU As Long

One less than the number of terms in the U parameter direction.

 

maxIdxV As Long

One less than the number of terms in the V parameter direction.

 

orderU As Long

The new order of the U basis functions.

 

orderV As Long

The new order of the V basis functions.

 

knotU() As Double

The new U knot array.

 

knotV() As Double

The new V knot array.

 

points() As Double

The new array of control points. (1D array)

 

weights() As Double

The new weights of the control points. (1D array)

 

Remarks

If there is a problem, the subroutine sets an error and returns without modifying the surface. Note that order = degree + 1.

 

Examples

The following script retrieves the parameters from a NURB surface using the GetNurbSurf subroutine, modifies the control point positions and then sets the parameters back to the surface.  In this example the surface is a square plane with four control points.

 

Sub Main

 

          Dim ent As T_ENTITY

          Dim nurbNode As Long, maxIdxU As Long, maxIdxV As Long, orderU As Long, orderV As Long, sf As Long

          Dim knotU( ) As Double, knotV( ) As Double, points( ) As Double, weights( ) As Double

 

          'Retrieve the NURB surface information.

          nurbNode = FindFullName( "Geometry.CustomNURB.NURB Surface" )

          GetNURBSurf nurbNode, ent, maxIdxU, maxIdxV, orderU, orderV, knotU, knotV, points, weights

 

          'Reset the control points:

          sf = 2 'scale factor

          'load X

          points( 0, 0 ) = points( 0, 0 ) * sf : points( 0, 1 ) = points( 0, 1 ) * sf : points( 0, 2 ) = points( 0, 2 ) * sf : points( 0, 3 ) = points( 0, 3 ) * sf

          'load Y

          points( 1, 0 ) = points( 1, 0 ) * sf : points( 1, 1 ) = points( 1, 1 ) * sf : points( 1, 2 ) = points( 1, 2 ) * sf : points( 1, 3 ) = points( 1, 3 ) * sf

          'load Z

          points( 2, 0 ) = points( 2, 0 ) * sf : points( 2, 1 ) = points( 2, 1 ) * sf : points( 2, 2 ) = points( 2, 2 ) * sf : points( 2, 3 ) = points( 2, 3 ) * sf

 

          'Set the NURB surface back to the document

          SetNURBSurf nurbNode, ent,  maxIdxU, maxIdxV, orderU, orderV, knotU(), knotV(), points(), weights()

 

          Update

 

End Sub

 

See Also

T_ENTITY

AddNURBSurf

GetNURBSurf

GetNURBSurfParameterLimits

SetNURBSurfParameterLimits

Surfaces

 

 

 

 

 

Copyright © Photon Engineering, LLC