The Hamma Posted October 20, 2021 Share Posted October 20, 2021 I have looked through the SDK and maybe I am missing it but I can't find the Object Type ID integer for "Text Styles". Anyone know what it is? Quote Link to comment
Peter Vandewalle Posted October 20, 2021 Share Posted October 20, 2021 Documentscript with Message(GetTypeN(GetObject(‘textstylename’))) will get you the answer. Quote Link to comment
The Hamma Posted October 20, 2021 Author Share Posted October 20, 2021 Thanks 109 Quote Link to comment
The Hamma Posted October 20, 2021 Author Share Posted October 20, 2021 (edited) 11 minutes ago, Peter Vandewalle said: Documentscript with Message(GetTypeN(GetObject(‘textstylename’))) will get you the answer. Thanks it is "109" Edited October 20, 2021 by The Hamma Quote Link to comment
The Hamma Posted October 20, 2021 Author Share Posted October 20, 2021 (edited) Ok, Follow up question. Does anyone know how to set the Document Text Style preference for future text objects to be a particular text style via script? and How to move text styles into a Text Style folder via script? Edited October 20, 2021 by The Hamma Quote Link to comment
Peter Vandewalle Posted October 20, 2021 Share Posted October 20, 2021 Move a resource to a folder: I think SetParent()… Quote Link to comment
The Hamma Posted October 21, 2021 Author Share Posted October 21, 2021 20 hours ago, Peter Vandewalle said: Move a resource to a folder: I think SetParent()… Perfect, Thanks. Here is a script to import two Text Styles into the current drawing that are stored in: {Workgroup folder or user folder}\Libraries\Defaults\Text Styles\Text Styles.vwx' """ Script to import two text styles into current drawing. Custom scripts can be added to: {Workgroup folder or user folder}\Libraries\Defaults\Text Styles\Text Styles.vwx Modify Style1 or Style2 to import your custom style This Python Script may be freely distributed. No warranty provided. Use at your own risk. David Hamer, 2021 revision 10/21/2021 """ Style1 = 'Callouts 10 pt' #change this to import different text style Style2 = 'Dimensions 10 pt' #change this to import different text style StyleFolder = 'Text Styles' #Name of resource folder to create in current drawing SourceSub = 'Defaults:Text Styles' #Sub path ResType =109 #Text Style type folderIndex =13 #Libraries if vs.GetName(Style1) != []: ResourceList, NumItems = vs.BuildResourceList(ResType, folderIndex, SourceSub) while NumItems != 0: ResourceName = vs.GetNameFromResourceList(ResourceList, NumItems) if ResourceName == Style1: vs.ImportResourceToCurrentFile(ResourceList,NumItems) if vs.GetObject(StyleFolder) == []: vs.NameObject(StyleFolder) vs.BeginFolderN(ResType) vs.EndFolder() vs.SetParent(vs.GetObject(Style1),vs.GetObject(StyleFolder)) NumItems -= 1 if vs.GetName(Style2) != []: ResourceList, NumItems = vs.BuildResourceList(ResType, folderIndex, SourceSub) while NumItems != 0: ResourceName = vs.GetNameFromResourceList(ResourceList, NumItems) if ResourceName == Style2: vs.ImportResourceToCurrentFile(ResourceList,NumItems) if vs.GetObject(StyleFolder) == []: vs.NameObject(StyleFolder) vs.BeginFolderN(ResType) vs.EndFolder() vs.SetParent(vs.GetObject(Style2),vs.GetObject(StyleFolder)) NumItems -= 1 Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.