Jump to content
Developer Wiki and Function Reference Links ×

Selecting PIO Objects in Walls


David O

Recommended Posts

Hello, David.

   HINT: Pat's second suggestion is what you need. Try this code snippet. No error checking is done, so you'll have to add your own.

 

PROCEDURE xxx;
{ Report the type and the PIO Name of a selected wall item. }
VAR
	H, subH :Handle;
	B :Boolean;
	I :Integer;
	P :Vector;
BEGIN
	GetPt(P.x, P.y);
	B := GetPickObjectInfo(P.x, P.y, H, subH, I);
	message(GetTypeN(subH), '  ', GetName(GetParametricRecord(SubH)));
	SysBeep;
END;
Run(xxx);

 

HTH,

Raymond

Link to comment

And here is my version of trying to do what Raymond did.  But I can't make the SetSelect at the end work. The ResetObject and ResetObject(GetParent) were my last desperate attempt to get the selection to stick tonight.  Maybe tomorrow.

 

Make sure you have a Plug-in in a wall before you run this script. It only exits when you click on a PIO (GetType=86) in a wall.

 

 

Procedure GetObjectInWall;

VAR		H1,H2		:Handle;
		L1			:LONGINT;
		N1,N2		:Integer;
		X1,Y1		:Real;
		B1			:Boolean;

BEGIN
	DSelectAll;
	Repeat
		Begin
			GetPt(X1,Y1);
			B1:=GetPickObjectInfo(X1,Y1, H1, H2, N1);
			If H2<>Nil then N2:=GetType(H2);
		End;
	Until N2=86;

{This is the part that doesn't work}	
	SetSelect(H2);
	ResetObject(H2);
	ResetObject(GetParent(H2));
	RedrawSelection;
End;

Run(GetObjectInWall);

 

Link to comment

I figured it out. When I tried to manually select a window and then the wall, VW popped a message at the bottom of the drawing window saying: the wall object could not be selected if an in-wall object is selected. So, selecting the wall AND the inserted PIO with a script results in ONLY the PIO being selected. The order of selection is not important. I learn something new every day, even when I don't want to.

 

Raymond

  • Like 1
Link to comment

Actually this does make sense to me.  When the Door is selected what is it called. Not a Door, but a Door In Wall.  So it does seem reasonable to need to select both the Door and the Wall. Not sensible. I still think selecting the Door should automatically do what I want it to, but reasonable.

 

Time to update the Developer site.

  • Like 1
Link to comment
22 hours ago, MullinRJ said:

Hello, David.

   HINT: Pat's second suggestion is what you need. Try this code snippet. No error checking is done, so you'll have to add your own.

 

PROCEDURE xxx;
{ Report the type and the PIO Name of a selected wall item. }
VAR
	H, subH :Handle;
	B :Boolean;
	I :Integer;
	P :Vector;
BEGIN
	GetPt(P.x, P.y);
	B := GetPickObjectInfo(P.x, P.y, H, subH, I);
	message(GetTypeN(subH), '  ', GetName(GetParametricRecord(SubH)));
	SysBeep;
END;
Run(xxx);

 

HTH,

Raymond

Hello Raymond !
Thanks for your example code and suggestion ...

Yes, this usage of GetPt... as @Pat Stanford  recommended will operate fine in 2D... not in 3D as i need in my tool...
Your code is operating fine but only in 2D ...


  

Link to comment
2 hours ago, David O said:

Your code is operating fine but only in 2D ...

 

Hello David,

   That's interesting, fearing the same thing you just stated, I tried my code in 2D & 3D and it seems to work just fine. If I click near a window or a door it gets selected. If I click on the wall away from inserted objects, it selects the wall – again in both 2D & 3D.

 

   I reread your signature and notice you are using VW 2018. Is that still the case? I wrote the code using VW 2023. When I try it in VW 2018, it still works in 3D, but the selection is VERY picky and more often than not the inserted object does not get selected. This is the case with OpenGL rendering. When I change to Wireframe, it works as expected. Also, when I try it in VW 2020, it works about 50% of the time in OpenGL, which is better than VW 2018, but it works best in Wireframe. VW 2019 seems to work the same as VW 2018. The performance in VW 2023 is still better in rendered views and best in Wireframe. 

 

   Let us know what you find.

 

Raymond 

Link to comment

Hi @MullinRJ
 

No... i'm using 2023 SP3 (need to update my signature... sorry... ;-/
I found out here what happens ... the issue was that i'm trying to use this TrackObject procedure in a Tool script ... 
Moved the code to a command (vsm...) and it started working fine ...

 

Thank you and @Pat Stanford for the inputs and suggestions anyways !

In fact: many of the tips and comments you guys wrote in this post here are always of great help ! 

 

Cheers !

 

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