Petri Posted November 17, 2007 Share Posted November 17, 2007 (edited) How does one get a handle to a selected PIO in a wall? Eg. a door. If I select the door, FSACTLAYER is the wall. No variation of handle handling does not seem to work, so obviously this is very obvious to everyone but I. Edited November 17, 2007 by Katie Quote Link to comment
Petri Posted November 17, 2007 Author Share Posted November 17, 2007 (edited) Hey, Katie - just get the List Nazi to allow me to subscribe! What is inappropriate is that a top expert like yours truly is not allowed to subscribe to your mailing lists. In fact, it is even counter-productive: if I wasn't censored, the unpleasant truths would stay in the family, instead of being in public view. Anyway, Katie's editing of my post is a brilliant example of the censorship mentality of NNA's politruks. EDIT (for the record): I used the term List Nazi, which was deleted by Katie Roberts. Edited November 17, 2007 by Petri Quote Link to comment
Gerard Jonker Posted November 17, 2007 Share Posted November 17, 2007 (edited) The handle isn't easily found. From the top of my head, not tested: if (gettype(fsactlayer) = 68) or (gettype(fsactlayer) = 89) then begin hd := fin3d(fsactlayer); if not selected(hd) then begin hd:=nextsobj(hd); end; if hd <> nil then message(concat(hd,' = the door!')); end; This code is only for VW < 2008 in VW 2008 you can select multiple doors, so you will have to store the handles in an array. Edited November 17, 2007 by Gerard Jonker Quote Link to comment
Gerard Jonker Posted November 17, 2007 Share Posted November 17, 2007 (Wanted Dead or Alive.) You may have to consider the possibility, they want you "Dead Nor Alive" Sorry, sorry. Quote Link to comment
Petri Posted November 17, 2007 Author Share Posted November 17, 2007 I don't know how to establish which PIO is the one the user has selected. (I think they want me dead. I am constantly demonstrating that VW is not a good CAD-program.) Quote Link to comment
ccroft Posted November 17, 2007 Share Posted November 17, 2007 Not a wall and door kind of guy, but it seems that Gerard's script would work. I believe a wall is a parent/container. You get a handle to that with FSact even though the wall itself isn't selected. You get a handle to the first object in the wall with Fin3D. If this object is not selected you move on to the first selected object with NextSObj. Just ignore the fact that the PIO appears selected in the drawing while the wall itself does not. You already know how to get the handle to the wall. Or maybe you can use ForEachInList or a While loop to traverse the objects in the wall until you find the correct one. You could use properties to prohibit multiple selection and make the find easier (with appropriate help strings). Quote Link to comment
Petri Posted November 18, 2007 Author Share Posted November 18, 2007 I still can't test for the selection status of the PIO. (I'm getting a bit frustrated...) If I have the wall selected and say "MESSAGE(COUNT(SEL=TRUE));", I get 1. If I have one PIO in the wall selected, I get 2; if two PIOs, I get 3. So far, so good. The PIOs are counted as selected. However, if I run this: PROCEDURE SelectedPIOinWall; VAR thePIO, theWall : HANDLE; theType : INTEGER; BEGIN theWall := FSACTLAYER; thePIO := FIN3D(theWall); WHILE thePio <> NIL DO BEGIN IF (GETTYPE(thePIO)= 86) THEN MESSAGE(SELECTED(thePIO)); thePIO := NEXTOBJ(thePIO); END; END; RUN(SelectedPIOinWall); I get "FALSE" every time. Quote Link to comment
Gerard Jonker Posted November 18, 2007 Share Posted November 18, 2007 (edited) Change MESSAGE(SELECTED(thePIO)); to AlrtDialog(concat(SELECTED(thePIO))); and you will see it works. Edited November 18, 2007 by Gerard Jonker Quote Link to comment
Petri Posted November 18, 2007 Author Share Posted November 18, 2007 How odd... Actually this was needed: PROCEDURE SelectedPIOinWall; VAR thePIO, theWall : HANDLE; theType : INTEGER; isSelected : STRING; BEGIN theWall := FSACTLAYER; thePIO := FIN3D(theWall); WHILE thePio <> NIL DO BEGIN IF (GETTYPE(thePIO)= 86) THEN BEGIN IF SELECTED(thePIO) THEN isSelected := 'Selected' ELSE isSelected := 'Not selected' ; MESSAGE(isSelected); END; thePIO := NEXTOBJ(thePIO); END; END; RUN(SelectedPIOinWall); Thanks, Gerard! This may eventually lead to something useful. I mean if it actually works. Quote Link to comment
Gerard Jonker Posted November 18, 2007 Share Posted November 18, 2007 (edited) You are still using MESSAGE. That means that the first selected PIO set the message to TRUE, then the next one, that may be not selected, sets it back to FALSE. The message is updated so fast that you don't see the TRUE. Hence my suggestion to use ALrtdialog, the code freezes with every dialog and only continues when you hit OK. Edited November 18, 2007 by Gerard Jonker Quote Link to comment
Petri Posted November 18, 2007 Author Share Posted November 18, 2007 Copy & paste error... VW 2008 crashed, as usual (happens easily 10 times a day when writing scripts.) I had that version on the clipboard. However, the superfluous calculation seems to make all the difference - it works even with Message. (Manuel (he's from Barcelona): I have a massage for you.) Quote Link to comment
Gerard Jonker Posted November 18, 2007 Share Posted November 18, 2007 Si, senor Faulty! 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.