Connect C# Set properties of TagElements

Hello,

I try to set the color of a TagElement (it is a TextElement) but unfortunately in the new SDK I can´t find any methods or properties like this on the TagElement. I hope that someone can give me a little example.

Thanks for your help!

Parents
  • Unknown said:
    I try to set the color of a TagElement (it is a TextElement)

    Please clarify: a tag element (type 37) is not the same as a text element (type 17).

    All graphic elements have a Color property.  It belongs to the base class Element.  You should be able to cast your tag or text element using (Element).

     
    Regards, Jon Summers
    LA Solutions

  • Hi Jon, hi Jan,

    thanks for your answers. As I explain in the other thread, our AddIn is for the manipulation of special cells with TagSets and Tags. So in the version of V8i we use CellHeaderElements, TagSet, and TagElement as objects to realize our functionality. Did I understand it correct, that this datamodel changed in CONNECT Edition and that instead of TagElements you should use ItemTypes? So my question in general is, what happens with all the dgn-Files which contains TagElements? Is there an converting workaround for the CONNECT Edition?

    And to the origin problem. On the Bentley.DgnPlatformNET.Elements.Elemtent-Class and also the TagElement-Class I can´t find any properties or methods for manipulating the color for example. So are there other ways to change these properties?

    With regards,

    Robert Menger

    Microstation V8i .Net API, C#, MS VS 2012

  • Unknown said:
    Did I understand it correct, that this datamodel changed in CONNECT Edition and that instead of TagElements you should use ItemTypes?

    For MicroStation CONNECT, Bentley Systems have deprecated tags in favour of Item Types.  Deprecated means: "Prefer to use the new technology, because it's new" and "We've hidden the tags tool palette so you won't be tempted to use tags".  However, as others have found (search the MicroStation Forum), Item Types are not yet a complete replacement for tags.  Tags continue to be supported in MicroStation CONNECT.

    Don't get me wrong — I'm very much in favour of Item Types.  The technology promises a lot of potential benefits.

    This article summarises some CONNECT technology, including Tags and Item Types.

     
    Regards, Jon Summers
    LA Solutions

  • I have not tried this on tag elements, but on line elements I was able to set the color by using the ElementPropertiesSetter. 

    ElementPropertiesSetter eps = new ElementPropertiesSetter();
    eps.SetColor(myColor);
    eps.Apply(myElement);

    Regards

    Frode Tørresdal

  • Hi Frode,

    thanks for your reply. I tried your solution and there was no exception. But also there are no changes in the drawing. In the old API of MicroStation V8i i have to call the method "Rewrite" to apply changes on elements which still exists in the ModelRef. Unfortunately this kind of method is missing in the new library. Maybe there is another way. I also realized that changes of values of tags with the SetTagValue-Method don´t have any success.

    Regards,

    Robert Menger

    Microstation V8i .Net API, C#, MS VS 2012

Reply Children
No Data