Navigation: Scripting Reference Manual > Functions & Subroutines > GetNURBCurveControlPt

 

GetNURBCurveControlPt

 

Contact Us: fredsupport@photonengr.com

 

Description

This subroutine retrieves the x,y,z position and weight value of a specific control point in a NURB curve.  The specific control point being retrieved from 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

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

 

 

Parameters

nCurve As Long

Node number of the NURB curve being queried.

 

cpIndex As Long

Index into the control points array of the NURB curve indicating which control point is being retrieved.  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

Retrieved X position of the control point at index cpIndex.

 

yPos As Double

Retrieved Y position of the control point at index cpIndex.

 

zPos As Double

Retrieved Z position of the control point at index cpIndex.

 

weight As Double

Retrieved weight of the control point at index cpIndex.

 

 

Example

The example below demonstrates how to query a NURB curve for its control point specifications using both forward and reverse indexing.

 

Sub Main

 

    ClearOutputWindow()

    EnableTextPrinting(True)

 

    'NURB curve node

    Dim ncNode As Long

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

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

 

    'Retrieve the NURB curve information

    Dim tEnt As T_ENTITY

    Dim nTerms As Long, order As Long, pts() As Double, knots() As Double

    Dim nPts As Long

    GetNURBCurve( ncNode, tEnt, nTerms, order, pts(), knots() )

    nPts = UBound(pts,2)+1

 

    'List point information using forward indexing

    Print ">>> Control point listing using forward indexing:"

    Print Chr(9) & "Index" & Chr(9) & "X-pos" & Chr(9) & "Y-pos" & Chr(9) & "Z-pos" & Chr(9) & "Weight"

    Dim xPt As Double, yPt As Double, zPt As Double, wt As Double

    Dim curPoint As Long

    For curPoint = 0 To nPts-1

        GetNURBCurveControlPt( ncNode, curPoint, xPt, yPt, zPt, wt )

        Print Chr(9) & curPoint & Chr(9) & xPt & Chr(9) & yPt & Chr(9) & zPt & Chr(9) & wt

    Next

 

    'List point information using reverse indexing

    Print ">>> Control point listing using reverse indexing:"

    Print Chr(9) & "Index" & Chr(9) & "X-pos" & Chr(9) & "Y-pos" & Chr(9) & "Z-pos" & Chr(9) & "Weight"

    For curPoint = -1 To -nPts Step -1

        GetNURBCurveControlPt( ncNode, curPoint, xPt, yPt, zPt, wt )

        Print Chr(9) & curPoint & Chr(9) & xPt & Chr(9) & yPt & Chr(9) & zPt & Chr(9) & wt

    Next

 

End Sub

 

See Also

Curve Scripting Commands

GetNURBCurve

SetNURBCurve

SetNURBCurveControlPt

 

 

 

 

 

Copyright © Photon Engineering, LLC