Message 1 of 5
Exception on attempt to use API-created TextStyle in TextBox within Part PlanarSketch
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I get the Unspecified error (0x80004005 (E_FAIL)) when try to set local API-created TextStyle for TextBox within Part PlanarSketch (it is present in Style Editor but not in 'Style' drop-down list within 'Format text' window)
My sample model is attached, my iLogic code is:
Option Explicit On
Dim tgtTxtStyleName As String = "My-Sketch-Text-Style-COPY-" & Now.ToString("yyyyMMddHHmmss")
Dim ptDoc As PartDocument = ThisDoc.Document
Dim ptDef As ComponentDefinition = ptDoc.ComponentDefinition
If ptDoc.ActiveAnnotationsStandard <> "ISO" Then ptDoc.ActiveAnnotationsStandard = "ISO"
Dim srcTxtStyle, tgtTxtStyle As TextStyle
Try
tgtTxtStyle = ptDoc.TextStyles(tgtTxtStyleName)
Catch
srcTxtStyle = (From tStyle As TextStyle In ptDoc.TextStyles Where tStyle.InternalName.StartsWith("1:Sketch Text (ISO")).FirstOrDefault
tgtTxtStyle = srcTxtStyle.Copy(tgtTxtStyleName)
End Try
Logger.Info("tgtTxtStyle: " & If(tgtTxtStyle Is Nothing, "-", "+"))
Dim sk As PlanarSketch = ptDef.Sketches(ptDef.Sketches.Count)
Dim tBox As TextBox = sk.TextBoxes(1)
Logger.Info("tBox: " & If(tBox Is Nothing, "-", "+"))
tBox.Style = tgtTxtStyle ' Unspecified error (0x80004005 (E_FAIL))
What I'm missing?
Please vote for Inventor-Idea Text Search within Option Names