VBScriptの例: メソッドから出力引数を取得する

 
 
 

出力引数をサポートするスクリプト言語(VBScript など)では、一部の関数で複数の値を戻すために出力引数を使用します。 たとえば、NurbsCurve.Get メソッドは、NURBS カーブの完全なデータの説明を、すべて出力引数を使用して返します。

Set oSpiral = ActiveSceneRoot.AddGeometry( "Arc", "NurbsCurve" )
oSpiral.ActivePrimitive.Geometry.Curves(0).Get siSINurbs, aCtrlPts, aKnots, bClosed, lDegree, eParFactor

LogMessage "INFORMATION FOR " & oSpiral & ":"
LogMessage "=========================================================================="
LogMessage "Control Points:"
For i = 0 to UBound( aCtrlPts, 2 )
	LogMessage "x = " & aCtrlPts(0,i) & _
			"; y = " & aCtrlPts(1,i) & _
			"; z = " & aCtrlPts(2,i)
Next

LogMessage "---------------------------------------------------------------"
LogMessage "Knots:"
For j = 0 to UBound( aKnots )
	If j = 0 Then
		sKnotArray = aKnots(j)
	Else
		sKnotArray = sKnotArray & ", " & aKnots(j)
	End If
Next
LogMessage sKnotArray

LogMessage "---------------------------------------------------------------"
If bClosed Then
	LogMessage oSpiral & " is closed."
Else
	LogMessage oSpiral & " is not closed."
End If

LogMessage "---------------------------------------------------------------"
LogMessage "Degree of " & oSpiral & " is " & lDegree & "."

LogMessage "---------------------------------------------------------------"
Select Case eParFactor
	Case siUniformParameterization
		LogMessage oSpiral & "'s knot parameterization is uniform."
	Case siNonUniformParameterization
		LogMessage oSpiral & "'s knot parameterization is non-uniform."
	Case siChordLengthParameterization
		LogMessage oSpiral & "'s knot parameterization is chord-length."
	Case Else
		LogMessage oSpiral & "'s knot parameterization is centripetal."
End Select

この例では、Softimage の Script Editor に以下の情報を出力します。

'INFO : "INFORMATION FOR arc:"
'INFO : "===================================================================="
'INFO : "Control Points:"
'INFO : "x = 0; y = 4; z = 0"
'INFO : "x = 0.130925984580936; y = 4; z = 0"
'INFO : "x = 0.392686645860565; y = 3.987138627451; z = 0"
'INFO : "x = 0.781619130526076; y = 3.92944824405423; z = 0"
'INFO : "x = 1.16300456042221; y = 3.83391512600961; z = 0"
'INFO : "x = 1.53319488189217; y = 3.70145930948035; z = 0"
'INFO : "x = 1.88861828877126; y = 3.53335641633986; z = 0"
'INFO : "x = 2.22585364684673; y = 3.33122536952072; z = 0"
'INFO : "x = 2.54165271631229; y = 3.09701280083833; z = 0"
'INFO : "x = 2.83297430783163; y = 2.83297430783163; z = 0"
'INFO : "x = 3.09701280083833; y = 2.54165271631228; z = 0"
'INFO : "x = 3.33122536952073; y = 2.22585364684672; z = 0"
'INFO : "x = 3.53335641633986; y = 1.88861828877126; z = 0"
'INFO : "x = 3.70145930948036; y = 1.53319488189217; z = 0"
'INFO : "x = 3.83391512600961; y = 1.16300456042221; z = 0"
'INFO : "x = 3.92944824405423; y = 0.781619130526073; z = 0"
'INFO : "x = 3.987138627451; y = 0.392686645860561; z = 0"
'INFO : "x = 4; y = 0.130925984580936; z = 0"
'INFO : "x = 4; y = 0; z = 0"
'INFO : "--------------------------------------------------------------------"
'INFO : "Knots:"
'INFO : "0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 16, 16"
'INFO : "--------------------------------------------------------------------"
'INFO : "arc is not closed."
'INFO : "--------------------------------------------------------------------"
'INFO : "Degree of arc is 3."
'INFO : "--------------------------------------------------------------------"
'INFO : "arc's knot parameterization is non-uniform."