Inventor General Discussion

Reply
Contributor
Olgan
Posts: 15
Registered: ‎06-13-2012
Message 1 of 33 (1,574 Views)
Accepted Solution

Cannot suppress pattern element using ilogic

1574 Views, 32 Replies
08-09-2012 10:29 PM

I'm trying to use ilogic to suppress some individual elements of a pattern but i couldnt find any command that can target component pattern elements. When i try to capture its current state with the right click menu it does nothing.

I can of course suppress the part within the element but then it doesn't update the BOM.

 

Any comment or suggestion is appreciated

Contributor
Olgan
Posts: 15
Registered: ‎06-13-2012
Message 2 of 33 (1,541 Views)

Re: Cannot suppress pattern element using ilogic

08-12-2012 10:48 PM in reply to: Olgan

no one?

 

*Expert Elite*
Curtis_Waguespack
Posts: 2,802
Registered: ‎03-08-2006
Message 3 of 33 (1,542 Views)

Re: Cannot suppress pattern element using ilogic

08-13-2012 06:37 AM in reply to: Olgan

 

Hi Olgan,

 

Here is some example code that will suppress the 4th element of an assembly pattern named Component Pattern 1:1.

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

 

Dim oDoc As AssemblyDocument
oDoc = ThisApplication.ActiveDocument

'reference the pattern in the assembly 
Dim oPattern As OccurrencePattern
oPattern = oDoc.ComponentDefinition.OccurrencePatterns.Item("Component Pattern 1:1") 'calls the pattern by name
'oPattern = oDoc.ComponentDefinition.OccurrencePatterns.Item(1) 'use this to call the pattern by item number

'suppress the 4th element
Dim oElement As OccurrencePatternElement
oPattern.OccurrencePatternElements.Item(4).Suppressed=True

 



  solution.png  Did you find this reply helpful ? If so please use the Accept as Solution or  Kudos button below.





Contributor
Olgan
Posts: 15
Registered: ‎06-13-2012
Message 4 of 33 (1,528 Views)

Re: Cannot suppress pattern element using ilogic

08-13-2012 06:54 AM in reply to: Curtis_Waguespack

thank you very much. did exactly what i wanted

 

Active Member
Kyle_of_Australia
Posts: 10
Registered: ‎01-10-2011
Message 5 of 33 (1,473 Views)

Re: Cannot suppress pattern element using ilogic

10-04-2012 10:05 PM in reply to: Olgan

I'm attempting a similar operation, but when I copy Curtis' code I get the following error:

 

Error on Line 11 : Method arguments must be enclosed in parentheses.

(Note: Line 11 is the last line of the code.)

 

I'm pretty green when it comes to iLogic; I don't understand this error message (specifically what a method argument is).

 

Any help is appreciated!

*Expert Elite*
mrattray
Posts: 2,470
Registered: ‎09-13-2011
Message 6 of 33 (1,465 Views)

Re: Cannot suppress pattern element using ilogic

10-05-2012 04:28 AM in reply to: Kyle_of_Australia

Sounds like you made a typo. Post the code you're using in a txt file.

Mike (not Matt) Rattray

Active Member
Kyle_of_Australia
Posts: 10
Registered: ‎01-10-2011
Message 7 of 33 (1,444 Views)

Re: Cannot suppress pattern element using ilogic

10-07-2012 07:24 PM in reply to: mrattray

Greetings, distinguished mentor.

 

Funny thing is that I get the error message even if I do a straight copy/paste of Curtis' code above - without changing anything. I just went and tried it again, same deal.

 

But, just in case there's something really dumb I'm missing, I'll do what you ask.

Distinguished Mentor
swordmaster
Posts: 538
Registered: ‎12-15-2008
Message 8 of 33 (1,421 Views)

Re: Cannot suppress pattern element using ilogic

10-08-2012 09:56 AM in reply to: Olgan

Look carefully at your code, you have two ? (questionmarks) . This is what is causing the problem.

This is a common problem with cutting/pasting code directly from posts.

 

Inventor 2010 Certified Professional
Active Member
Kyle_of_Australia
Posts: 10
Registered: ‎01-10-2011
Message 9 of 33 (1,397 Views)

Re: Cannot suppress pattern element using ilogic

10-08-2012 05:45 PM in reply to: swordmaster

Hi Swordmaster. Thanks for lookin' into my case. 

 

Very interesting with the question marks, I did not notice that before. However, they seem (to me at least) to have been produced by the copy from Inventor to Notepad, not the copy from this forum to Inventor. I am attaching a screenshot that shows the code in my rule editor. No visible question marks; still get the parentheses error.

 

=/

 

 

*Expert Elite*
Curtis_Waguespack
Posts: 2,802
Registered: ‎03-08-2006
Message 10 of 33 (1,391 Views)

Re: Cannot suppress pattern element using ilogic

10-08-2012 06:39 PM in reply to: Olgan

Hi Kyle_of_Australia,

 

In addition to the extra characters that swordmaster mentioned, the thing that I notice is that in the example code, the pattern that is being called is named "Component Pattern 1:1" , if you change that name to one of the named patterns in your assembly ("Outside Ctrack Pattern" for example) then I think you'll see it work. That is, if the named pattern has at least 4 elements, since the example is suppressing element 4.

 

Give this a shot and post back if you see still see errors.

 

Dim oDoc As AssemblyDocument
oDoc = ThisApplication.ActiveDocument

'reference the pattern in the assembly 
Dim oPattern As OccurrencePattern 
'calls the pattern by name oPattern = oDoc.ComponentDefinition.OccurrencePatterns.Item("Outside Ctrack Pattern") 'suppress the 4th element Dim oElement As OccurrencePatternElement oPattern.OccurrencePatternElements.Item(4).Suppressed=True

 I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com



  solution.png  Did you find this reply helpful ? If so please use the Accept as Solution or  Kudos button below.





You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community


Inventor Exchange Apps

Created by the community for the community, Autodesk Exchange Apps for Autodesk Inventor helps you achieve greater speed, accuracy, and automation from concept to manufacturing.

Connect with Inventor

Twitter

Facebook

Blogs

Pinterest

Youtube