07-05-2018
08:42 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
07-05-2018
08:42 AM
Hi @PaulMunford,
Long time no see around these parts ![]()
I ran your code and it worked the first time, but not after that in a newly created assembly file.
The reason for this is because you were changing the name (of the active lightingstyle) to the string you desired with this line, not changing the active lightingstyle to it:
oAssy.ActiveLightingStyle.Name = "Grid Light"
I've knocked up this simple rule:
Dim oAssy As AssemblyDocument = ThisApplication.ActiveDocument
Dim oLightStyleName As String
oLightStyleName = oAssy.ActiveLightingStyle.Name
MessageBox.Show(oLightStyleName, "Title")
Dim lightingstyletochangeto As LightingStyle = oAssy.LightingStyles.Item("Grid Light")
If Not oAssy.ActiveLightingStyle.Name = lightingstyletochangeto.Name Then
oAssy.ActiveLightingStyle = lightingstyletochangeto
InventorVb.DocumentUpdate()
Else
MessageBox.Show("We're already using the desired lighting style!")
End IfWhich appears on the surface to answer your question. When it runs however, the active lightingstyle on the "View" tab of the Inventor interface doesn't seem to update so there must either be:
- a bug OR
- a missing update function I haven't used to update the Inventor interface
I'm not sure which without further investigation.
Cheers,
Alex.
----------------------------------------------------------------
Alex Fielder
Inventor Expert
https://github.com/alexfielder/
LinkedIn - Github Inventor Extension Server - Bonkers polygon iLogic thing
Top ten iLogic Tips - API Shortcut In Google Chrome - Assembly Extrusion Example
Alex Fielder
Inventor Expert
https://github.com/alexfielder/
LinkedIn - Github Inventor Extension Server - Bonkers polygon iLogic thing
Top ten iLogic Tips - API Shortcut In Google Chrome - Assembly Extrusion Example