Jump to content
Developer Wiki and Function Reference Links ×

why GetBBox returns a big bounding box of "Legend" - (I'm not talking about Callout or Keynote)


Thomas W

Recommended Posts

Hi all,

 

I am working on a French version so to avoid errors in translating the names of the functions you will see in the screenshot below the "Legend" function that I am talking about which is different from the Callout (Infobulle) and Keynote (Légende) functions, sorry but I couldn't find the English name of this function 🤔 !

 

02-CapturefonctionLgendedansOutils2D.jpg.850a38b5a98657a65ee2249266ffd492.jpg

 

I was looking for the coordinates of the arrowhead of this Legend function that my colleagues have been using for a while, so I first tried to get the bounding box using GetBBox but the box is much larger than the object :

1- Do you know why the coordinates retrieved by GetBBox exceed the object so much?

I haven't found any logical reasoning between the bounding box and the object, anyone know more about this?

It's not blocking for me but I would like to understand why the box is so big. Attached is a capture and a file in 2023.

 

01-CaptureGetBBoxLgendeetCallout.thumb.jpg.591d260e451f8aee49125ec1439664d9.jpg

 

 

Otherwise to find the coordinates of the tip of the arrow I made a script by looking for the length of the guideline in the parametric record, the angle and GetSymLoc.

The script is in the vwx files, if you have any comments, advice or improvements it will be with pleasure!

 

(if I paste the code I get a 403 error even if I change Chr to CHR)

 

 

Thanks and have a nice day,

 

Thomas

 

 

 

 

 

GetBBox with Légende.vwx

Link to comment

Hi,

 

Ok, I modified the script to look up the coordinates of the arrowhead from the "Legend" function using GetSymLoc, the length of the guideline and the angle.

 

Below is the script and an attached vwx file.

If you have any comments on the size obtained from the bounding box of the 1st message or to improve the script below I would be grateful:

I changed the {} to () of the return cart so that it works...

 

PROCEDURE GetArrowHeadCoordinateFromLegend;

CONST
	CR = Chr{13};
VAR
	h, recHand :HANDLE;
	recName, fldName, fldNameLength, LineLengthString :STRING;
	angleR, LineLengthNum, AHx, AHy :REAL; { AHx, AHy : coordinates of the ArrowHead of the legend }
	InsPt, Line :POINT;

BEGIN
	h := FSActLayer;
	IF GetTypeN(h) = 86 THEN { Returns the type index of the referenced planar or screen object - vérifie si type plug-in }
		BEGIN
			recHand := GetParametricRecord(h);							{ Returns the handle to the parametric record attached the referenced object }
			recName := GetName(recHand);								{ Name of record format }
			fldNameLength := GetFldName(recHand, 11);					{ Returns the name of the field "11" in the referenced record }
			LineLengthString := GetRField(h, recName, fldNameLength);	{ Returns string description of a value in the specified record field }
	
																	{ Function ValidNumStr returns TRUE if the specified string can be converted into a numeric value } 
																	{ If TRUE, the numeric value is returned }
		IF ValidNumStr(LineLengthString, LineLengthNum) THEN		{ Cf Help : If you need to know whether or not the FUNCTION succeeded, you shouldn't be using Str2Num, but ValidNumStr instead.}
			BEGIN
				angleR := HAngle(h);					{ Function HAngle returns the angle of the referenced object - ici en degrés comme dans OIP }				
				GetSymLoc(h, InsPt.x, InsPt.y);			{ Procedure GetSymLoc returns the insertion point of the referenced symbol or plug-in object }
				{ AlrtDialog(Concat( 'Le point d''insertion est au point de coordonnées : ', CR, 'InsPt.x = ', InsPt.x, CR, 'InsPt.y = ', InsPt.y)); }
								
				Line.x := LineLengthNum * Cos(Deg2Rad(angleR));
				Line.y := LineLengthNum * Sin(Deg2Rad(angleR));
				{ AlrtDialog(Concat('La distance entre GetSymLoc et la pointe de la flèche est de : ', CR, 'Line.x = ', Line.x, CR, 'Line.y = ', Line.y)); }
				
				AHx := Trunc((InsPt.x + Line.x)*1000)/1000;
				AHy := Trunc((InsPt.y + Line.y)*1000)/1000;
				AlrtDialog(Concat( 'Les coordonnées de la pointe de la flèche sont : ', CR, 'AHx = ', AHx, CR, 'AHy = ', AHy));
			END
			ELSE
				AlrtDialog(Concat('The specified string can not be converted into a numeric value'));
		END;	{ IF ValidNumStr }
END;
Run(GetArrowHeadCoordinateFromLegend);

 

Thanks in advance!

GetBBox with Légende.vwx

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