PDA

View Full Version : Error in CSV reading script


AyTrane
04-18-2012, 03:15 PM
I'm getting an error in the "theDummy.position.controller.percent = (readValue theFile)" line: "Unknown Property: "Position" in undefined". I have tried using .pos as well and keep getting the error.

What I'm trying to do is read a CSV file that I've calculated the "Time" and "Percent" along a path with. This script should automatically insert those values in the animation, but obviously I'm getting an error. Any ideas?

(--start a local scope.
--pick the file:
local theFilename = getOpenFileName types:"Comma Separated Values (*.CSV)|*.CSV|All Files (*.*)|*.*"
if theFilename != undefined do ( --if a valid filename picked,
local theFile = openFile theFilename --open the file
local theDummy = Dummy005 --set dummy
while not eof theFile do ( --loop until the end of tile
theTime = (readValue theFile) --read the time
with animate on --enable autokey animation context
at time theTime --set the current time for the following expression
theDummy.position.controller.percent = (readValue theFile)
)--and read the percent from the file for each time step
close theFile --close the file when done
)--end if
)--end script

Pjanssen
04-18-2012, 03:19 PM
I think you forgot a dollar sign ($) in this line:
local theDummy = Dummy005 --set dummy
Assuming that an object named Dummy005 exists, it should be:
local theDummy = $Dummy005 --set dummy

denisT
04-18-2012, 03:23 PM
(--start a local scope.
--pick the file:
local theFilename = getOpenFileName types:"Comma Separated Values (*.CSV)|*.CSV|All Files (*.*)|*.*"
if theFilename != undefined do ( --if a valid filename picked,
local theFile = openFile theFilename --open the file
local theDummy = $Dummy005 --set dummy
while not eof theFile do ( --loop until the end of tile
theTime = (readValue theFile) --read the time
with animate on --enable autokey animation context
at time theTime --set the current time for the following expression
theDummy.position.controller.percent = (readValue theFile)
)--and read the percent from the file for each time step
close theFile --close the file when done
)--end if
)--end script

hopefully it fixed your problem

oops. i'm late...

AyTrane
04-18-2012, 03:54 PM
That was it, thanks a lot! Simple mistake, easy fix.

CGTalk Moderation
04-18-2012, 03:54 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.