我想在宏代码中的每次迭代中创建一个新文件。
我试图在文件名中输入一个count变量,但它不像一个变量那样被解释。
(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)
)
)
答案 0 :(得分:2)
函数number->string
将数字转换为字符串。函数string-append
附加字符串。
(analysis:irradiance-save (string-append "Z:/shadow/maps/"
(number->string count)
".txt"))
但是(+ count 1)
什么也不做。您必须将count
设置为新值。
(set! count (+ count 1))