The original question was a proposal to include a function in imagine to replace all points of an object with another object: Date: Sun, 11 Jan 1998 14:34:17 -0500 From: Richard Mattsson On further investigation, my test with the '4/4 section' primitive sphere as a template for the ARexx point replacement seems to indicate it behaves differently if the Detail editor is in Group mode or in Object mode when a copy of the sphere object is pasted. (This sphere had been scaled up from the default size. I decided to try an unscaled object, and discovered a different result, also!) Indicating which points appear to be correctly read (and used to position the newobject): Object Mode Group Mode Both Modes (scaled up) (scaled up) (not scaled) POINT X X X POINT.1 X X X POINT.2 X X X POINT.3 X X X POINT.4 X X X POINT.5 POINT.6 X X POINT.7 X POINT.8 X X X POINT.9 X X X POINT.10 X X X POINT.11 X X X POINT.12 X X X POINT.13 I wonder if it's an obscure 'feature' in the GETGEOMETRY command? Is there a way to directly read the variables written by the GETGEOMETRY command? --------------------------------- Date: Sun, 11 Jan 1998 18:38:39 -0500 From: "Ash R. J. Wyllie" There seems to be a problem with transform. It seems that too many digits to the right of the decimal point screws things up. Try using trunc(var,4). --------------------------------- Date: Sat, 10 Jan 1998 22:20:19 -0500 Ash R. J. Wyllie wrote: > getgeometry > delete /* I assume that you don't need the object anymore...*/ > do i=1 to PNT_NUM > loadobject "whatever" /* I didn't see copy/paste */" > pick select > transform_translate PNT_Xi PNT_Y.i PNT_Z.i > end Okay, I got a chance to play a little. Caught the 'PNT_Xi' typo... (should be 'PNT_X.i' of course.) Thanks! This might be pretty useful for a 'particle object generator' for those situations where there are subgroups, etc. However, try this: As my first test object, I used a primitive sphere with 4 circle sections and 4 vertical sections (14 points.) For some reason, the GETGEOMETRY command doesn't seem to work on all the points. I get the first 5 OK, then several which don't work, and then a couple more which work, and then the last few fail as well (I think.) Any ideas? Otherwise, this looks like fun. (Wait, I just re-tried this, and all but *one* of the points received a replacement object correctly... strange. BTW, I commented out the 'delete' line so I could verify the operation.) -------------------------------- Date: Sun, 11 Jan 1998 15:14:37 -0500 From: "Ash R. J. Wyllie" At first glance, I thought it was negative numbers. Then maybe transform wouldn't translate beyond an earlier operation. What seems to be working now is to use *trunc(PNT_?,4)*. Not as bad as I thought earlier but still a bug. --------------------------------- Date: Sun, 11 Jan 1998 13:20:39 -0500 From: "Ash R. J. Wyllie" I cleaned the script up a bit and generalized it a bit. -- /* addobj.irx */ address "Imagine.1" /* from screwthread.irx */ IF ~EXISTS('LIBS:rexxreqtools.library') THEN DO NOTIFY 'Please install the rexxreqtools.library in your LIBS: directory' NOTIFY 'It is available from /pub/aminet/util/rexx/RexxReqTools.lha' exit END CALL ADDLIB('rexxreqtools.library',0,-30,0) PNT_NUM = 0 getgeometry getaxisinfo if PNT_NUM = 0 then exit rid = rtezrequest("Keep your object?","Yes|No",,'rt_pubscrname = "Imagine"') if rid = "No" then delete newobj = rtfilerequest(,,"Object to Add",,'rt_pubscrname = "Imagine"',maybe) if ~maybe then exit address command 'copy 'newobj' to ram:obj' displayrexxptr on addaxis pick select getattributes axisName = ATTRIB.OBJECTNAME transform_translate AXIS_POSITION_X AXIS_POSITION_Y AXIS_POSITION_Z transform_alignment AXIS_ALIGNMENT_X AXIS_ALIGNMENT_Y AXIS_ALIGNMENT_Z do i=1 to PNT_NUM loadobject "ram:obj" pick select address command 'wait sec 1' say PNT_X.i PNT_Y.i PNT_Z.i /* for some reason transform translate */ /* does not like negative numbers */ transform_translate PNT_X.i PNT_Y.i PNT_Z.i getattributes unpick multipickon pick axisName pick ATTRIB.OBJECTNAME multipickoff group end address command 'delete ram:obj quiet' displayrexxptr off exit -- transform translate does not like negative numbers at the moment. A bug? --------------------------------- Date: Mon, 12 Jan 1998 09:13:32 -0500 From: Richard Mattsson Ash R. J. Wyllie wrote: > I cleaned the script up a bit and generalized it a bit. Hey, this looks slick! Thanks, I'll try this out right away! (As long as work doesn't come in!) > transform translate does not like negative numbers at the moment. A > bug? Hmmm... I guess the position of the 'template' object needs to be in the positive 'octant' of 3D space, then. And later: >> For some reason, the GETGEOMETRY command doesn't seem to work on all >> the points. I get the first 5 OK, then several which don't work, > At first glance, I thought it was negative numbers. Then maybe > transform wouldn't translate beyond an earlier operation. What seems > to be working now is to use *trunc(PNT_?,4)*. Not as bad as I thought > earlier but still a bug. Pardon me, (maybe I'm dense...) where do you use 'trunc(PNT_?,4)'? (Oops, or are the '*' characters supposed to be included as well, not just for emphasis in your post? Thanks again! Good job. I nominate this for inclusion on some of the ARexx script pages out there... --------------------------------- Date: Mon, 12 Jan 1998 18:16:33 -0500 From: "Ash R. J. Wyllie" *transform_translate trunc(PNT_X.i) trunc(PNT_Y.i) trunc(PNT_Z.i)* I changed it in my im50/rexx drawer, and forgot that others hadn't seen what I was running. When programming I tend to get confused over trees and forests. The transform_#? commands seem to have a problem. Relative commands (like rotate) don't work very well. I just found a bug :). Change the 'translate' parts to 'position'. To the extent that translate works it is because the objects are being loaded at 0,0,0. Moving an object x,y,z units becomes the same as putting the object at x,y,z. --------------------------------- Date: Tue, 13 Jan 1998 10:36:49 -0500 From: Richard Mattsson Hey! It works! It works! :-) This is really cool! Thanks so much, Ash! (Is the 'trunc' statement a general ARexx modifier? Just goes to show how little I'd have been able to do in this regard myself...) It works! (Too bad *I* have to get to work this morning... the money kind, I mean!) > The transform_#? commands seem to have a problem. Relative commands > (like rotate) don't work very well. Hmm... interesting. So 'absolute' commands (like alignment) tend to work better? Good to keep in mind for future scripts. > I just found a bug :). Change the 'translate' parts to 'position'. To > the extent that translate works it is because the objects are being > loaded at 0,0,0. Moving an object x,y,z units becomes the same as > putting the object at x,y,z. Aha! That explains what happened when I used an object which had been 'snapshotted'! (Everything was offset...) I hope someone else is as excited by this as I am. I'll post the complete script here (with the changes we discussed) so you can see what I understand from your posts, and so that others can use the script now 'as is'. Thanks again! Good job! --- CUT --- /* addobj.irx */ address "Imagine.1" /* from screwthread.irx */ IF ~EXISTS('LIBS:rexxreqtools.library') THEN DO NOTIFY 'Please install the rexxreqtools.library in your LIBS: directory' NOTIFY 'It is available from /pub/aminet/util/rexx/RexxReqTools.lha' exit END CALL ADDLIB('rexxreqtools.library',0,-30,0) PNT_NUM = 0 getgeometry getaxisinfo if PNT_NUM = 0 then exit rid = rtezrequest("Keep your object?","Yes|No",,'rt_pubscrname = "Imagine"') if rid = "No" then delete newobj = rtfilerequest(,,"Object to Add",,'rt_pubscrname = "Imagine"',maybe) if ~maybe then exit address command 'copy 'newobj' to ram:obj' displayrexxptr on addaxis pick select getattributes axisName = ATTRIB.OBJECTNAME transform_position AXIS_POSITION_X AXIS_POSITION_Y AXIS_POSITION_Z transform_alignment AXIS_ALIGNMENT_X AXIS_ALIGNMENT_Y AXIS_ALIGNMENT_Z do i=1 to PNT_NUM loadobject "ram:obj" pick select address command 'wait sec 1' say PNT_X.i PNT_Y.i PNT_Z.i /* for some reason transform translate */ /* does not like negative numbers */ transform_position trunc(PNT_X.i) trunc(PNT_Y.i) trunc(PNT_Z.i) getattributes unpick multipickon pick axisName pick ATTRIB.OBJECTNAME multipickoff group end address command 'delete ram:obj quiet' displayrexxptr off exit --- CUT --- I tried using DISPLAYSTOPREDRAW throughout this script, but I wasn't able to totally eliminate the redraws. It saved some time, but there's still a step which is redrawing the display I can't seem to get rid of. --------------------------------- Date: Tue, 13 Jan 1998 18:49:12 -0500 From: "Ash R. J. Wyllie" >This is really cool! Thanks so much, Ash! (Is the 'trunc' statement a >general ARexx modifier? Just goes to show how little I'd have been able >to do in this regard myself...) trunc() is one of the built in functions. If you wish to become a programmer you should do two things. 1) See a shrink. Maybe he can talk you out of this insane notion. If that doesn't work. 2) sit down and read the Arexx manual and the documentation for the various #?rexx#?.libraries that are on aminet. Try to remember all the fns, and what they do. 3) go back to the shrink (if you can find the time... :)). --------------------------------- Date: Sat, 17 Jan 1998 00:59:16 EST From: AOLTechJOE In a message dated 98-01-16 23:39:35 EST, you write: > All right, Chuck, where's your page? (I was all set to fly there and > scarf down everything,--but there was no url on your note). Oops, sorry, I am so used to using YAM at home that sometimes I don't add my sig when using AOL at work. http://www.azstarnet.com/~midian Nothing for Imagine yet (still learning the commands and updating the Imagine.guide from 3.0 to 5.0) Imagine Render contest - http://www.azstarnet.com/~midian/Imagine/ --------------------------------- Date: Sat, 17 Jan 1998 15:39:23 -0800 From: Mike McCool On Sat, 17 Jan 1998, AOLTechJOE wrote: > Back on topic, how does the finished script look? Is it available on > Aminet/web page? Richard Mattsson posted the script back here a couple' days ago, with all the discussed changes/additions. Ain't had a chance to try it yet, but I did d'load it. Lemme know if you can't find it (since I know you must archive ALL iml posts) and I'll forward it to you. (Oh and btw, thanks, Chuck, for re-posting your website, so we can all come and share your rexx scripts). http://www.efn.org/~mikemcoo http://www.geocities.com/SoHo/lofts/9794