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, suppress pattern in 2nd level subassembly

12 REPLIES 12
Reply
Message 1 of 13
rdj
Contributor
3507 Views, 12 Replies

iLogic, suppress pattern in 2nd level subassembly

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?

12 REPLIES 12
Message 2 of 13
MjDeck
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
Autodesk, Inc.

Message 3 of 13
Rene-J
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

Message 4 of 13
128848
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?

Message 5 of 13
128848
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

Message 6 of 13
mslosar
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.

Message 7 of 13
mslosar
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.

Message 8 of 13
Rene-J
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()

Message 9 of 13
mslosar
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 🙂

 

 

Message 10 of 13
mslosar
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.

Message 11 of 13
Rene-J
in reply to: rdj

HI

Have you set the drawing view to using the corrent  LOD or REPs of you assembly ?

 

Rene J

Message 12 of 13
mslosar
in reply to: Rene-J

I just figured out the problem....something i didn't know would be an issue.

 

At the top level, i'm switching between different pieces as I said before. 2 pieces of pipe, 1 piece of pipe, 1 pipe 1 plate, 2 pieces of plate, etc. In all i've got 7 different pieces i'm switching between with ComponentReplace. That part never had any issues until today.

 

I had just started to add those 4 pieces that were all showing up in the first of the sub-assemblies i was switching between. And that's where the problem began.

 

As it turns out, of my 7 choices, all are assemblies - but one. When I set it to a single piece of pipe, i just used the ipt file because it seemed kind of pointless to make an assembly for a single part. Turns out, though, that i could swap between the assemblies and the tip pieces that were supposed to be off stayed off and the one that was on stayed on. When i swapped to to the part file, it apparently would break the connection between the assembly file and the top level forcing all pieces to be on and visible. With the connection broken, nothing could restore it other than deleting the assembly from the top level and reinserting it. Didn't make sense that that could be the reason, but when i replaced it with an assembly it was fine. I've switched between all the options now and haven't had it be incorrect yet.

 

More ironically,the one part file was the piece i had planned on adding the different tips to next. Had I started there instead there'd have been no problem 🙂

 

Now, just 'knock on wood' that it's the actual permanent solution 🙂

Message 13 of 13
Murkemur
in reply to: MjDeck

What about a Pattern Component in a Frame. I can't supress it or make it invisible, the workaround doesn't work inside the Frame.

 

Is there a way to supress a Pattern in a Frame?

 

-Mark

Inventor Professional 2014
Autodesk 3Ds Max Game Artist Certified Professional

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

Post to forums  

Autodesk Design & Make Report