Description This function sets the coefficient value for the i'th aspheric term of a QBfs surface.
Syntax SetQBfsSurfIthCoef surfNode, coefTerm, coefVal
Parameters surfNode As Long Node number for the QBfs surface being queried.
coefTerm As Long Index into the coefficient array (zero based) for the aspheric term whose value is being set.
coefVal As Double Value being set for the i'th aspheric coefficient.
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
|