• Industries
  • Products
  • Buy
  • Services & Support
  • Communities
  • Discussion Groups

    Autodesk Inventor Customization

    Reply
    rdj
    New Member
    Posts: 1
    Registered: ‎09-25-2009

    iLogic, suppress pattern in 2nd level subassembly

    387 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?

    Please use plain text.
    Employee
    Posts: 932
    Registered: ‎02-24-2009

    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.

    Please use plain text.
    Distinguished Contributor
    Posts: 299
    Registered: ‎05-07-2005

    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

    Please use plain text.
    Contributor
    Posts: 24
    Registered: ‎01-16-2013

    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?

    Please use plain text.
    Contributor
    Posts: 24
    Registered: ‎01-16-2013

    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

    Please use plain text.
    Valued Contributor
    Posts: 70
    Registered: ‎08-11-2004

    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.

    Please use plain text.
    Valued Contributor
    Posts: 70
    Registered: ‎08-11-2004

    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.

    Please use plain text.
    Distinguished Contributor
    Posts: 299
    Registered: ‎05-07-2005

    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()

    Please use plain text.
    Valued Contributor
    Posts: 70
    Registered: ‎08-11-2004

    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:

     

     

    Please use plain text.
    Valued Contributor
    Posts: 70
    Registered: ‎08-11-2004

    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.

    Please use plain text.