Autodesk Inventor Customization
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Object Default Style change
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Hi everybody,
I am using Inventor version 2011. I wrote this code which tells me which object defaults style is active
Public Sub ActiveObjectDefaults()
Dim oDocument As DrawingDocument
Set oDocument = ThisApplication.ActiveDocument
Dim DrgStMgr As DrawingStylesManager
Set DrgStMgr = oDocument.StylesManager
Dim ObjDfStyle As Style
Set ObjDfStyle = DrgStMgr.ActiveStandardStyle.ActiveObjectDefaults
MsgBox ObjDfStyle.Name
End Sub
Is it possible to change Active Object Defaults Style by VBA code (see picture below)?
I am trying to change Object Defaults in order to temporarily switch style which use layers with different lineweights, and than switch it back. I am new to VBA so I am not sure if I am not trying to do something what is impossible.
Thanks for any respond.
Stan Cernak
Re: Object Default Style change
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Hey Guys, I'm also looking for the answer to this too please
Engineer-in-Training, Industrial Automation
Re: Object Default Style change
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
I already managed to change it by using code below.
Public Sub ChangeObjDefaults()
'set active document as drawing document
Dim oDrgDoc As DrawingDocument
Set oDrgDoc = ThisApplication.ActiveDocument
Dim oDrgStlMgr As DrawingStylesManager
Set oDrgStlMgr = oDrgDoc.StylesManager
Dim oObjDfStl As ObjectDefaultsStylesEnumerator
Set oObjDfStl = oDrgStlMgr.ObjectDefaultsStyles
'set Object Defaults (ISO) as active object default style
oDrgStlMgr.ActiveStandardStyle.ActiveObjectDefault s = oObjDfStl.Item("Object Defaults (ISO)")
End SubHope it will help you.
Stan Cernak
