David O Posted February 10, 2023 Share Posted February 10, 2023 Hello everyone ! I tried either TrackObject() and TrackObjectN() - with level at 0, or 1, and 2 Trying to interact (or select) only with Pio objets which are inside a Wall... Or at least recognize objects inserted inside Walls... Thanks. Quote Link to comment
Pat Stanford Posted February 10, 2023 Share Posted February 10, 2023 Take a look at ForEachObjectAtPoint where you can write your own function to determine which types of objects to handle. Or at GetPickObjectInfo that will return a "sub handle" to an object embedded in the picked object. You will still need to check the returned objects to make sure they meet your needs. Quote Link to comment
David O Posted February 13, 2023 Author Share Posted February 13, 2023 Hi @Pat Stanford Thank you for your advise ... I tried to call GetPt before calling ForEachObjectAtPoint() ... did not work ... and GetPt3D() also did not work ... Any hints ? Thanks Quote Link to comment
MullinRJ Posted February 13, 2023 Share Posted February 13, 2023 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 Quote Link to comment
Pat Stanford Posted February 13, 2023 Share Posted February 13, 2023 This thread might help with TrackObject. Quote Link to comment
Pat Stanford Posted February 13, 2023 Share Posted February 13, 2023 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); Quote Link to comment
MullinRJ Posted February 13, 2023 Share Posted February 13, 2023 (edited) @Pat Stanford, Try this. It works, but I don't know why. This is using your variable names. SetSelect(H1); { Wall handle } SetSelect(H2); { handle to sub_object in Wall } And so does this: SetSelect(H2); { handle to sub_object in Wall } SetSelect(H1); { Wall handle } Go figure!?! Raymond Edited February 13, 2023 by MullinRJ Quote Link to comment
MullinRJ Posted February 13, 2023 Share Posted February 13, 2023 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 1 Quote Link to comment
Pat Stanford Posted February 13, 2023 Share Posted February 13, 2023 Thank you Raymond. So glad your day runs a few hours earlier than mine. 😉 1 Quote Link to comment
MullinRJ Posted February 13, 2023 Share Posted February 13, 2023 You’re welcome. But I think my day ran a few hours later. I’m just now getting up. 😫 😶 ☀️ Quote Link to comment
Pat Stanford Posted February 13, 2023 Share Posted February 13, 2023 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. 1 Quote Link to comment
David O Posted February 14, 2023 Author Share Posted February 14, 2023 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 ... Quote Link to comment
MullinRJ Posted February 14, 2023 Share Posted February 14, 2023 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 Quote Link to comment
David O Posted February 14, 2023 Author Share Posted February 14, 2023 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 ! 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.