Textstyle in a function

Hi there,

I am trying to use different text styles in a function but all text gets placed using only the last Textstyle referenced (in my case all 3 Texts are placed using Textstyle 3).

Am I doing something wrong here?

node User.Objects.text1 Bentley.GC.NodeTypes.Text
        {
            Technique                 = 'ByFunction';
            Function                  = function (CoordinateSystem cs1, CoordinateSystem cs2, CoordinateSystem cs3, TextStyle t1, TextStyle t2, TextStyle t3)
                                        {                                   
                                        Text myText1 = new Text(this);                                           
                                        Text myText2 = new Text(this);
                                        Text myText3 = new Text(this);
                                        myText1.ByPointOrPlaneOrCoordinateSystem(cs1,"Test1", t1);
                                        myText2.ByPointOrPlaneOrCoordinateSystem(cs2,"Test2", t2);
                                        myText3.ByPointOrPlaneOrCoordinateSystem(cs3,"Test3", t3);
                                        };
            FunctionArguments         = {coordinateSystem00, coordinateSystem1, coordinateSystem2, textStyle01, textStyle03, textStyle03};

Thanks in advance!

Florian

Parents Reply
  • Hello Florian,

    Sorry, I was on vacation. 

    The issue also seems to be reproducible at my end. One reason might be the input 'Text Style' is not replicable that is why it is always taking a single value.

    An alternative would be to create 3 nodes for each type of text style. We can also automate node creation for each type of text styles.

    function (CoordinateSystem cs1, CoordinateSystem cs2, CoordinateSystem cs3, TextStyle t1, TextStyle t2, TextStyle t3)
    {
    
    object Texts = {};                                   
    Text myText2 = new Text('Tsmall');
    Texts.Add(myText2.ByPointOrPlaneOrCoordinateSystem(cs1,"s", t1));                                           
    Text myText3 = new Text('Tmed');
    Texts.Add(myText3.ByPointOrPlaneOrCoordinateSystem(cs2,"m", t2));
    Text myText4 = new Text('Tlarge');
    Texts.Add(myText4.ByPointOrPlaneOrCoordinateSystem(cs3,"l", t3));
    return Texts;
    }

    However, I have also noted one more thing that after 'Update Model' the text styles are changing to the last used text style. To fix this we have to replay all the transactions again. 

    Thanks,

    Anik

Children