ALB Posted February 7, 2014 Share Posted February 7, 2014 Hi everybody, How can I get an handle to the first object selected while inside a Viewport annotations ? FSActlayer doesn't work. Thanks. Quote Link to comment
MullinRJ Posted February 8, 2014 Share Posted February 8, 2014 Try this: ???VPHnd := FSActLayer;????{ VP Handle } ???if (GetTypeN(VPHnd) = 122) then begin????????{ VPHnd is a ViewPort } ??????H := FInGroup(GetVPGroup(VPHnd, 2));????{ 1st object in Annotations Group } ??????if not Selected(H) then H := NextSObj(H);??{ 1st selected object in Annotations Group } ???end ???else H := nil; "H" will hold the answer. If no object in the Annotations Group is selected, or VPHnd is not a ViewPort, "H" will be NIL. Raymond Quote Link to comment
ALB Posted February 10, 2014 Author Share Posted February 10, 2014 Thank you MullinRJ but it doesn't work. H := FInGroup(GetVPGroup(VPHnd, 2)) can't get my first selected object while inside a Viewport annotations However, I completely changed the approach to the problem. The following script works : PROCEDURE GetObjectWhileInsideVieportOrGroup ; VAR h:handle; FUNCTION ruota(hand:handle):BOOLEAN;{====ForEachObjectInList needs a function that returns a boolean=======} BEGIN Hrotate(hand,0,0,#45); END; BEGIN ForEachObjectInList(ruota,2,0,h);{====h is an handle to the first object in the list====} END; RUN(GetObjectWhileInsideVieportOrGroup); Alberto. Quote Link to comment
MullinRJ Posted February 10, 2014 Share Posted February 10, 2014 Alberto, ???The code I posted assumes the VP is the only object selected on the active layer and you entered it by double clicking on the VP. If you entered the VP some other way, then you're right, it may not work. BUT, if you already have a handle to the VP, then you don't need to use FSActlayer, just use your VP handle. The rest is elementary. ???As long as you have something that works, that is good. However, I don't see how the script you posted will work since your handle to a list, "h", is uninitialized when you call ForEachObjectInList(). Raymond 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.