Page 1 of 1
Set Text in a CADText
Posted: 18 Mar 2014, 18:04
by user
Hello,
I have a problem with CADText in a dwg file.
I load the file and then I try to change the text by code, by setting CADText.Text property, but text doesn't change!
Can someone help me?
Thanks!
Re: Set Text in a CADText
Posted: 19 Mar 2014, 11:49
by support
Hello,
The code below assigns a new value to CADText:
Code: Select all
CADImage cadImage;
...
private void ChangeText(string textValue, string newValue)
{
foreach (CADEntity entity in cadImage.Converter.Entities)
{
if (entity.EntType == EntityType.Text)
{
CADText cadText = entity as CADText;
if (cadText.Text == textValue)
{
cadText.Text = newValue;
cadImage.Converter.Loads(cadText);
cadImage.GetExtents();
}
}
}
}
Mikhail.
Re: Set Text in a CADText
Posted: 19 Mar 2014, 13:44
by user
Thank you Mikhail!
Re: Set Text in a CADText
Posted: 19 Mar 2014, 18:02
by user
Hello Mikhail,
It's possible to insert a multiline text in a CADText?
Thank you in advance.
Re: Set Text in a CADText
Posted: 24 Mar 2014, 18:34
by support
Hello.
CAD Import .NET provides CADMText class as multiline texts representation. Any multiline text on a drawing will be imported as CADMText object. If you need to replace single line text with multiline text then delete CADText object and create new MText instead of it.
Alexander.