Quantcast
Channel: MicroStation Programming Forum - Recent Threads
Viewing all articles
Browse latest Browse all 4331

how to refer a Text element and update the value of Text element on Microstation CE 16?

$
0
0

Hi,

I am facing one challenge in my task, I am actually upgrading our Tools from MDL C to C#.

My task is I wanted to change the Value of Text Elements. I have achieved it, with the help of one of article in community,  which is below.

https://communities.bentley.com/products/programming/microstation_programming/f/microstation-programming---forum/208451/c-connect-modify-textnode-element

But however I am facing some issues. 

Here is my example. I am accessing TXTPROJNAME from DGN file and want to change its Value.

ModelElementsCollection graphicEls = scanModel.GetGraphicElements();
Bentley.DgnPlatformNET.Elements.TextElement txts = new Bentley.DgnPlatformNET.Elements.TextElement();

if (ele.Description.Contains("TXTPROJNAME ")) // ele is a TextElement
{

Bentley.DgnPlatformNET.TextBlock newTxtBlck = new Bentley.DgnPlatformNET.TextBlock(styleNone, activeModel);

newTxtBlck.AppendText("Test");

textEdit.ReplaceTextPart(textPartId, newTxtBlck) // using to change the value

Currently I am using Description attribute to refer the element.

when I change the value of Text element, Value and Description both are changing. And next time I am unable to access the same element by using previous description.

I think using of Description is not correct to refer the Element. Please suggest.

I hope you you understood my issue.

Please help on this issue.

Thanks,

Varsha


Viewing all articles
Browse latest Browse all 4331


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>