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: 

Help with Rules

12 REPLIES 12
Reply
Message 1 of 13
ASchlaack
1223 Views, 12 Replies

Help with Rules

I was given this scrip:

 

Spoiler
oApp = ThisApplication
oDoc = oApp.ActiveDocument
oPane = oDoc.BrowserPanes("Model")
oTopNode = oPane.TopNode
   
'Define which folder to suppress
folder = oTopNode.BrowserFolders.Item("test")

oSelectSet = oDoc.SelectSet
oSelectSet.Clear
   
'Select the folder automaticly
oSelectSet.Select(folder)

MsgBox (folder.Name & " is selected.")
Dim oCommandMgr As CommandManager
oCommandMgr = oApp.CommandManager

'Toggle suppress or unsuppress
oCommandMgr.ControlDefinitions.Item("AssemblyCompSuppressionCtxCmd").Execute2(True)

 

 

It is suppose to be for sing Rules to supress a folder on the model tree. Can someone please explain this script to me please?

For an example I have a folder "0-59" and this folder needs to be on if LENGTH <=60 inch. How would I put that in?

 

And just for all credits due, this script was from jdkriek on form post:

http://forums.autodesk.com/t5/Inventor-Customization/Supress-entire-folder-How/m-p/3589854#M39778

Thanks,
Aaron Schlaack
---------------------------------------------------------------------------------
Autodesk Inventor 2018
Dell Windows 8.1 64 bit Intel(R) Xeon(R) @ 3.50GHz 32GB Ram
12 REPLIES 12
Message 2 of 13

Hi ASchlaack,

 

Here is a quick example iLogic rule:

 

LENGTH  = InputBox("Enter a Value ", "iLogic", 50)

oApp = ThisApplication
oDoc = oApp.ActiveDocument
oPane = oDoc.BrowserPanes("Model")
oTopNode = oPane.TopNode

If LENGTH <= 59 Then
	'Get the browser folder object
	oFolder = oPane.TopNode.BrowserFolders.Item("0-59") 
	'Get the set of nodes in the folder
	oFolderNodes = oFolder.BrowserNode.BrowserNodes 
	'Cycle through each browser node in the folder
	For Each oNode As BrowserNode In oFolderNodes 
		oComp = oNode.NativeObject
		‘suppress folder contents
		oComp.Suppress
	Next
Else If LENGTH >= 60 and LENGTH <= 120 Then
	'Get the browser folder object
	oFolder = oPane.TopNode.BrowserFolders.Item("60-120") 
	'Get the set of nodes in the folder
	oFolderNodes = oFolder.BrowserNode.BrowserNodes 
	'Cycle through each browser node in the folder
	For Each oNode As BrowserNode In oFolderNodes 
		oComp = oNode.NativeObject
		‘suppress folder contents
		oComp.Suppress
	Next
Else 
End If

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

Message 3 of 13

Ok, so I get where to put the numbers but how should I link the folders to that rule?

Thanks,
Aaron Schlaack
---------------------------------------------------------------------------------
Autodesk Inventor 2018
Dell Windows 8.1 64 bit Intel(R) Xeon(R) @ 3.50GHz 32GB Ram
Message 4 of 13

Hi ASchlaack,

 

As I understand it you have multiple browser folders in your assembly. And you want to run the iLogic rule and have it do one of these:

 

A ) The iLogic rule will read a parameter that was manually changed by the user, and then suppress the contents of one of the folders based on the parameter value.

 

or

 

B ) The iLogic rule allows the user to change the parameter, and then suppresses the contents of one of the folders based on the parameter value.

 

However, I suspect the best way to do this is:

 

C ) Start off with the all of the of the folder contents suppressed. Then the iLogic rule allows the user to change the parameter and then unsuppresses the contents of one of the folders based on the parameter value.

 

or

 

D) Start off with the all of the of the folder contents unsuppressed. Then the iLogic rule allows the user to change the parameter and then suppresses the contents of one of the folders based on the parameter value.

 

 

 

In anycase I don't follow your question about "linking" the folders. Could you provide more details about what you mean by "linking" and which of the above options (A-D) sounds like what you're after? If none of them sound right, please provide further details (maybe even some screen shots), and I'll try and come up with a workable example.

 

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

 

 

Message 5 of 13

I think I'm not saying the correct thing... I get what your saying to do but i have NO clue how to do that.

 

 

I have 5 folders:

  • ALWAYS ON
  • 0-59
  • 60-119
  • 120-179
  • 180-239

*The one named ALWAYS ON obviously I want to always be unsupressed.

 

 And I have a user parameter "LENGTH"

 

 

When LENGTH <= 60 inch I want  folder 0-59 to be the only one unsupressed.

When LENGTH >60 inch AND <= 120 inch I want folder 60-119 to be the only one unsupressed.

When LENGTH >120 inch AND <= 180 inch I want folder 120-179 to be the only one unsupressed.

When LENGTH >180 inch AND <= 240 inch I want folder 180-239 to be the only one unsupressed.

Thanks,
Aaron Schlaack
---------------------------------------------------------------------------------
Autodesk Inventor 2018
Dell Windows 8.1 64 bit Intel(R) Xeon(R) @ 3.50GHz 32GB Ram
Message 6 of 13

Hi ASchlaack,

 

Attached is an assembly file and a part file that you can use to see how I've set this up. I've used different values that are base on the component occurrence number, rather than the part lengths, just to keep things simple for my example, but it should give you a good idea of how to proceed with your objective.

 

 

Autodesk Inventor iLogic Browser Folder LOD.png

 

Basically I've set up multiple simple rules, and then I have a main rule that runs some of the other rules based on the value of the Parameter named LENGTH. The rules that get run control the suppression of the browser folder contents.

 

Here is what the Main Rule looks like:

 

Autodesk Inventor iLogic Browser Folder LOD2.png 

 

 

To test these files you can just save the assembly and it will automatically run the rule named Main Rule. Or you can run it manually from the iLogic Rule Editor Tree. There is also a rule named Reset, that you can run manually.

 

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

 

 

Message 7 of 13

Curtis, that is awesome! Thank you so much! I'll take a look at this and hopefully this should get this to work finally!

Thanks,
Aaron Schlaack
---------------------------------------------------------------------------------
Autodesk Inventor 2018
Dell Windows 8.1 64 bit Intel(R) Xeon(R) @ 3.50GHz 32GB Ram
Message 8 of 13

I transfered your rules all over but I'm now getting this:

 

2014-08-06_1059.png

 

Any ideas on whats going on?

Thanks,
Aaron Schlaack
---------------------------------------------------------------------------------
Autodesk Inventor 2018
Dell Windows 8.1 64 bit Intel(R) Xeon(R) @ 3.50GHz 32GB Ram
Message 9 of 13
skyngu
in reply to: Curtis_Waguespack

hi,

 

when i tried  saving assembly in LOD level, it gave me an enedless loop. it kept asking me test value. I have to end inventor process in task manager.

 

do you know why?

 

thanks.

Autodesk Inventor Professional 2019
Message 10 of 13
ASchlaack
in reply to: skyngu

That would mean two things are dependent on eachother for a parameter... can you post what your working on?

Thanks,
Aaron Schlaack
---------------------------------------------------------------------------------
Autodesk Inventor 2018
Dell Windows 8.1 64 bit Intel(R) Xeon(R) @ 3.50GHz 32GB Ram
Message 11 of 13

Hi ASchlaack,

 

Concerning Unsuppress error, this is a method of ComponentOccurrence not BrowserFolder, so I'm guessing you have a mistake in your code. In case of a doubt, simply open the API Help Files and look for the method you are invoking:

 

help.png

 

Regards,

Philippe.



Philippe Leefsma
Developer Technical Services
Autodesk Developer Network

Message 12 of 13
skyngu
in reply to: ASchlaack

i am using the files you posted. I didnt change anything. I can save the file in master level not LOD. thanks.

Autodesk Inventor Professional 2019
Message 13 of 13
ASchlaack
in reply to: skyngu

I'm not sure, I was never able to get it to work at all.. I ended up taking a very different approch to get a working result.

Thanks,
Aaron Schlaack
---------------------------------------------------------------------------------
Autodesk Inventor 2018
Dell Windows 8.1 64 bit Intel(R) Xeon(R) @ 3.50GHz 32GB Ram

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

Post to forums  

Autodesk Design & Make Report