Inventor General Discussion

Inventor General Discussion

5 Posts
0 Kudos
Registered: ‎12-13-2011
Post 1 of 4

Excel parameters - disable parts

593 Views, 3 Replies
12-13-2011 04:02 AM

Hi there,


I have linked my inventor drawing to excel to adjust some parameters. Is it also possible to have a enable/disable function in excel so a part in an assembly can be disabled at will?


Thanks in advance!



Active Contributor
49 Posts
4 Kudos
Registered: ‎03-24-2011
Post 2 of 4

Re: Excel parameters - disable parts

12-13-2011 04:28 AM in reply to: m.rondeel



which version of Inventor do you use?


If you have ilogic on board you can solve it by using a specific value in your excel.


If value_x=1 then suppress feature y 


You only need a trigger to give inventor the start sign. 


Best Regards



5 Posts
0 Kudos
Registered: ‎12-13-2011
Post 3 of 4

Re: Excel parameters - disable parts

12-13-2011 04:58 AM in reply to: Passi

Thanks for the reply,


I use the lastest version, 2012 SP1, only i never worked with iparts. 


I tried to 'add rule' and then inserted this

If value_x=0 Then suppress Component.IsActive("part") = True
But this generates errors (not english)
Error on Line 1: The name was not suppress declared.
Error on Line 1: Method arguments must be enclosed in brackets.
Active Contributor
49 Posts
4 Kudos
Registered: ‎03-24-2011
Post 4 of 4

Re: Excel parameters - disable parts

12-13-2011 05:57 AM in reply to: m.rondeel

I hope you don't insert the code example that way, it was only a text for describing what I mean and not a correct syntax :smileywink:


I thinked about it and i think, I'ts not possible to create it via ilogic, because in my opinion you have to create a single LOD  for each variant. But I will think about it later on :smileyhappy:


So it's better to create it via VBA.


This is a example for Suppressing a part in an assembly, if you know the correct name and folder of the part you want to suppress: In this case it's the part "flange.ipt" in "c:\"


Public Sub Suppress()
    Dim AssemblyDoc As AssemblyDocument
    Set AssemblyDoc = ThisApplication.ActiveDocument

    Dim AssemblyDef As AssemblyComponentDefinition
    Set AssemblyDef = AssemblyDoc.ComponentDefinition
    On Error GoTo Error1:
    Dim SearchPart As Document
    Set SearchPart = ThisApplication.Documents.ItemByName("C:\flange.ipt")
    Dim SearchPartOccurrence As ComponentOccurrencesEnumerator
    Set SearchPartOccurrence = AssemblyDef.Occurrences.AllReferencedOccurrences(SearchPart)

    Dim OccurrenceOfSearchPart As ComponentOccurrence
    For Each OccurrenceOfSearchPart In SearchPartOccurrence
OccurrenceOfSearchPart.Suppress True
Next Error1: End Sub


Then Inventor will create a LOD by it's own. But you have to execute the Macro to create the changes. Or you create a start for the macro by open the assembly doc.



Post to the Community

Have questions about Autodesk products? Ask the community.

New Post