CreateParticleType

Introduced

1.0

Description

Creates a new ParticleType.

Note: This command uses output arguments. C# and some scripting languages (such as JScript, PerlScript and Python) don't support arguments passed by reference so you need to use the best workaround for your situation:

For scripting languages this command returns an ISIVTCollection which you can use to get the output arguments.

For C# you can use the XSIApplication.ExecuteCommand method to call this command. ExecuteCommand packs the output arguments into a C# System.Object containing an Array of the output arguments (see Calling Commands from C#).

Scripting Syntax

CreateParticleType( RenderType, [Output] )

Parameters

Parameter

Type

Description

RenderType

siParticleRenderType

Type of particle type shader to apply by default.

Default Value: siBillboardType

Output [out]

ParticleType

New Particle Type object

Examples

Python Example

#
# This example demonstrates how to use the CreateParticleType command and how
# to work with multiple particle types for a single simulation
#

from win32com.client import constants as c
Application.NewScene( "", 0 )

# Set up a disc emitting particles
pcloud = Application.CreateParticleCloud( "", "Disc" )(0)

# Set up goals for both PTypes
goal4OrigPType = Application.CreatePrim( "Grid", "MeshSurface", "thing1" )
Application.Translate( goal4OrigPType, 30, 30, 5 )
Application.Rotate( goal4OrigPType, 0, 0, -90 )

goal4PEmitter = Application.CreatePrim( "Grid", "MeshSurface", "thing2" )
Application.Translate( goal4PEmitter, -30, 30, -5 )
Application.Rotate( goal4PEmitter, 0, 0, 90 )

# Set up a goal for the original PType (and color the particles
# fuscia for this particle type so it's obvious which type is which)
myPType = pcloud.ActivePrimitive.ParticleTypes(0)
myPType.Parameters( "Green" ).Value = 0.072
Application.AddParticleGoal( myPType, goal4OrigPType )

# Set up the event on the original particle type
myPEvent = Application.AddParticleEvent( myPType )(0)(0)
myPEvent.Name = "PEvent_Demo"
myPEvent.Parameters( "EventTrigger" ).Value = 5
myPEvent.Parameters( "TriggerValue" ).Value = 7
myPEvent.Parameters( "EventAction" ).Value = 0

# Set up the emitter for the event
myPEmission = Application.CreateEventSource( myPEvent )(0)
myPEmission.Parameters( "Rate" ).Value = 5
myPEmission.Parameters( "Spread" ).Value = 25
myPEmission.Parameters( "Roll" ).Value = 12
myPEmission.Parameters( "Yaw" ).Value = 7

# Set up a new blob particle type that will be emitted and set
# the new particles to flee from the goal
for connectPType2Emitter in myPEmission.NestedObjects :
   if connectPType2Emitter.Name == "PType" :
       break

myNewPType = Application.CreateParticleType( c.siBlobType )(0)
myNewPType.Name = "PType4Emitter"
Application.SetParticleType( connectPType2Emitter, myNewPType )
Application.AddParticleGoal( myNewPType, goal4PEmitter )

# Now take a look at the simulation
myViewPort = Application.Desktop.ActiveLayout.Views( "vm" )
myViewPort.SetAttributeValue( "layout", "maximize:b" )
Application.FrameAll()
Application.PlayForwardsFromStart()

See Also

SetParticleType

Particle

ParticleType

ParticleCloud

ParticleCloudPrimitive

 

 

 



SOFTIMAGE|XSI v6.01     

Return to Softimage XSI Index