wezelboy Posted June 15, 2007 Share Posted June 15, 2007 Is there a way of flipping a single object other than FlipHor and FlipVer? I don't want to be messing with my selection set while running my script. I'm hoping for something like HMove or HRotate, except for flipping. -P Quote Link to comment
ccroft Posted June 16, 2007 Share Posted June 16, 2007 (edited) Wezel There's been a few times when I've wanted HThis or HThat when there's only things available that work based on selection. One way of getting around this kind of problem is to load an array with the handles of all the selected objects, deselect everything, traverse the array applying a procedure to each object handle, and then traverse again to reselect the set of objects. One of the first calls in that procedure is SetSelect(h), and one of the last will be SetDSelect, if you see what I mean. I don't know if this constitutes messing with the selection set...maybe it does. When the script's done you still have all the same objects selected. Charles Edited June 16, 2007 by ccroft Quote Link to comment
MullinRJ Posted June 16, 2007 Share Posted June 16, 2007 If you don't want to mess around with arrays, you can move the object into a temporary container (symbol / group / layer) with SetParent and flip it there, then move it back and delete the container (or leave it if you intend to use it again). Raymond Quote Link to comment
ccroft Posted June 16, 2007 Share Posted June 16, 2007 (edited) Hi Ray I guess I must really be attracted to arrays for some reason. I think this is the second or third time on this list that I've suggested something that involves arrays, and somebody else has a different way. When you do it your way, and you put the object in a group, how do you typically edit the group? I ask because I'm constantly working inside groups that already exist, and this is in fact what led me to my solution. To add an object to a group I've been using DoMenuText to edit, and that requires selection. Is there a better way? My way looks like this: PROCEDURE EG; VAR index :INTEGER; hBin :ARRAY[1..100] of HANDLE; FUNCTION loadBin(h:HANDLE): BOOLEAN; Begin index:=index+1; IF GetType(h)=11 THEN hbin[index]:=h; End; PROCEDURE DrawInGroup(hGroup:HANDLE); Begin SetSelect(hGroup); DoMenuTextByName('Group Navigation Chunk',1); {work inside the group} DoMenuTextByName('Group Navigation Chunk',2); SetDSelect(hGroup); End; BEGIN index:=0; ForEachObjectInLayer(loadBin,2,0,2); DSelectAll; index:=1; WHILE hBin[index]<>NIL DO Begin DrawInGroup(hBin[index]); index:=index+1; End; index:=1; WHILE hBin[index]<>NIL DO Begin SetSelect(hBin[index]); index:=index+1; End; END; RUN(EG); Thanks for any suggestions. Charles (Edit) Just looked at SetParent for the first time in my life.....I think I see the light. Discussion forums are good. Edited June 16, 2007 by ccroft Quote Link to comment
MullinRJ Posted June 18, 2007 Share Posted June 18, 2007 Hi Charles, I think this is the second or third time on this list that I've suggested something that involves arrays, and somebody else has a different way. There's always another way. It's not necessarily better, just different. When you do it your way, and you put the object in a group, how do you typically edit the group? In this case, I'd opt for a temporary layer and do my flipping there, using SetParent to move it back and forth. I only mentioned working in a group or a symbol to show possibility, not preference. If stacking order is an issue (as it often is) I also remember where it is in the stack and push it back when done, which can be done by remembering an adjacent handle. To work inside groups I use FIn3D (FInGroup also works) to get a handle to an object inside, then navigate from there. The list inside the group is self-contained, so it's no different from working on any layer with handles. I don't typically enter a group with DoMenuTextByName (aka DMTBN), but if I want to display the contents of the group, I think using DMTBN then RedrawAll is the only way. Raymond Quote Link to comment
wezelboy Posted June 18, 2007 Author Share Posted June 18, 2007 Thanks for the suggestions! Both of these will work. -P Quote Link to comment
ccroft Posted June 19, 2007 Share Posted June 19, 2007 Glad it helped. Posting here provided a nice reward for me as well. For the benefit of any onlookers or future searchers I thought I'd quickly explain my journey. I have a number of menu commands for editing existing components of existing groups. Nested While loops and FEOIL works fine for this. I ran into trouble when I wanted to add some new components. FEIOL set to go into groups left the new objects outside the group. The only thing I could find was DMTBN(edit). That worked on one selected group, but like FEOIL didn't put the new object in the group if more than one group was selected. I said good enuf...I'll only select one at a time and set the properties accordingly. A few years go by and I decide I need to solve this...too much wasted time. Hence the somewhat complicated bit posted above. More time goes by. Raymond mentions groups and SetParent. "Is that the way it's supposed to be?" Now the above looks something like this: FUNCTION addToGroup(hGroup:HANDLE):BOOLEAN; Begin {draw what needs to be added} boo:=SetParent(LNewObj,hGroup)); End; Begin ForEachObjectinLayer(addToGroup,2,1,2); End; Not only is it easier to manage, it visibly runs better on larger numbers of groups. So once again, thanks to the forum and thank-you Raymond. Raymond: I'm pretty familiar with FInGroup: "How the fsk am I supposed to get this f'n rectangle inside this F'NGroup anyway?" later c Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.