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
Solved! Go to Solution.
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
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?
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
The above code identifies each part in the assembly & changes its surface
Hope this helps
Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register
Start with some of our most frequented solutions to get help installing your software.