- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
create sphere from names in text file with this format
PlayerHouse_Shower01001|10|0|0|0|12
clearlistener()
adata = (dotnetClass "System.IO.File").ReadAllLines @"C:\test.txt"
for i = 1 to adata.count do
(
pInfo = (filterString adata[i] "|")
print pInfo
s = sphere segments:(pInfo[6] as integer)
s.radius = pInfo[2] as integer
s.pos = [pInfo[3] as integer,pInfo[4] as integer, pInfo[5] as integer]
s.name = pInfo[1]
)
move/rotate/scale objects from csv with this format
Name Position Rotation Scale
PlayerHouse_Shower01001,-80331.0938,90976.4297,7857.2979,0.0000,-0.0000,230.8562,1.0000
TreeMaplePreWar01Gr001,-99744.5547,77048.9453,10398.3457,0.6550,-0.6280,269.8729,0.9100
(
file = memStreamMgr.openFile @"C:\test.csv"
while NOT file.eos() do
(
local line = filterString (file.readLine()) ","
if line.count == 8 AND isValidNode (local obj = getNodeByName line[1]) do
obj.pos = [line[2] as float, line[3] as float, line[4] as float]
if line.count == 8 AND isValidNode (local obj = getNodeByName line[1]) do
obj.rotation = eulerAngles (line[5] as float) (line[6] as float) (line[7] as float)
if line.count == 8 AND isValidNode (local obj = getNodeByName line[1]) do
obj.scale = [line[8] as float, line[8] as float, line[8] as float]
)
memStreamMgr.close file
)
I wanted to modify the scripts above to save a max file, based on a csv file name that the script reads.
I've got hundreds of files with different names test.csv for example. the code should do the following
read file test.csv
create one object per name from the csv file, PlayerHouse_Shower01001 TreeMaplePreWar01Gr001...etc (can be a sphere/dummy/box)
run the script code position/rotation/scale
save test.max (Based on read csv filename)
reset
read next csv file
repeat until end of files
If anybody can help give me some examples or help me figure out how to do this I would appreciate it. Thankyou
Solved! Go to Solution.