Jump to content
Developer Wiki and Function Reference Links ×

Handle to a selected PIO in a wall


Petri

Recommended Posts

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 by Petri
Link to comment

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 by Gerard Jonker
Link to comment

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).

Link to comment

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.

Link to comment

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.

Link to comment

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 by Gerard Jonker
Link to comment

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.)

Link to comment

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...