set oCone = Application.ActiveProject.ActiveScene.Root.AddGeometry("Cone","MeshSurface")
set oCluster = oCone.ActivePrimitive.Geometry.AddCluster( siVertexCluster,"MyCluster",Array(3,1))
Call TotalClusterTranslation(oCluster)
SelectObj oCluster.FullName
Translate , 0.000, 4.000, 0.000, siAbsolute, siView, siObj, siY
Call TotalClusterTranslation(oCluster)
Sub TotalClusterTranslation(in_Cluster)
dim l_vec3, l_collStaticKinematicState, l_totX, l_totY, l_totZ
l_totX = 0.0
l_totY = 0.0
l_totZ = 0.0
if in_Cluster.HasStaticKinematicState then
set l_collStaticKinematicState = in_Cluster.GetStaticKinematicStates
set l_vec3 = XSIMath.CreateVector3
for each staticKinematicState in l_collStaticKinematicState
staticKinematicState.Transform.GetTranslation l_vec3
l_totX = l_vec3.X + l_totX
l_totY = l_vec3.Y + l_totY
l_totZ = l_vec3.Z + l_totZ
next
logmessage "The total translation is : " & l_totX & ", " & l_totY & ", " & l_totZ
else
logmessage "There's no translation on this cluster."
end if
end sub
|