Thomas W Posted October 26, 2023 Share Posted October 26, 2023 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 🤔 ! 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. 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 Quote Link to comment
Thomas W Posted October 26, 2023 Author Share Posted October 26, 2023 HI, Sorry but I just realized that there is an error in the script that looks for the coordinates of the arrowhead. Surely a problem of converts with the Ang2Vec function towards Cartesian coordinates, I try to correct it and I come back ... Quote Link to comment
Thomas W Posted October 26, 2023 Author Share Posted October 26, 2023 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 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.