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
Turn off Translucen t using VBA
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Hi All,
I'm trying to make a translucent part file to a opaque part file by using the below code
Dim oDocument As Document
Set oDocument = ThisApplication.ActiveDocument
oDocument.ActiveRenderStyle.Opacity = 1 'making the body opaque
But it doesnot help.Can someone please let me know how to do it through code.
PS: attached is the process of doing it manually
Thank You
Solved! Go to Solution.
Re: Turn off Translucen t using VBA
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Like this?
Public Sub TranslucentTest()
Dim app As Inventor.Application
Set app = ThisApplication
Dim partDoc As PartDocument
Set partDoc = app.ActiveDocument
Dim oWorkSurface As WorkSurface
Set oWorkSurface = partDoc.ComponentDefinition.WorkSurfaces.Item(1)
oWorkSurface.Translucent = False
End Sub
Inventor Professional 2012 SP1 (25 seats with subscription)
Windows 7 64 bit
Lenovo D20, 12 GB RAM, Intel Xeon X5687 3.6 GHz, SSD
Quadro 4000, driver 8.17.12.9573, dual monitors
SpacePilot, driver version 6.15.3 Firmware 3.12
Re: Turn off Translucen t using VBA
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Thank You.
I works as expected ![]()
Re: Turn off Translucen t using VBA
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
This works for part docs only, is there any way we can improve upon this to change all part surfaces in an assembly file instead of opening each part that has a surface individually?
Re: Turn off Translucen t using VBA
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Public Sub TranslucentTest()
Dim app As Inventor.Application
Set app = ThisApplication
Dim oModel As AssemblyDocument
Set oModel = ThisApplication.ActiveDocument '.iam file
'or open the assembly file as below
'Set oModel = ThisApplication.Documents.Open("D:\TestAssm.iam", False)
'then identify each part in the assembly & set the surface to opaque
Dim partDoc As PartDocument
For i = 1 To oModel.ComponentDefinition.Occurrences.Count
Set partDoc = oModel.ComponentDefinition.Occurrences.Item(i).Def
Dim oWorkSurface As WorkSurface
Set oWorkSurface = partDoc.ComponentDefinition.WorkSurfaces.Item(1)
oWorkSurface.Translucent = False
Next
End Sub
////////////////
The above code identifies each part in the assembly & changes its surface
Hope this helps

