10-29-2020
05:45 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
10-29-2020
05:45 AM
does this work for you:
Dim originalStyleName As String = "Note Text (ANSI) - 3DA" Dim replaceBy As String = "Sketch Text (ANSI) - 3DA" Dim doc As PartDocument = ThisDoc.Document Dim def As PartComponentDefinition = doc.ComponentDefinition Dim textStyleOrg As TextStyle = Nothing Dim textStyleNew As TextStyle = Nothing For Each style As TextStyle In doc.TextStyles If (Style.Name = originalStyleName) Then textStyleOrg = Style End If If (Style.Name = replaceBy) Then textStyleNew = Style End If Next ' in this part all properties from textStyleNew are copyed to textStyleOrg Dim type As Type = GetType(Inventor.TextStyle) For Each prop As Reflection.PropertyInfo In type.GetProperties() If (prop.CanWrite) Then If (prop.Name = "Name" Or prop.Name = "_Name") Then Continue For End If Dim obj = prop.GetValue(textStyleNew) prop.SetValue(textStyleOrg, obj) End If Next ' both styles are now the same.
Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
Blog: hjalte.nl - github.com