API-created TextStyle is not available for model sketch Text (ex. for Mark feature)

API-created TextStyle is not available for model sketch Text (ex. for Mark feature)

Maxim-CADman77
Advisor Advisor
736 Views
9 Replies
Message 1 of 10

API-created TextStyle is not available for model sketch Text (ex. for Mark feature)

Maxim-CADman77
Advisor
Advisor

If I manually create new Text Style by means of Style Editor of part modelling environment it becomes available within drop-down list in Format Text window:

MaximCADman77_1-1721468075611.png

.... but when I create new TextStyle (as a copy of "DEFAUL-ISO") by means of API it is not present at the drop-down list.

 

My iLogic code is:

 

Dim pDoc As PartDocument = ThisDoc.Document
Dim myTextStyle As TextStyle
Dim myTextStyleName = "Mark Text"

Try
	myTextStyle = pDoc.TextStyles(myTextStyleName)
Catch
	For Each tStyle In pDoc.TextStyles
		' Logger.Info(vbTab & tStyle.InternalName)
		If tStyle.InternalName = "1:DEFAULT-ISO" & vbLf
			Logger.Info(vbTab & "Source-TextStyle: " & tStyle.Name)
			myTextStyle = tStyle.Copy(myTextStyleName)
			Exit for
		End If
	Next
End Try

 


Dear @johnsonshiue, is it an Inv defect, or am I just missing something?

 

This was reproduced in Inv 2024.3.1.

Please vote for Inventor-Idea Text Search within Option Names

0 Likes
737 Views
9 Replies
Replies (9)
Message 2 of 10

Maxim-CADman77
Advisor
Advisor

UPDATE:
I've exported both TextStyles to STYXML and got two absolutely identical files.
...yet "manually created" style is available while "API-created" is not.

Please vote for Inventor-Idea Text Search within Option Names

0 Likes
Message 3 of 10

Michael.Navara
Advisor
Advisor

It looks like a missing feature in the API. But I discover interesting behavior. Content of the drop-down depends on selected annotation standard in document settings. If you create new TextStyle manually, it is "placed" to the active standard.

 

If you want to add this TextStyle to the drop-down permanently, you need to modify the Standard in styles editor. But access to the styles from part is very limited. You can use styles editor from drawing for this. Try to follow this steps:

  1. Open drawing
  2. Create new TextStyle
  3. Assign them to 3D annotation standard
  4. Save changes to the styles library
  5. Update styles in your templates.

MichaelNavara_0-1721802039631.png

 

MichaelNavara_1-1721802081662.png

 

MichaelNavara_3-1721802442629.png

 

MichaelNavara_2-1721802139056.png

 

 

Message 4 of 10

Maxim-CADman77
Advisor
Advisor

My goal was to create new local text style and get it usable in the window mention.
Taking to a count information from your answer I believe this is not doable from drawing document context (I don't want to add any styles to the library).
Seems like I need to redefine the goals of my current project.

Anyway thank you for your time and efforts to help.
I'll keep thread unanswered just in case somebody will suggest some workaround.

Please vote for Inventor-Idea Text Search within Option Names

0 Likes
Message 5 of 10

Frederick_Law
Mentor
Mentor

You are adding new style in Drawing and use it in Part?

0 Likes
Message 6 of 10

Maxim-CADman77
Advisor
Advisor

No.
See first message for what I was doing.

Please vote for Inventor-Idea Text Search within Option Names

0 Likes
Message 7 of 10

Frederick_Law
Mentor
Mentor

Try add the add Text Style to Standard in the document with code.

You just created a new style without assigning it to and Standard.

0 Likes
Message 8 of 10

Maxim-CADman77
Advisor
Advisor
Do you have any ideas on how to do what your propose?

Please vote for Inventor-Idea Text Search within Option Names

0 Likes
Message 9 of 10

Frederick_Law
Mentor
Mentor

Not yet.  Can't find Standard of the TextStyle with API.

0 Likes
Message 10 of 10

Maxim-CADman77
Advisor
Advisor

Just FYI:
I've "workarounded" the issue with renaming existing text style.
...yet I wouldn't call this a solution.

Please vote for Inventor-Idea Text Search within Option Names

0 Likes