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
Hello Florian,
I will try this at my end and will let you know my findings.
Thanks,
Anik
Hello Anik,
Here ist a text case.
Textstyle_in_Functions_TestCase.dgn
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.
Hi Anik,
Thanks for your suggestion - but somehow I still don't get it to work.... it seems that the correct text styles are applied to the text objects, but still the outcome is that all text elements are shown using the last TextStyle definded.
Hi Florian,
I also faced this. However, after replaying all the transaction solved the issue.
Can you please try the same?
No, sorry... no luck - I don't get it to work as expected.
After replaying the transactions my text is still formatted with the wrong Textstyle...
When I choose to "update Node Tree" on the individual text item, it displays both - the correct text style and the wrong one....
I am sorry that it's not working. Can you please file a service request with the sample files? We need to file a defect for this.