Navigation: Scripting Reference Manual > Functions & Subroutines > SetQBfsSurf

 

SetQBfsSurf

 

Contact Us: fredsupport@photonengr.com

 

Description

This function sets the parameters for a QBfs type surface.

 

 

Syntax

SetQBfsSurf surfNode, tEnt, curv, con, rNorm, coefs()

 

 

Parameters

surfNode As Long

Node number for the QBfs surface whose parameters are being set.

 

tEnt as T_ENTITY

Data structure containing the generic information about the surface being modified.

 

curv As Double

Base curvature of the surface.

 

con As Double

Conic constant of the surface.

 

rNorm As Double

Normalization radius of the surface aperture.

 

coefs() As Double

Zero based array containing the polynomial coefficient values.

 

Example

The following example creates a new QBfs surface with initial values, sets the surface's trimming volume and then loops over the coefficients and re-scales them by some factor.

 

Sub Main

 

    'cleanup

    Dim ceNode As Long

    ceNode = FindFullName( "Geometry.Forbes CE" )

    If ceNode > 0 Then

        DeleteEntity( ceNode )

    End If

 

    Dim tEnt As T_ENTITY

    InitEntity tEnt

    tEnt.name = "Forbes CE"

    ceNode = AddCustomElement( tEnt )

 

    'QBfs surface type

    Dim surfNode As Long

    Dim cv As Double, con As Double, rNorm As Double, coefs() As Double

    tEnt.name   = "QBfs surf"

    tEnt.parent = ceNode

    cv  = 1/25

    con = -0.02

    rNorm    = 12.7

    ReDim coefs(2)

    coefs(0) = 0.0

    coefs(1) = -0.001

    coefs(2) = -1.5e-8

    surfNode = AddQbfsSurf( tEnt, cv, con, rNorm, coefs() )

 

    'Set trim volume

    Dim xHw As Double, yHw As Double, zHw As Double

    Dim xCen As Double, yCen As Double, zCen As Double

    Dim shp As String

    xHw = 12.7 : yHw = 12.7 : zHw = Abs( Sag( surfNode, 0, yHw ) )

    xCen = 0 : yCen = 0 : zCen = 0

    shp = "Cylinder"

    SetTrimVol surfNode, xHw, yHw, zHw, xCen, yCen, zCen, shp

 

    Update

 

    'Scale coefficients

    Dim coefVal As Double, coefSF As Double

    Dim coefCount As Long, curCoef As Long

    coefSF = 1.1

    coefCount = GetQbfsSurfCoefCount( surfNode )

    For curCoef = 0 To coefCount-1

        coefVal = GetQbfsSurfIthCoef( surfNode, curCoef )

        coefVal = coefVal*coefSF

        SetQbfsSurfIthCoef( surfNode, curCoef, coefVal )

    Next

 

    Update

 

End Sub

 

See Also

Surface Script Commands

 

 

 

 

 

Copyright © Photon Engineering, LLC