Community
Inventor Forum
Welcome to Autodesk’s Inventor Forums. Share your knowledge, ask questions, and explore popular Inventor topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

external rule problem

9 REPLIES 9
Reply
Message 1 of 10
deltades
631 Views, 9 Replies

external rule problem

Hi,

I applied an external rule to one part of my project used to modify i properties. Too my supprise and anoyance I find that the rule has been applied to ALL my parts and assemblies including content center parts like screws nuts and bolts.

Is this supposed to happen? and can I remove it from such things as my content center parts and how?

Another problem... after finding this problem I thought OK.. I'll just embed the rule to all the parts that need it. But then I find that files generated from the frame generator can not have rules applied to them other than thru the use of external rules. Ok.. now Im really annoyed!

 

Thanks

9 REPLIES 9
Message 2 of 10
swordmaster
in reply to: deltades

depends on the code in your ilogic rule, in particular which files are selected for modification.

Post the code please 

Inventor 2010 Certified Professional
Message 3 of 10
deltades
in reply to: swordmaster

Hi. Thanks for the reply..

 

Heres the code

 

Dim oProj As String
Dim oElev As String
Dim oStock As String
Dim oDashNo As String

oProj = iProperties.Value("Project", "Project")
oElev = iProperties.Value("Summary", "Manager")
oStock = iProperties.Value("Project", "Stock Number")
'oDashNo = iProperties.Value("Custom", "DashNo")

iProperties.Value("Project", "Part Number")= oProj & "-" & oElev & oStock '& oDashNo
InventorVb.DocumentUpdate()

 

Thanks

 

 

Message 4 of 10
swordmaster
in reply to: deltades

well,

I do not see anything wrong with the  external rule

What i did was

create external rule

open an assembly

click on ilogic rule editor

select external rule tab

right click on your rule and select "run rule"

It updated the part number property of the assembly it did NOT change any of the child files. Which is correct since there is nothing in your rule to do so.

It would appear to me that somehow you are applying (executing) your rule on ALL components in session

Please detail the process you are using to apply the rule

 

thanks

Inventor 2010 Certified Professional
Message 5 of 10
cwhetten
in reply to: deltades


@deltades wrote:

Hi,

I applied an external rule to one part of my project used to modify i properties. Too my supprise and anoyance I find that the rule has been applied to ALL my parts and assemblies...


The purpose of external rules is so that your code will be available no matter which document you have open.  This doesn't mean that the code will run on every part, though.  You would either have to manually run it, or have some event trigger set up that runs the code.

 

When you say that "the rule has been applied to ALL my parts and assemblies", do you mean that the code has actually been executed on all of your files, or just that you can see the rule in your iLogic browser as if it were embedded in every file?

 

Cameron Whetten
Inventor 2012

 

Message 6 of 10
swordmaster
in reply to: cwhetten

Sorry,

I think my last reply has confused matters.

Firstly i completely agree with your statement regarding external ilogic rules and how they should work.

I created an external ilogic rule using your code, I then opened an assembly and ran the external rule.

It only updated the assembly part number iproperty, which is what i expected.

Since you are experiencing a different behaviour that led me to question how you were executing the external rule.

 

hope this is clearer

Inventor 2010 Certified Professional
Message 7 of 10
deltades
in reply to: swordmaster

Not exactly...

Procedure: Open parts that I want to have this rule added to. Activate one part to add rule to it.

Click external rules. Right click and add rule on the part, save. Go to next part in session... and I found that the external rule was already added to the part. save and close all parts.

open washer from content center to make sure the rule was not added to it and found that it was.

When removed, ALL parts had rule removed.

(Re-apply the rule to the parts I want) Open top assembly and update .

All parts that had rule applied were correctly updated.. no problem ... but all parts that were not open at the time when adding the rule which were not supposed to have the rule also had the rule added again i.e. bolts, nuts and washers from content center.

It would seem that the external rule is "added" to all parts and assemblies in the project including hardware wheather open or not.

 

Message 8 of 10
deltades
in reply to: deltades

Yes... the code is executed on all files including content center parts as if it were embedded.

Message 9 of 10
pcrawley
in reply to: deltades

Sounds odd.  You're sure it's not listed un the "External rules" tab - or added to the CC part template file?

 

From the description of what you are doing, you might want to take a look at the "Code Injector" - see http://beinginventive.typepad.com/being-inventive/2012/02/injecting-ilogic-code-and-ilogic-event-tri...

 

You can batch-select a set of files - run a rule on them all - and then delete the rule once its finished.  Code Injector is absolutely awesome and the guys who wrote it all deserve massive pay-rises!  It's saved my a$$ on plenty of occasions.

Peter
Message 10 of 10
cwhetten
in reply to: deltades


@deltades wrote:
Procedure: Open parts that I want to have this rule added to. Activate one part to add rule to it.

Click external rules. Right click and add rule ...

 


 

You are adding external rules to Inventor, NOT adding rules to individual documents.  When you add external rules, they are not added to documents (parts, assemblies, drawings, etc), they are added to the application--Inventor.  So they will appear in the list of external rules no matter which document is open.

 

If you are trying to add a rule to an individual part, don't do it on the External Rules tab.  Instead, go to the Rules tab.  Any rules added to the Rules tab will be for that document only.

 

Cameron Whetten
Inventor 2012

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

Post to forums