Hi All, I am having an issue trying to modify text styles in a dgnlib programatically. I have tried both a VB and a BASIC Macro and getting the same results. I am trying to change the font on all the textstyles then save them. The macro makes the change but does not save the styles. I have tried the selectall and tried iterating through the styles.
The strange thing is if I step through the macro it will save and if I run the macro twice from the basic editor or vb editor it will save the styles. Running it twice outside the editors and it will not save. It also works using the key ins manually. Here is the basic code I am using,
Sub main
Dim startPoint As MbePoint
Dim point As MbePoint, point2 As MbePoint
' Start a command
MbeSendCommand "MDL KEYIN textstyle textstyle dialog open"
' Send a keyin that can be a command string
MbeSendKeyin "textstyle selectall"
MbeSendKeyin "textstyleset font 1"
MbeSendKeyin "textstyle saveall"
End Sub
The VB code is similar.
Sub Macro1()
Dim startPoint As Point3d
Dim point As Point3d, point2 As Point3d
Dim lngTemp As Long
' Start a command
CadInputQueue.SendCommand "MDL KEYIN textstyle textstyle dialog open"
CadInputQueue.SendCommand "TEXTSTYLE DESELECT ALL"
CadInputQueue.SendCommand "TEXTSTYLE DESELECT ALL"
CadInputQueue.SendCommand "TEXTSTYLE SELECT ""Style (none)"""
CadInputQueue.SendCommand "TEXTSTYLE DESELECT ALL"
CadInputQueue.SendCommand "TEXTSTYLE SELECT ""Style (none)"""
CadInputQueue.SendCommand "TEXTSTYLE SELECT ""Large"""
CadInputQueue.SendCommand "TEXTSTYLE SELECT ""Small"""
CadInputQueue.SendCommand "TEXTSTYLESET Font ""font001.rsc"" ""None"" ""Large"" ""Small"""
CadInputQueue.SendCommand "TEXTSTYLE Save"
CommandState.StartDefaultCommand
End Sub
Any wisdom or guidance is greatly appreciated. Thank you