Description This function retrieves the coefficient value from the i'th aspheric term of a QCon surface.
Syntax coefVal = GetQConSurfIthCoef( surfNode, coefTerm )
Parameters coefVal (Double) Returned value of the i'th aspheric coefficient.
surfNode As Long Node number for the QCon surface being queried.
coefTerm As Long Index into the coefficient array (zero based) for the aspheric term whose value is being retrieved.
Example The following example creates a new QCon 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 )
'QCon surface type Dim surfNode As Long Dim cv As Double, con As Double, rNorm As Double, coefs() As Double tEnt.name = "QCon 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 = AddQconSurf( 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 = GetQconSurfCoefCount( surfNode ) For curCoef = 0 To coefCount-1 coefVal = GetQconSurfIthCoef( surfNode, curCoef ) coefVal = coefVal*coefSF SetQconSurfIthCoef( surfNode, curCoef, coefVal ) Next
Update
End Sub
See Also
|