Reputation: 11
I want to create a new file every iteration in a macro code.
I tried to enter a count variable into the file name, but it isn't interpreted like a variable.
(define xStart -10 )
(define xFinish 10 )
(define xIncrement 8 )
(define yStart -10 )
(define yFinish 10 )
(define yIncrement 8 )
(define count 0 )
(do ( (xValue xStart (+ xValue xIncrement ) ) )
( (> xValue xFinish ) xValue )
(do ( (yValue yStart (+ yValue yIncrement ) ) )
( (> yValue yFinish ) yValue )
(+ count 1)
(edit:move (entity:get-by-name "source") xValue yValue -50)
(raytrace:all-sources)
(edit:select (cadr (entity:faces (entity:get-by-name "Block 1"))))
(analysis:irradiance)
(analysis:irradiance-save "Z:/shadow/maps/.txt")
(analysis:irradiance-close)
(display: count)
)
)
Upvotes: 1
Views: 35
Reputation: 23876
The function number->string
converts a number into a string. And the function string-append
appends strings.
(analysis:irradiance-save (string-append "Z:/shadow/maps/"
(number->string count)
".txt"))
But (+ count 1)
does nothing. You have to set count
to the new value.
(set! count (+ count 1))
Upvotes: 2