Message 1 of 12

Not applicable
05-26-2015
06:12 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have an assembly with an assortment of part files. Some part files need to be blue, while other part files need to be yellow. \
The code below will run w/o any errors and the part files will have the correct display name, but the appearance of the part has not been updated. I'm know there's something I'm missing, but all of the examples seems to deal w/the renderstyle, which is no longe exposed in the Inventor version I'm currently using (2015).
Anybody have any ideas as to how to proceed?
Thanks in advance!
M.
Sub Main() Dim oCurrentDoc As Inventor.Document Dim oDoc As Inventor.Document Dim oPartDoc As PartDocument 'Dim oPartDef as PartDocument.ComponentDefinition Dim oRefDoc As DocumentsEnumerator Dim oTargetColor As RenderStyle Dim oNewColor As RenderStyle Dim i As Integer Dim oPropSet As Inventor.PropertySet Dim oPropSets As Inventor.PropertySets Dim sPropSetName As String sPropSetName = "Design Tracking Properties" Dim sPropName sPropName = "Description" oCurrentDoc = ThisApplication.ActiveDocument If oCurrentDoc.DocumentType = kAssemblyDocumentObject Then For Each oDoc In oCurrentDoc.AllReferencedDocuments If oDoc.DocumentType = kPartDocumentObject Then If InStr(oDoc.FullFileName, "BareCable") > 0 Then oPartDoc = oDoc oPropSet = oPartDoc.PropertySets.Item("Design Tracking Properties") If oPropSet.Item("Description").Value = "1192.5 KCMIL 61 AAC" Then ' we make the item blue! oPartDoc.ActiveAppearance.DisplayName = "Cadet Blue" oPartDoc.Save End If If oPropSet.Item("Description").Value = "1192.5 KCMIL 38/19 ACSS/TW (STD STR)" Then ' we make the item yellow! oPartDoc.ActiveAppearance.DisplayName = "Yellow" oPartDoc.Save End If End If End If Next End If ThisApplication.ActiveView.Update End Sub
Solved! Go to Solution.