Inventor General Discussion

Inventor General Discussion

Reply
Member
m.rondeel
Posts: 5
Registered: ‎12-13-2011
Message 1 of 4 (581 Views)

Excel parameters - disable parts

581 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
Passi
Posts: 49
Registered: ‎03-24-2011
Message 2 of 4 (576 Views)

Re: Excel parameters - disable parts

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

Hi,

 

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

 

Passi 

Member
m.rondeel
Posts: 5
Registered: ‎12-13-2011
Message 3 of 4 (572 Views)

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)
translated:
Error on Line 1: The name was not suppress declared.
Error on Line 1: Method arguments must be enclosed in brackets.
Active Contributor
Passi
Posts: 49
Registered: ‎03-24-2011
Message 4 of 4 (559 Views)

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
Announcements
Are You Going To Be @ AU 2014? Feel free to drop by our AU topic post and share your plans, plug a class that you're teaching, or simply check out who else from the community might be in attendance. Ohh and don't forgot to stop by the Autodesk Help | Learn | Collaborate booths in the Exhibit Hall and meet our community team if you get a chance!