home *** CD-ROM | disk | FTP | other *** search
- /* CMD: Particle Clone
- *
- * Clones active layer data at offsets given by points in background
- * layers.
- */
- mxx="LWModelerARexx.port"
- signal on error
- signal on syntax
- mxx_add = addlib(mxx,0)
- call main
- if (mxx_add) then call remlib(mxx)
- exit
-
- syntax:
- error:
- t=Notify(1,'!Rexx Script Error','@'ErrorText(rc),'Line 'SIGL)
- if (mxx_add) then call remlib(mxx)
- exit
-
-
- MAIN:
-
- syscode = "Particle Clone"
- tmpnam = "t:pclone.tmp"
-
-
- /* Store current and background layers.
- */
- fg = curlayer()
- bg = curblayer()
-
-
- /* Use xfrm mode to scan through points, storing coordinates to tmp file.
- */
- if (~open(plist, tmpnam, 'W')) then return
-
- call setlayer(bg)
- n = xfrm_begin()
- if (n = 0) then do
- call close(plist)
- return
- end
-
- call meter_begin(n, syscode, "Reading Points")
- do i=1 to n
- call writeln(plist, xfrm_getpos(i))
- call meter_step()
- end i
- call meter_end()
- call xfrm_end()
-
- call close(plist)
-
-
- /* Read the point coordinates back in and replicate fg data using
- * their positions as offsets.
- */
- if (~open(plist, tmpnam, 'R')) then return
-
- call setlayer(fg)
- call repl_begin(COPY)
- call meter_begin(n, syscode, "Generating Clones")
- do i=1 to n
- call repl_step(readln(plist), 1, 0)
- call meter_step()
- end i
- call meter_end()
- call repl_end()
-
- return
-