Object Hierarchy | Related C++ Class: ParticleType | Supported Parameter List: ParType
Inheritance
SIObject
ProjectItem
Property
ParticleType
Introduced
4.0
Description
Represents a particle type. A particle type serves as a definition of the particles on the initial state of a particle simulation. A particle cloud contains one or more particle type(s). All particle types in a scene can be found under Scene.Particles container.
Methods
Properties
|
|
Examples
1. VBScript Example
' ' This example demonstrates how to create a user defined particle attribute ' on a ParticleType and access its value within a particle cloud ' NewScene , false ' Set up the new ParticleType with a new ParticleAttribute set ParTypeCol = CreateParticleType() set oParticleType = ParTypeCol(0) oParticleType.AddAttribute "ZetaFactor", siPAVector3 ' Create a new ParticleCloud using the new ParticleType set oParticleCloud = ActiveSceneRoot.AddParticleCloud( oParticleType, "MyCloud" ) set oParticleCloudPrim = oParticleCloud.ActivePrimitive oParticleCloudPrim.AddParticles 10 , oParticleType set oParticleCollection = oParticleCloudPrim.Particles ' Vector object to fill in the x,y,z positions set pos = XSIMath.CreateVector3() ' Set the ParticleAttribute value for i = 0 to 9 set oParticle = oParticleCollection(i) pos.x = -5 + i pos.y = -3 + i pos.z = i oParticle.Attributes("ZetaFactor").Value = pos next ' Retrieve the ParticleAttribute value and print it for i = 0 to 9 set oParticle = oParticleCollection(i) set oVector3 = oParticle.Attributes("ZetaFactor").Value Application.LogMessage oVector3.x & " " & oVector3.y & " " & oVector3.z next ' Expected result: 'INFO : -5 -3 0 'INFO : -4 -2 1 'INFO : -3 -1 2 'INFO : -2 0 3 'INFO : -1 1 4 'INFO : 0 2 5 'INFO : 1 3 6 'INFO : 2 4 7 'INFO : 3 5 8 'INFO : 4 6 9
2. JScript Example
/* This example demonstrates how to create a user defined particle attribute on a ParticleType and access its value within a particle cloud */ NewScene( null, false ); // Set up the new ParticleType with a new ParticleAttribute var ParTypeCol = CreateParticleType(); var oParticleType = ParTypeCol(0); oParticleType.AddAttribute( "ZetaFactor", siPAVector3 ); // Create a new ParticleCloud using the new ParticleType var oParticleCloud = ActiveSceneRoot.AddParticleCloud( oParticleType, "MyCloud" ); var oParticleCloudPrim = oParticleCloud.ActivePrimitive; oParticleCloudPrim.AddParticles( 10, oParticleType ); var oParticleCollection = oParticleCloudPrim.Particles; // Vector object to fill in the x,y,z positions var pos = XSIMath.CreateVector3(); // Set the ParticleAttribute value for ( var i=0; i<10; i++ ) { var oParticle = oParticleCollection(i); pos.x = -5 + i; pos.y = -3 + i; pos.z = i; oParticle.Attributes("ZetaFactor").Value = pos; } // Retrieve the ParticleAttribute value and print it for ( var i=0; i<10; i++ ) { var oParticle = oParticleCollection(i); var oVector3 = oParticle.Attributes("ZetaFactor").Value; Application.LogMessage( oVector3.x + " " + oVector3.y + " " + oVector3.z ); } // Expected result: //INFO : -5 -3 0 //INFO : -4 -2 1 //INFO : -3 -1 2 //INFO : -2 0 3 //INFO : -1 1 4 //INFO : 0 2 5 //INFO : 1 3 6 //INFO : 2 4 7 //INFO : 3 5 8 //INFO : 4 6 9
3. Python Example
# # This example demonstrates how to create a user defined particle attribute # on a ParticleType and access its value within a particle cloud # from win32com.client import constants as c app = Application app.NewScene( "", 0 ); # Set up the new ParticleType with a new ParticleAttribute ParTypeCol = app.CreateParticleType() oParticleType = ParTypeCol(0) oParticleType.AddAttribute( "ZetaFactor", c.siPAVector3 ) # Create a new ParticleCloud using the new ParticleType oParticleCloud = app.ActiveSceneRoot.AddParticleCloud( oParticleType, "MyCloud" ) oParticleCloudPrim = oParticleCloud.ActivePrimitive oParticleCloudPrim.AddParticles( 10, oParticleType ) oParticleCollection = oParticleCloudPrim.Particles # Vector object to fill in the x,y,z positions pos = XSIMath.CreateVector3() # Set the ParticleAttribute value i = 0 while i < 10 : oParticle = oParticleCollection(i) pos.X = -5 + i pos.Y = -3 + i pos.Z = i oParticle.Attributes("ZetaFactor").Value = pos i = i + 1 # Retrieve the ParticleAttribute value and print it i = 0 while i < 10 : oParticle = oParticleCollection(i) oVector3 = oParticle.Attributes("ZetaFactor").Value Application.LogMessage( str(oVector3.X) + " " + str(oVector3.Y) + " " + str(oVector3.Z) ) i = i + 1 # Expected result: #INFO : -5.0 -3.0 0.0 #INFO : -4.0 -2.0 1.0 #INFO : -3.0 -1.0 2.0 #INFO : -2.0 0.0 3.0 #INFO : -1.0 1.0 4.0 #INFO : 0.0 2.0 5.0 #INFO : 1.0 3.0 6.0 #INFO : 2.0 4.0 7.0 #INFO : 3.0 5.0 8.0 #INFO : 4.0 6.0 9.0
See Also
Autodesk Softimage v7.5