Hello Everyone
I like to change the suppression on specific files in a folder within a assembly tree.
I realized it without folder and it works fine. Now I have two Folders with nearly same content and want to unsuppress a specific part in folder "Mast1" and a different part in folder "Mast2" . We get the specific component name from the Parameter Table in the Parameters "Mast1Nr" and "Mast2Nr". How do I realize that?
(The early working code I coded [without folders] is attached)
Solved! Go to Solution.
Solved by mgasser8SSYT. Go to Solution.
Hi see helpful article here.
Code is from the link. Adjust as needed.
Sub Main()
Dim oDoc As AssemblyDocument
oDoc = ThisApplication.ActiveDocument
Dim oPane As BrowserPane
oPane = oDoc.BrowserPanes("Model")
Dim oTopNode As BrowserNode
oTopNode = oPane.TopNode
Dim oFolder As BrowserFolder
oFolder = oTopNode.BrowserFolders.Item("MyFolder")
Call SuppressFolder(oFolder)
End Sub
' Recursive function as there could be subfolders too
Sub SuppressFolder(oFolder As BrowserFolder)
Dim oItem As BrowserNode
For Each oItem In oFolder.BrowserNode.BrowserNodes
Dim oObj As Object
oObj = oItem.NativeObject
If TypeOf oObj Is BrowserFolder Then
Call SuppressFolder(oObj)
ElseIf TypeOf oObj Is ComponentOccurrence Then
Dim oOcc As ComponentOccurrence
oOcc = oObj
If Not oOcc.Suppressed Then Call oOcc.Suppress
ElseIf TypeOf oObj Is OccurrencePattern Then
Dim oPatt As OccurrencePattern
oPatt = oObj
Dim oElem As OccurrencePatternElement
For Each oElem In oPatt.OccurrencePatternElements
For Each oOcc In oElem.Occurrences
If Not oOcc.Suppressed Then Call oOcc.Suppress
Next
Next
End If
Next
End Sub
Thank you.
First you have to know I'm a newbie on coding in Inventor. I'm programming the code as rule direct in iLogic.
But I think the problem is exactly what ist described in the article you posted. The thing is, I do not understand how to "set the Embed Interop Type to False".
I opened the VBA-Editor (with alt + F11) but the code window is empty and I can't find any parameter called "autodesk.inventor.interop" parameter.
How do I proceed to solve the Problem?
The posted code is for the ilogic editor which uses ilogic (iLogic API) and VB.Net language. You have the VBA editor open which will use VBA language. In any case theat article has both VBA and ilogic code so you can choose.
If your new to coding I would suggest you start with ilogic as this will give you the most help on the forum, and will allow you to use ilogic snippets directly so can generate less complicated code for non skilled users.
On the use of VBA it has less presence on the forums and it can be very rigid for new users. although the Inventor help samples are written in VBA they can be switched over to VB.Net relatively easily.
In my case I learned ilogic first and learned VBA indirectly so I could understand the conversions between the two.
Thanks.
I tried your posted code. It works but. It manipulates the hole Folder and not only the specific component within the folder. Sadly I can't imagine how to change the code for specific component manipulation within a folder.
I tried with help from Chat-GPT which work surprisingly good but not for this specific Problem.
In a further step i like to use "changerow" for an other specific component in the same folder.
Added 14:31
I think I got it. Now I changed your code as in the attached File.
(How do I post the code that it looks the way it looks in your post?)
Yes. I got the Code that works for me.
In the Folder "Mast1" are 4 different Masts but Only one Mast should be displayed.
Which Mast has to be displayed is defined in the parameter table ("fx" in Inventor)
So here my final code:
See below screenshots
Can't find what you're looking for? Ask the community or share your knowledge.