Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

ilogic - vb rule to remove colour overides

5 REPLIES 5
Reply
Message 1 of 6
dclunie
1052 Views, 5 Replies

ilogic - vb rule to remove colour overides

Hi all

 

I am looking for a rule to remove all colour overides in all assemblies 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

5 REPLIES 5
Message 2 of 6
Curtis_Waguespack
in reply to: dclunie

Hi dclunie,

 

Did this work?:

http://forums.autodesk.com/t5/Autodesk-Inventor/vb-ilogic-rule/m-p/3641848#M449749

 

If not, it might help others work out a solution.

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

Message 3 of 6
dclunie
in reply to: Curtis_Waguespack

HI Curtis 

 

 

I got the following error message when i run the rule,so i posted it on customization site as you recommended

 

Error in rule: Rule0, in document: SHR-04-0307-000.iam

Unable to cast COM object of type 'System.__ComObject' to interface type 'Inventor.PartComponentDefinition'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{DA33F1A3-7C3F-11D3-B794-0060B0F159EF}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).

 

Many thanks

 

DClunie

Message 4 of 6
Vladimir.Ananyev
in reply to: dclunie

Referenced code works with part documents only.

Add a pair of lines in your code to avoid assemblies.

'Look at all of the files referenced in the open document
Dim docFile As Document
For Each docFile In openDoc.AllReferencedDocuments

    If docFile.DocumentType = kPartDocumentObject Then  '<----- Add

        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
      
        '..............
  
    End If   '<----- Add
Next

 

 


Vladimir Ananyev
Developer Technical Services
Autodesk Developer Network

Message 5 of 6
dclunie
in reply to: Vladimir.Ananyev

Hi

 

Can i ask what do you mean add acouple of lines in code to avoid assemblies?

 

Dave

Message 6 of 6
Vladimir.Ananyev
in reply to: dclunie

These two lines have comment    '<----- Add :

 

 If docFile.DocumentType = kPartDocumentObject Then  '<----- Add
         ......... <any code here for parts only>..........
End If   '<----- Add


Vladimir Ananyev
Developer Technical Services
Autodesk Developer Network

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report