Notifications
Clear all

[Closed] Pflow update problem

I figured that it would be better for me to post here instead of Pflow forum as this is script related.

I need to output data from a pflow with a script I’m writing. I am writing out a file per frame including all of the particles in each file and sadly all of the data in the files is the same as each other as though there is no updating happening as it’s being written. I have the script changing the time slider in max as it goes and it is visibly updating in the view as it writes out the files but it doesn’t seem to be able to get the transform of particles from any frame other than the start frame.

Any tips?

:banghead:

Cheers,
Cg.

12 Replies

any code example of what you are doing?

Indeed. This is just the chunk that deals with changing the frame and getting the transforms and writing to file. There’s obviously variables/paths/functions defined in other chunks of the code that I’ve not included here.

Thanks for looking at this

		for i = 1 to spn_fileCount.value do
				(
					dataFilename = @"" + testFilePath + testFileName + (stringIt i 4) + ".csv"
					local dataFile = createfile dataFilename
					
-- 					local dataFileHeader = "Position[0], Position[1], Position[2], Velocity[0], Velocity[1], Velocity[2]"
-- 					format "%
" dataFileHeader to:dataFile
					slidertime = i
					for j = 1 to (PFsource.numparticles()) do
					(
						partPos = (PFsource.getParticleTM j).row4
						for k = 1 to 3 do
						(
							format "%" partPos[k] to:dataFile
							if k < 3 then format "," to:dataFile
							else format "
" to:dataFile
						)
					)
					close dataFile
				)

is PF_Source your made?

I did manually make the PFsource. It’s finding the PfSource ok, no errors. It just doesn’t seem to update internally so when I get the particle transforms, they’re all as it was on frame 1

I’ve used the .getParticleTM quite well in the past in a scripted transform for geometry objects.

Cg.

Below is an extremely cut down version that still has the issue. All you need to do it make a pflow with the name PFSource001 and make sure the particles are moving. It will output the position of particle 1 from frame 1 to 10 to the listener.


(
	pfSource = getNodeByName "PFSource001"
	for i = 1 to 10 do
	(
		slidertime = i
		format "particle 1 position on frame %: %
"i (pfSource.getParticleTm 1).row4
	)
)

ha-ha-ha… i’m looking at max 2014. all about a particle position (current particle state) seems like broken.

my old methods from archive don’t work. they all return now an initial particle’s state instead of current.

i could forget something… or something was changed in the system.

guys! please take a look! i really like to know who is broken. me or the system?

(as a workaround i would add test action and collect data from (with) it)

ok. i’m not broken.

it was working as:

(
	pfSource = getNodeByName "PFSource001"
	for t = 1 to 10 do at time t
	(
		format "particle 1 position on frame %: %
" t (pfSource.getParticleTm 1).row4
	)
)

now it doesn’t work
the work around is

(
	pfSource = getNodeByName "PFSource001"
	for t = 1 to 10 do
	(
		pfSource.updateParticles pfSource t
		format "particle 1 position on frame %: %
" t (pfSource.getParticleTm 1).row4
	)
)

Yeah I’m also using max 2014. I’ve left work for the day. I’ll have to check if that works in the morning. Thanks Dennis.

Cg.

Page 1 / 2