Jump to content
Developer Wiki and Function Reference Links ×

Get Firste Selected Object Inside Viewports Annotation


ALB

Recommended Posts

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

Link to comment

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.

Link to comment

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

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