Navigation: Scripting Reference Manual > Functions & Subroutines > AddQBfsSurf

 

AddQBfsSurf

 

Contact Us: fredsupport@photonengr.com

 

Description

This function adds a QBfs type surface to the document and returns the node number of the new surface on the tree.

 

 

Syntax

surfNode = AddQBfsSurf( tEnt )

 

 

Parameters

surfNode (Long)

Returned node number for the new QBfs surface.

 

tEnt as T_ENTITY

Data structure containing the generic information about the new surface being added.

 

 

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