well I am kinda busy atm but I can look into it and see how hard it would be do you have any specific info on how it interfaces with computer already?
Hi, well im really lost, i cant find the way to do that, please merlin if you have some time i would aprecciate a lot some help./ i know you have a lot of work but i dont think ill solve it without any help… tx again
Hi Juan
The sctipt witch I send u last, works fine. I tested it.
rollout xxx "" width:249 height:147
(
local filePath = "c:\ emp\\scan.dat"
local lastDataPosition = 0, oldModSize = 0, newSpline, scanNewSpline
Timer tmr1 "Timer" pos:[17,16] width:24 height:24 interval:400--40
fn createLineFrom filePath =
(
local f = openFile filePath mode:"r"
seek f lastDataPosition -- continue on last pos
if not eof f do
(
local theLine = readLine f
lastDataPosition = (filePos f) + 3
format "theLine:% filePos:%
" theLine lastDataPosition
if findString theLine "end" != undefined then -- case sensitive (u can avoid findString to be more faster)
(
print "spline create end"
/*
if scanNewSpline != undefined do
(
if (queryBox "u like to close shape?") do close scanNewSpline 1
)
*/
)
else if findString theLine "start" != undefined then
(
newSpline = true
)
else
(
local val = execute theLine
if classOf val == Point3 do
(
if newSpline == true
then
(
print "create new line"
scanNewSpline = SplineShape pos:val
addNewSpline scanNewSpline
addKnot scanNewSpline 1 #corner #line val
newSpline = false
)
else if scanNewSpline != undefined do
(
print "add vert"
addKnot scanNewSpline 1 #corner #line val
updateshape scanNewSpline
)
)
)
)
format "newSpline:% filePos:%
" newSpline lastDataPosition
flush f
close f
--format "scanNewSpline:%
" scanNewSpline
--if scanNewSpline != undefined do (updateshape scanNewSpline; scanNewSpline = undefined)
)
fn needUpdate =
(
if not doesFileExist filePath do return false
if oldModSize == undefined
then oldModSize = getFileSize filePath
else newModSize = getFileSize filePath
local mode = oldModSize < newModSize
oldModSize = newModSize
return mode
)
on tmr1 tick do
(
--print "tick"
if needUpdate() do
(
print "create"
createLineFrom filePath
)
)
)
createDialog xxx
how to use:
- run script in max.
- create a file “c:\ emp\scan.dat”
- start – save file (create new spline)
- [1,1,1] – save file (create vertex)
- [2,2,2] – save file (create vertex)
- end – save file (end spline)
etc…
If u do it manualy:
when you save, the cursor must be in same line where is the word.
try this and let me know if u need hep
:D!! it works… i created the first lines with the arm this is awsome :)!! tx Rene. I think you will hate me after this but the last problem is to create a line in this case.
- run script in max.
- create a file “c:\ emp\scan.dat”
- start – save file (create new spline)
- [1,1,1] – save file (create vertex)
[2,2,2]
[3,3,3]
[4,4,4]
[5,5,5]
[6,6,6]– save file (create vertex)
5) end – save file (end spline)
etc…
The proces of reading tata is:
in circle: (eof)
- skip to “last positinon” in file
- read next line
- if the next line is data then insert new verex
- set the “last position”
try it again ,becose with this loop works for both situation.
A)
[1,2,0] –save
[1,3,0] –save
[1,4,0] –save
B)
[1,2,0]
[1,3,0]
[1,4,0] –save
it creates just the first data it finds… like in this example it created the 3,3,3 but not the 4,4,4…
– Syntax error: at ), expected <factor>
– in line: 4,4
start – save
[1,1,1] – save
[2,2,2] – save
[3,3,3]
[4,4,4] – save
end – save ERROR
thats what the maxscript listener tell
theLine:[3,3,3] filePos:37
"add vert"
newSpline:false filePos:37
"create"
theLine:4,4] filePos:46
-- Error occurred during fileIn in StringStream:"4,4]"
-- Error occurred in createLineFrom()
-- Frame:
-- val: undefined
-- theLine: "4,4]"
-- f: <File:c: emp\scan.dat>
-- filePath: "c: emp\scan.dat"
-- called in tmr1.tick(); filename: C:\Documents and Settings\lolec\Desktop\brazo-script\scan_v0.05; position: 2791
-- Frame:
>> MAXScript Rollout Handler Exception: -- Syntax error: at ),, expected <factor>
-- In line: 4,4 <<
Oki I understand.
When i have some time , I wil repair this bug.
se you Juan
Here you are:
rollout xxx "" width:249 height:147
(
local filePath = "c:\ emp\\scan.dat"
local lastFilePos = 0, oldModSize = 0, newSpline = false, scanNewSpline
Timer tmr1 "Timer" pos:[17,16] width:24 height:24 interval:400--40
fn createLineFrom filePath =
(
local f = openFile filePath mode:"r"
seek f lastFilePos -- continue on last pos
if lastFilePos > 2 do skipToNextLine f -- go to next line
while not eof f do
(
local theLine = readLine f
format "theLine:% lastFilePos:%
" theLine lastFilePos
if theLine == "end" then -- case sensitive (beware! no spaces in this line)
(
print "Spline creation end"
/*
if scanNewSpline != undefined do
(
if (queryBox "u like to close shape?") do close scanNewSpline 1
)
*/
)
else if theLine == "start" then
(
print "Spline creation start"
newSpline = true
)
else
(
local val = execute theLine
if classOf val == Point3 do
(
if newSpline == true
then
(
format "create new line in %
" val
scanNewSpline = SplineShape pos:val
addNewSpline scanNewSpline
addKnot scanNewSpline 1 #corner #line val
newSpline = false
)
else if scanNewSpline != undefined do
(
print "add vert"
addKnot scanNewSpline 1 #corner #line val
updateshape scanNewSpline
)
)
)
)
lastFilePos = filePos f
format "newSpline:% filePos:%
" newSpline lastFilePos
flush f
close f
--format "scanNewSpline:%
" scanNewSpline
)
fn needUpdate =
(
if not doesFileExist filePath do return false
if oldModSize == undefined
then oldModSize = getFileSize filePath
else newModSize = getFileSize filePath
local mode = oldModSize < newModSize
oldModSize = newModSize
return mode
)
on tmr1 tick do
(
--print "tick"
if needUpdate() do
(
print "Updating..."
createLineFrom filePath
)
)
)
createDialog xxx
its phisicaly working now ! WOW ill post a video as soon as possible good day.