Navigation: Scripting Reference Manual > Functions & Subroutines > SetNURBCurveControlPt

 

SetNURBCurveControlPt

 

Contact Us: fredsupport@photonengr.com

 

Description

This subroutine sets the x,y,z position and weight of a specific control point in a NURB curve.  The specific control point being set in the NURB curve can be specified using either 0 based forward indexing (i.e. 0, 1, 2, ..., N) or -1 based reverse indexing (i.e. -1, -2, ..., -(N+1)).  The reverse indexing scheme allows control points at the end of the control point list to be easily accessed without specific knowledge of the total number of control points used in the curve definition.  This may be particularly useful, for example, when the NURB curve is being modified as part of an analysis and control points are being inserted into the curve but the end control points are unchanged.

 

 

Syntax

SetNURBCurveControlPt( nCurve, cpIndex, xpos, ypos, zpos, weight )

 

 

Parameters

nCurve As Long

Node number of the NURB curve being modified.

 

cpIndex As Long

Index into the control points array of the NURB curve indicating which control point is being set.  The cpIndex values can range from 0 to N-1 for forward indexing, where N is the number of control points defined in the curve.  The cpIndex values can range from -1 to -N for reverse indexing, where N is the number of control points defined in the curve.  In reverse indexing, -1 is the last control point, -2 is the second to last, etc.

 

xPos As Double

X position of the control point at index cpIndex.

 

yPos As Double

Y position of the control point at index cpIndex.

 

zPos As Double

Z position of the control point at index cpIndex.

 

weight As Double

Weight of the control point at index cpIndex.

 

 

Example

The example below demonstrates how to modify the last control point in a NURB curve using the reverse indexing scheme.

 

Sub Main

 

    ClearOutputWindow()

    EnableTextPrinting(True)

 

    'NURB curve node

    Dim ncNode As Long

    ncNode = FindFullName( "Geometry.Custom Surface.NURB Curve" )

    Print "NURB curve being modified: " & GetFullName( ncNode )

 

    'Scale the z position of the last control point by 10%

    Dim xpos As Double, ypos As Double, zpos As Double, weight As Double

    GetNURBCurveControlPt( ncNode, -1, xpos, ypos, zpos, weight )

    SetNURBCurveControlPt( ncNode, -1, xpos, ypos, 1.1*zpos, weight )

 

End Sub

 

See Also

Curve Scripting Commands

GetNURBCurve

SetNURBCurve

GetNURBCurveControlPt

 

 

 

 

 

Copyright © Photon Engineering, LLC