コミュニティ

Use of distance command in FlexiLayout 回答済み

Hello,

in a FlexiLayout Advanced post-search relation script I would like to implement that a SearchElement "stField1" is only found, when the distance from this element to another element "stField2" is less than 800 dot. Unfortunately I don't know how to work with the distance command. My idea was the following code, but I get an error in line:

if stField1.IsFound Then

{

    int lDistance = 0;

    lDistance = distance((stField1.Rect.XCenter, stField1.Rect.YCenter),(stField2.Rect.XCenter, stField2.Rect.YCenter));

    if lDistance > 800 dot Then

    {

        DontFind();

    }

}

But I get the Compilation error "Error in position 306: Wrong parameters for function distance. How can I use the distance-function? My idea was int d = distance((x1,y1),(x2,y2)); so that the function "distance" gives me the distance betwenn point 1 and point 2. How can I use this function correctly in order to get the distance between two points?

Can anybody help me on that please..

この記事は役に立ちましたか?

0人中0人がこの記事が役に立ったと言っています

コメント

3件のコメント

  • Avatar
    Permanently deleted user

    Hello,

    In the FLS language the distance can be calculated only for one coordinate (X or Y), so taking into consideration this limitation, your post-search relation for stFields1 should have looked like:

    //------------------------(if the X-distance is more important)

    if abs(stField2.XCenter.Start - XCenter.Start ) > 800dt then

    {

     Quality(0);

    }

    //------------------------

    or 

    //------------------------(if the Y-distance is more important)

    if abs(stField2.YCenter.Start - YCenter.Start ) > 800dt then

    {

     Quality(0);

    }

    //------------------------

    you may combine both types of conditions, according to the typical stField1 and stField2 positions in your documents.

    0
  • Avatar
    Permanently deleted user

    Dear Ekaterina,

    Thank you very much for your help!

    Is there a way to use mathematical functions in the Advanced post-search relation script like square root or square? Or can I include C# libraries like in the script of a rule (using ...)?

    Kind regards

    Reinhard

    0
  • Avatar
    Permanently deleted user

    Hello,

    Sorry, square root function is not supported in the Advanced post-search relation script. You cannot use C# libraries.

    0

サインインしてコメントを残してください。