Scatter

Discussion about scripting with Python
User avatar
ChristianZ
Posts: 3616
Joined: Sat Sep 09, 2006 11:37 am
Location: CH
Contact:

Re: Scatter

Post by ChristianZ » Tue Dec 08, 2020 12:52 pm

Like all older scripts you have to adapt the syntax if you work with standard legacy particle or dyverso particle emitters (haven't tested myself, but that would be a possible reason for why it does not work)
RF10.5 standard + RFC4D3, Mac&Windows

3dboris.com
Posts: 2
Joined: Tue Dec 08, 2020 8:05 am

Re: Scatter

Post by 3dboris.com » Wed Dec 09, 2020 6:34 pm

Thanks for the answer! Yes, I understand.
I've already fixed a few things but it still doesn't work.

emitterName = "Circle01"
objectName = "GeoSphere001"

#-------------------------

ob = scene.getObject(objectName)
em = scene.get_PB_Emitter(emitterName)
verts = ob.getVertices(REF_GLOBAL)

for each in verts:

getPos = each.getPosition()

em.addParticle(getPos, Vector.new(0.0,0.0,0.0))

em.export()

em.removeAllParticles()

User avatar
tsn
Posts: 928
Joined: Fri Oct 27, 2006 10:36 am

Re: Scatter

Post by tsn » Wed Dec 16, 2020 5:07 pm

You might want to try it this way:

Code: Select all

ob    = scene.getObject("GeoSphere001")
em    = scene.get_PB_Emitter("Circle01")
verts = ob.getVertices(REF_GLOBAL)

em.removeAllParticles()

for each in verts:
	getPos = each.getPosition()
	em.addParticle(getPos, Vector.new(0.0,0.0,0.0))

em.export()
The last line is only necessary when the script is run as a batch script. If it's a simulation script export is being done by RF automatically. And don't forget to set the circle emitter's particle type to dumb ;)

Post Reply

Return to “Python-Scripting”