I have the code below working except the textstyle is not applied. The textstyle exists in the active file. Probably something simple that I'm missing.
I've seen the TextStyle.AddToElement(element, key) but have no idea what the "key" parameter is.
private static void PlaceTextElement(string inputString, DPoint3d origin, DgnTextStyle textStyle, string levelName) { DgnModel currentModel = Session.Instance.GetActiveDgnModel(); TextBlock textBlock = new TextBlock(textStyle, currentModel); textBlock.SetUserOrigin(origin); textBlock.AppendText(inputString); TextElement textElement = (TextElement)TextElement.CreateElement(null, textBlock); LevelId levelId = GetLevelIdByLevelName(levelName); ElementPropertiesSetter propSetter = new ElementPropertiesSetter(); propSetter.SetLevel(levelId); propSetter.SetColor(SymbologyValue.ColorByLevel); propSetter.SetWeight(SymbologyValue.WeightByLevel); propSetter.Apply(textElement); textElement.AddToModel(); }
Hi Mike,
another comment: You should move your question to MicroStation Programming Forum, because this is general Developers and Programming Forum, not so active in my opinion.
Regards,
Jan
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point