Description This function retrieves the number of aspheric coefficients from a QBfs type surface. The number of coefficients returned counts up to the last non-zero term.
Syntax coefCount = GetQBfsSurfCoefCount( surfNode )
Parameters coefCount (Long) Returned number of aspheric coefficients..
surfNode As Long Node number for the QBfs surface being queried.
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
|