Inventor Customization

Inventor Customization

Reply
rdj
New Member
rdj
Posts: 1
Registered: ‎09-25-2009
Message 1 of 12 (1,103 Views)

iLogic, suppress pattern in 2nd level subassembly

1103 Views, 11 Replies
06-04-2012 05:45 AM

I need to suppress a pattern in an 2nd level subassembly. But is only able to do it in the same level where the pattern is placed etc:

 

If Length < 3000 mm Then

Component.IsActive("1 st level subassembly", "Name of pattern in 1nd level subassembly") = False

End If

 

But if i do it with an MakePath... etc.:

 

 If Length < 3000 mm Then

Component.IsActive(MakePath("1 st level subassembly", "2 nd level subassembly", "Name of pattern in 2nd level subassembly")) = False

End If

 

If Length < 3000 mm Then

Component.IsActive(MakePath("1 st level subassembly", "2 nd level subassembly"), "Name of pattern in 2nd level subassembly") = False

End If

 

is it not possible to suppress a pattern by an MakePath?

Employee
MjDeck
Posts: 959
Registered: ‎02-24-2009
Message 2 of 12 (1,075 Views)

Re: iLogic, suppress pattern in 2nd level subassembly

06-12-2012 07:22 PM in reply to: rdj

No, you can't suppress a pattern in a subassembly or 2nd level subassembly.  But here's a workaround:
Create a rule in the 2nd level subassembly.  Then pass the Length parameter from a rule in the top-level assembly with a statement like this:

Parameter("2 nd level subassembly", "Length") = Length

This will propagate the value from the top level assembly, and it will trigger the running of the rule in the 2nd level subassembly. 



Mike Deck
Software Developer
DLS - Mechanical Design
Autodesk, Inc.

Distinguished Contributor
Rene-J
Posts: 305
Registered: ‎05-07-2005
Message 3 of 12 (1,063 Views)

Re: iLogic, suppress pattern in 2nd level subassembly

06-13-2012 04:10 AM in reply to: rdj

Hi Rene

Try this

 

compo = Component.InventorComponent(MakePath("1 st level subassembly", "2 nd level subassembly"))

Dim oPattern As OccurrencePattern

oPattern = compo.Definition.OccurrencePatterns.Item("Name of pattern in 2nd level subassembly")

Dim oPatternElement As OccurrencePatternElement

For Each oPatternElement In oPattern.OccurrencePatternElements

    Dim oOcc As ComponentOccurrence

        For Each oOcc In oPatternElement.Occurrences

            'oOcc.Unsuppress

              oOcc.Suppress

         Next

   Next

 

InventorVb.DocumentUpdate()

 

René J

Active Contributor
128848
Posts: 31
Registered: ‎01-16-2013
Message 4 of 12 (889 Views)

Re: iLogic, suppress pattern in 2nd level subassembly

02-02-2013 02:16 AM in reply to: Rene-J

I`m trying to do something similar.

 

I have a main assemblie with several sub assemblies. Im trying to suppress a assembly within the sub assembly from the main assembly. I have made an iLogic rule in the subassembly which works, but how can I link the parameteres from the subassembly to the main assembly?

Active Contributor
128848
Posts: 31
Registered: ‎01-16-2013
Message 5 of 12 (883 Views)

Re: iLogic, suppress pattern in 2nd level subassembly

02-02-2013 03:01 AM in reply to: 128848

I figured it out!

 

If Fundament_type="Bolted connection" ThenParameter("XXXXXXXXXXXXXX:1", "Fundament") = "Bolted"Parameter("XXXXXXXXXXXXXX:1", "Fundament")="Bolted"End If
If Fundament_type = "Welded connection" ThenParameter("XXXXXXXXXXXXXX:1", "Fundament")="Welded"Parameter("XXXXXXXXXXXXXX:1", "Fundament")="Welded"End If

Mentor
mslosar
Posts: 275
Registered: ‎08-11-2004
Message 6 of 12 (856 Views)

Re: iLogic, suppress pattern in 2nd level subassembly

02-19-2013 10:53 AM in reply to: rdj

I've got this same problem.

 

I have a sub assembly with 4 parts in it that i need to switch between in different conditions. In the subassembly itself, i've got rules that disable, set invisible, and set the bom to reference for the ones that aren't used in the specific condition. In the sub it works just fine.

 

When loading the sub into the main model - all pieces are shown.

 

I tried making a rule in the main file:

 

Parameter("file.iam", "LENGTH") = ExisingVariable

 

When I run the rule in the main assembly, the parameter is sent to the sub assembly correctly, but all my pieces are still visible in the top level.

 

Is the case different when using enable/visible/BOMStructure instead of simply suppress?

 

I dont' think that's the case because I do the same thing (enable/visible/BomStructure) in my top level and I loaded that as an iam into another file and things that were disabled/invisible etc show up correctly in the upper level.

 

An odd occurence is that I have I part being diabled and invisible and it's showing at about 80-90% transparent. The other 4 things done the same way are completely invisible. Weird Weird results.

Mentor
mslosar
Posts: 275
Registered: ‎08-11-2004
Message 7 of 12 (844 Views)

Re: iLogic, suppress pattern in 2nd level subassembly

02-19-2013 11:57 AM in reply to: mslosar

Adding to the weird....

 

I removed the offending assemblies from my top level assembly and reinserted them.

 

Now it "seems" to be working correctly. Hadn't encountered that before.

Distinguished Contributor
Rene-J
Posts: 305
Registered: ‎05-07-2005
Message 8 of 12 (841 Views)

Re: iLogic, suppress pattern in 2nd level subassembly

02-19-2013 12:08 PM in reply to: mslosar

Hi

There are some difference, when using  ilogic to supress parts it is suppress the part and set BOMstructure to reference.

when you using "VBA" you have to change BOMstructure to reference when suppress.

 I have modify my code to handle this.

Rene J

 

Dim Suppress as Boolean

Suppress = True

compo = Component.InventorComponent(MakePath("1 st level subassembly", "2 nd level subassembly"))

Dim oPattern As OccurrencePattern

oPattern = compo.Definition.OccurrencePatterns.Item("Name of pattern in 2nd level subassembly")

Dim oPatternElement As OccurrencePatternElement

For Each oPatternElement In oPattern.OccurrencePatternElements

    Dim oOcc As ComponentOccurrence

        For Each oOcc In oPatternElement.Occurrences

          If Suppress = False Then

            oOcc.Unsuppress  

            oOcc.BOMStructure = 51969 'kDefaultBOMStructure = 51969  

          Else

              If  oOcc.Suppressed = True

                oOcc.Unsuppress

             End If  

          oOcc.BOMStructure = 51972 'kReferenceBOMStructure = 51972

          oOcc.Suppress  

        End If  

     Next

  Next

InventorVb.DocumentUpdate()

Mentor
mslosar
Posts: 275
Registered: ‎08-11-2004
Message 9 of 12 (838 Views)

Re: iLogic, suppress pattern in 2nd level subassembly

02-19-2013 12:14 PM in reply to: Rene-J

Here's what I do:

 

 

IF REF_YN = 1 then

 

RefYN.Enabled = True

RefYN.Visible = True

RefYN.BOMStructure = 51969

else

RefYN.Enabled = False

RefYN.Visible = False

RefYN.BOMStructure = 51972

End If

 

Based on the condition I either turn the parts on/off. As you can see I set the BOM as well, i do not use suppress itself because I don't want to deal with LOD's as they were giving me all kinds of errors before. This does the same thing and I don't have to deal with LOD's or the errors.

 

Turns out it's not working again (though the transparencey issue seems ok (fingers crossed)).

 

I have a section of pipe that can be 1-2 pipe(s), 1-2 plate(s), or a combination thereof. In one specific case, i have 4 different ends on just one section of the pipe. Seems when i use ComponentReplace to swatch the pieces around, after a couple swaps, the connection what is/isn't visible in the sub assembly gets lost. That's driving me nuts at the moment because otherwise i'm nearly finished :smileyhappy:

 

 

Mentor
mslosar
Posts: 275
Registered: ‎08-11-2004
Message 10 of 12 (834 Views)

Re: iLogic, suppress pattern in 2nd level subassembly

02-19-2013 12:29 PM in reply to: mslosar

Here's something interesting - if i place the model into a drawing sheet, it shows up correctly as in only the piece that is supposed to show up shows up.

 

Of course the drawing sheet is making use of reference and not visible/enabled. Not sure what there's a disconnect on those and it's driving me crazy.

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.