Hi all
I am looking for a rule to remove all colour overides in all assemblys and .ipts
When we merged all our data across to inventor 2013 all our visual styles and materials where all over the place and has still to be resolve by autodesk.However when we update our parts via stlyes and stds some .ipts have a colour overide assigned to them and we have to go into each part individually to remove the colour overide.
Is there a rule that will work at top level and look down stream and remove all colour overides in all .ipts and iams without editing all individually
Removing apperance overides does not work for this
any thought's on this would be appreciated
Dave
Solved! Go to Solution.
Solved by Curtis_Waguespack. Go to Solution.
Hi dclunie,
This should get you started. I didn't have much time to test it thoroughly, so you might encounter issues with sub assemblies, design view reps, etc. But this should get the ball rolling.
Also note that you might get better results with programming type questions on the customization forum:
http://forums.autodesk.com/t5/Autodesk-Inventor-Customization/bd-p/120
I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com
Dim oAsmCompDef As AssemblyComponentDefinition
oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition
'set Master view rep active
Dim oViewRep As DesignViewRepresentation
oViewRep =oAsmCompDef.RepresentationsManager.DesignViewRepresentations.Item("Master")
oViewRep.Activate
'Define the open document
Dim openDoc As Document
openDoc = ThisDoc.Document
'Look at all of the files referenced in the open document
Dim docFile As Document
For Each docFile In openDoc.AllReferencedDocuments
'format file name
Dim FNamePos As Long
FNamePos = InStrRev(docFile.FullFileName, "\", -1)
Dim docFName As String
docFName = Right(docFile.FullFileName, Len(docFile.FullFileName) - FNamePos)
Dim oCompDef As Inventor.PartComponentDefinition
oCompDef = docFile.ComponentDefinition
'Iterate through all features
Dim oFeature As PartFeature
For Each oFeature In oCompDef.Features
'Set the render style to be "As Body"
oFeature.SetRenderStyle(37125)
Next
'Iterate through all solids
For Each Solid In oCompDef.SurfaceBodies
'Set the render style to be "As Part"
Solid.SetRenderStyle(37121, True)
'Iterate through all faces.
Dim oFace As Face
For Each oFace In Solid.Faces
' Set the render style to be "As Feature"
oFace.SetRenderStyle(37122)
Next
Next
Next
iLogicVb.UpdateWhenDone = True
Hi dclunie,
I just noticed the code below does not handle sub assemblies well at all, and errors out when the top level assembly contains a subassembly. So just be aware of that.
Also I'd left in a few extra lines of code that were un-needed, I've removed them in the version posted below.
I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com
Dim oAsmCompDef As AssemblyComponentDefinition
oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition
'set Master view rep active
Dim oViewRep As DesignViewRepresentation
oViewRep =oAsmCompDef.RepresentationsManager.DesignViewRepresentations.Item("Master")
oViewRep.Activate
'Define the open document
Dim openDoc As Document
openDoc = ThisDoc.Document
'Look at all of the files referenced in the open document
Dim docFile As Document
For Each docFile In openDoc.AllReferencedDocuments
Dim oCompDef As Inventor.PartComponentDefinition
oCompDef = docFile.ComponentDefinition
'Iterate through all features
Dim oFeature As PartFeature
For Each oFeature In oCompDef.Features
'Set the render style to be "As Body"
oFeature.SetRenderStyle(37125)
Next
'Iterate through all solids
For Each Solid In oCompDef.SurfaceBodies
'Set the render style to be "As Part"
Solid.SetRenderStyle(37121, True)
'Iterate through all faces.
Dim oFace As Face
For Each oFace In Solid.Faces
' Set the render style to be "As Feature"
oFace.SetRenderStyle(37122)
Next
Next
Next
iLogicVb.UpdateWhenDone = True
Can't find what you're looking for? Ask the community or share your knowledge.