Changing Document SubType

Changing Document SubType

Anonymous
Not applicable
1,185 Views
9 Replies
Message 1 of 10

Changing Document SubType

Anonymous
Not applicable
To all, I am using the the following code to change the subtype of a PartDocument to "SheetMetal". As can be seen, I am doing this during a "OnSaveDocument" Event. But when I change the SubType, the BrowserPanel also changes to "SheetMetal". I don't want this to happen! How can I stop Inventor from changing the BrowserPanel??? Thanks in advance, Teun 'Code snippet... Private Sub oDocumentEvents_OnSaveDocument(ByVal DocumentObject As Inventor.Document, ByVal BeforeOrAfter As Inventor.EventTimingEnum, ByVal Context As Inventor.NameValueMap, HandlingCode As Inventor.HandlingCodeEnum) If DocumentObject.DocumentType = kPartDocumentObject Then If BeforeOrAfter = kBefore Then Dim oDoc As PartDocument Set oDoc = DocumentObject oDoc.SubType = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" 'Change to SheetMetal 'Etc etc etc
0 Likes
1,186 Views
9 Replies
Replies (9)
Message 2 of 10

Anonymous
Not applicable
Correction --> Inventor changes the PanelBar, not the BrowserBar. How can I stop Inventor from changing the PanelBar? "Teun Ham (IV9)" wrote in message news:415806ef$1_1@newsprd01... > To all, > > I am using the the following code to change the subtype of a PartDocument to > "SheetMetal". > As can be seen, I am doing this during a "OnSaveDocument" Event. > > But when I change the SubType, the BrowserPanel also changes to > "SheetMetal". > I don't want this to happen! How can I stop Inventor from changing the > BrowserPanel??? > > Thanks in advance, > > Teun > > 'Code snippet... > > Private Sub oDocumentEvents_OnSaveDocument(ByVal DocumentObject As > Inventor.Document, ByVal BeforeOrAfter As Inventor.EventTimingEnum, ByVal > Context As Inventor.NameValueMap, HandlingCode As Inventor.HandlingCodeEnum) > > If DocumentObject.DocumentType = kPartDocumentObject Then > If BeforeOrAfter = kBefore Then > > Dim oDoc As PartDocument > Set oDoc = DocumentObject > > oDoc.SubType = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" 'Change to > SheetMetal > > 'Etc etc etc > >
0 Likes
Message 3 of 10

Anonymous
Not applicable
Hi Teun I couldn't figure it out in a short amount of time, but maybe this will get you started. I imagine you have to get into the Environment settings. The code below doesn't do anything, but if you put a watch on oEnvironment, or just play with the autocomplete maybe you can find the right incantation. ;~) Dim oPanelBar As CommandBar Set oPanelBar = ThisApplication.UserInterfaceManager.CommandBars.Item("PMxPartFeatureCmdBar" ) Dim oEnvironment As Environment Set oEnvironment = ThisApplication.UserInterfaceManager.Environments("MBxSheetMetalEnvironment" ) oEnvironment.DefaultMenuBar = oPanelBar -- Kent Keller Autodesk Discussion Forum Facilitator "Teun Ham (IV9)" wrote in message news:4158074f$1_1@newsprd01... > Correction --> Inventor changes the PanelBar, not the BrowserBar. >
0 Likes
Message 4 of 10

Anonymous
Not applicable
Opps ... Don't run that code, or the next time you boot up the menubar (not the panel bar) will be the part feature bar anytime a sheetmetal file is opened. -- Kent Keller Autodesk Discussion Forum Facilitator "Kent Keller" wrote in message news:41583978_3@newsprd01... > oEnvironment.DefaultMenuBar = oPanelBar
0 Likes
Message 5 of 10

Anonymous
Not applicable
I didn't run the code, but the code would indeed activate the Part Feature Bar each time the SheetMetal Environment is activated. But you did gave me some ideas, thanks! Cheers, Teun "Kent Keller" wrote in message news:415879d6$1_2@newsprd01... > Opps ... Don't run that code, or the next time you boot up the menubar (not > the panel bar) will be the part feature bar anytime a sheetmetal file is > opened. > > -- > Kent Keller > Autodesk Discussion Forum Facilitator > > > "Kent Keller" wrote in message > news:41583978_3@newsprd01... > > > oEnvironment.DefaultMenuBar = oPanelBar > >
0 Likes
Message 6 of 10

Anonymous
Not applicable
Hmm, it seems like you're unable to change the PanelBar, or at least, I am unable to change it... This comes from the Inventor Help: ***** Environment.PanelBar Property Read-only property that returns the PanelBar object. Syntax PanelBar() As PanelBar ***** Does anyone have a solution?
0 Likes
Message 7 of 10

Anonymous
Not applicable
Teun I am probably not following what you want... are you just trying to change what panel bar is displayed? It appears the CurrentCommandBar property of the PanelBar object should change it. From help. Read-write property that specifies which CommandBar is currently displayed within the panel bar. Syntax CurrentCommandBar() As CommandBar -- Kent Keller Autodesk Discussion Forum Facilitator "Teun Ham (IV9)" wrote in message news:416261c4$1_1@newsprd01... > Hmm, it seems like you're unable to change the PanelBar, or at least, I am > unable to change it... > > This comes from the Inventor Help: > > ***** > Environment.PanelBar Property > Read-only property that returns the PanelBar object. > > Syntax > PanelBar() As PanelBar > > ***** > > Does anyone have a solution? > >
0 Likes
Message 8 of 10

Anonymous
Not applicable
Kent, Let me explain what is going on: I have an Addin that saves the (flatpattern) extens (Length, Width and Thickness) to 3 Custom iProperties on the "OnSaveDocument" Event. Within that sub I change the DocumentSubType to SheetMetal. This will change the PanelBar to the SheetMetal PanelBar. Problem--> When saving an assembly, if Inventor finds a dirty SheetMetal part it will jump into the "save flatpattern extents" sub and the PanelBar will change. In the end, the PanelBar is no longer the Assembly PanelBar but mostlikely the SheetMetal PanelBar. So, I want to change the PanelBar to the default PanelBar of the current active document. I didn't knew about any "CurrentCommandBar"...sounds just what I need! Thanks!
0 Likes
Message 9 of 10

Anonymous
Not applicable
Sight...in the end it's all so simple... Dim oEnvironment As Environment Set oEnvironment = InventorApp.UserInterfaceManager.ActiveEnvironment Dim oPanelBar As PanelBar Set oPanelBar = oEnvironment.PanelBar oPanelBar.CurrentCommandBar = oPanelBar.DefaultCommandBar Kent, thanks for your help!
0 Likes
Message 10 of 10

Anonymous
Not applicable
The whole trick to any of this is finding the right Vodoo command in help. Sure hope help and the examples get beefed up next go around. ;~) -- Kent Keller Autodesk Discussion Forum Facilitator
0 Likes