Hello,
When using this code :
If oElem.IsTextElement Then textStyleName = oElem.AsTextElement.TextStyle.name End If
If the text element has no text style (textstyle "none"), The textstyle.name property of the element is set to the active text style name.
How can i know if the text has textstyle "None" ?
Many thanks and regards
Sub macro2() Dim ee As ElementEnumerator Set ee = ActiveModelReference.Scan() Do While ee.MoveNext If ee.Current.IsTextElement Then Debug.Print ee.Current.AsTextElement.TextStyle.Name End If Loop End Sub
When the active text setting is set to "None" textstyle.Name is correct
When the active text setting is set to an existing active Design file textStyle and the text do not have any text style then textStyle.name is active TextStyle Name which is incorrect
Hi,
this is a known issue and a Defect 12126 is filed to address this issue.
Best regards,
Artur
Hi Remy,
you may want to try the MDL function mdlTextStyle_setTextStyleInTCB to set textstyle None.Please test the following VBA code if this works for you with the V8i version you are using:
Declare Function mdlTextStyle_setTextStyleInTCB Lib "stdmdlbltin.dll" (ByVal textStyleId As Long, ByVal modelRef As Long) As Long Sub setTSNone() Dim modelRef As Long Dim rtc As Long modelRef = ActiveModelReference.MdlModelRefP rtc = mdlTextStyle_setTextStyleInTCB(0, modelRef) End Sub
I hope this helps?
dimension styles behave a litte bit different than text styles, also recorded VBA code could be used to activate dimension style "None".Please try these lines of code:
CadInputQueue.SendCommand "MDL KEYIN DIMSTYLE DIALOG DIMSTYLE OPEN" CadInputQueue.SendCommand "DIMSTYLE DESELECT ALL" CadInputQueue.SendCommand "DIMSTYLE SELECT ""Style:(none)""" CadInputQueue.SendCommand "DIMSTYLE ACTIVE" CommandState.StartDefaultCommand
I hope this works for you?
Best regards,Artur
Remy and Artur,
Thanks for this discussion, it is very helpful. I experimented, and in v8i SS4, this sets the active dimension style to 'None' without needing to open the dialog and/or send key-ins:
Set ActiveSettings.DimensionStyle = ActiveDesignFile.DimensionStyles("")