Ilogic rule created by someone who left the company not working. Help needed

Ilogic rule created by someone who left the company not working. Help needed

arnaud.henry-lefort
Explorer Explorer
157 Views
10 Replies
Message 1 of 11

Ilogic rule created by someone who left the company not working. Help needed

arnaud.henry-lefort
Explorer
Explorer

Hello,

 

Sadly the person who did our ilogic left and since the last update the rules are not working anymore.

I am wondering if someone can help to make them work again ?

'Activate current document
oDocType = ThisApplication.ActiveDocument

'hide error
ThisApplication.SilentOperation = True

'Exit if current document is a drawing
If oDocType = kDrawingDocumentObject Then
	Return
End If

'Exit if current document is a not and assembly
If oDocType <> kAssemblyDocumentObject Then
	Return
End If

Dim oDoc As Document = ThisDoc.Document
Dim oDef As AssemblyDocument = oDoc
Dim AppearanceLibraryName As String = "Rootwave Finish Library"

' Get the appearance library
Dim AppLib As AssetLibrary = Nothing
Try
	AppLib = ThisApplication.AssetLibraries.Item(AppearanceLibraryName)
Catch
	MsgBox("Couldn't find a appearance library called '" & AppearanceLibraryName,, "Error")
	Exit Sub
End Try

Dim AppColours As AssetsEnumerator = AppLib.AppearanceAssets
Dim ColourArray As New ArrayList

' Write all the appearance names to an arraylist
For Each A As Asset In AppColours
    ColourArray.Add(A.DisplayName)
Next

 Sort the array alphabetically
ColourArray.Sort()

' Create 3 parameters with the list of appearances in......

 Parameter 1
Try
MultiValue.List("RootwaveFinish") = ColourArray
Catch
 Parameter doesn't exist - create it
Dim oParam As Parameter = oDef.Parameters.UserParameters.AddByValue("RootwaveFinish", ColourArray(0), UnitsTypeEnum.kTextUnits)
MultiValue.List("RootwaveFinish") = ColourArray
End Try
0 Likes
158 Views
10 Replies
Replies (10)
Message 2 of 11

marcin_otręba
Advisor
Advisor

check now:

'Activate current document
oDocType = ThisApplication.ActiveDocumentType

'hide error
ThisApplication.SilentOperation = True

'Exit if current document is a not and assembly
If oDocType <> kAssemblyDocumentObject Then
	Return
End If

Dim oDoc As Document = ThisDoc.Document
Dim oDef As AssemblyComponentDefinition = oDoc.componentdefinition
Dim AppearanceLibraryName As String = "Rootwave Finish Library"

' Get the appearance library
Dim AppLib As AssetLibrary = Nothing
Try
	AppLib = ThisApplication.AssetLibraries.Item(AppearanceLibraryName)
Catch
	MsgBox("Couldn't find a appearance library called '" & AppearanceLibraryName,, "Error")
	Exit Sub
End Try

Dim AppColours As AssetsEnumerator = AppLib.AppearanceAssets
Dim ColourArray As New ArrayList

' Write all the appearance names to an arraylist
For Each A As Asset In AppColours
    ColourArray.Add(A.DisplayName)
Next

 'Sort the array alphabetically
ColourArray.Sort()

' Create 3 parameters with the list of appearances in......

 'Parameter 1
Try
MultiValue.List("RootwaveFinish") = ColourArray
Catch
 'Parameter doesn't exist - create it
Dim oParam As Parameter = oDef.Parameters.UserParameters.AddByValue("RootwaveFinish", ColourArray(0), UnitsTypeEnum.kTextUnits)
MultiValue.List("RootwaveFinish") = ColourArray
End Try
ThisApplication.SilentOperation = False

 

Hi, maybe you want to check my apps:


DrawingTools   View&ColoringTools   MRUFolders

Message 3 of 11

bradeneuropeArthur
Mentor
Mentor

Maybe I can provide you and all others a tip.

Declare everything correctly even if i-logic lets you work without doing it correct.

If this was done in the beginning the programmer found out their mistake in the early phase and you were not left in the dark.

 

Please let us know if you need any support.

I can imagine that this will more often going to happen in future maybe.

Let us guide you through this phase then.

 

Good job @marcin_otręba 

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 4 of 11

arnaud.henry-lefort
Explorer
Explorer

Thanks for this.

Can you let me know what you changed ? I can't see the difference 🙄

0 Likes
Message 5 of 11

arnaud.henry-lefort
Explorer
Explorer

Well I have probably 5 / 6 script that do not work anymore and I try to find what they use to do 😞 if you want to jump in you are welcome !

0 Likes
Message 6 of 11

marcin_otręba
Advisor
Advisor

sure, 

 

i corrected variable doctype to be assigned as it suposed:

was:

oDocType = ThisApplication.ActiveDocument

correct: 

oDocType = ThisApplication.ActiveDocumentType

 also oDef should be definition instead of document:

was:

Dim oDef As AssemblyDocument = oDoc

correct: 

Dim oDef As AssemblyComponentDefinition = oDoc.componentdefinition

i also corrected missing comment quotes:

 

Sort the array alphabetically
ColourArray.Sort()

' Create 3 parameters with the list of appearances in......

 Parameter 1

 to:

'Sort the array alphabetically
ColourArray.Sort()

' Create 3 parameters with the list of appearances in......

 'Parameter 1

 

Hi, maybe you want to check my apps:


DrawingTools   View&ColoringTools   MRUFolders

0 Likes
Message 7 of 11

bradeneuropeArthur
Mentor
Mentor

Yes please give me access to your code and I will have a look.

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 8 of 11

bradeneuropeArthur
Mentor
Mentor
'Activate current document
Dim InvApp As Inventor.Application = ThisApplication
Dim oDoc As Document = ThisDoc.Document
Dim oDocType As Inventor.DocumentTypeEnum = oDoc.DocumentType

'Exit if current document is a not and assembly
If Not oDocType = DocumentTypeEnum.kAssemblyDocumentObject Then	
	Exit Sub
End If

Dim oDef As AssemblyComponentDefinition = oDoc.componentdefinition
Dim AppearanceLibraryName As String = "Rootwave Finish Library"
Dim AppLib As AssetLibrary = Nothing

Try
	AppLib = InvApp.AssetLibraries.Item(AppearanceLibraryName)
Catch
	MsgBox("Couldn't find a appearance library called '" & AppearanceLibraryName,, "Error")
	Exit Sub
End Try

Dim AppColours As AssetsEnumerator = AppLib.AppearanceAssets
Dim ColourArray As New ArrayList

'hide error
InvApp.SilentOperation = True

' Write all the appearance names to an arraylist
For Each A As Asset In AppColours
    ColourArray.Add(A.DisplayName)
Next

 'Sort the array alphabetically
ColourArray.Sort()

' Create 3 parameters with the list of appearances in......
 'Parameter 1
Try
MultiValue.List("RootwaveFinish") = ColourArray
Catch
 'Parameter doesn't exist - create it
Dim oParam As Parameter = oDef.Parameters.UserParameters.AddByValue("RootwaveFinish", ColourArray(0), UnitsTypeEnum.kTextUnits)
MultiValue.List("RootwaveFinish") = ColourArray
End Try
InvApp.SilentOperation = False

Some editorial changes for better reusability an readability in future.

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 9 of 11

arnaud.henry-lefort
Explorer
Explorer

 

thanks for this guys. So far with what you changed I managed to update some scripts in one that does all. I am learning ! I will share my code once done as I am sure i can be improved !

I have a form in the ilogic who is trigger by a button. Any idea where I can find the code or modify the form ?

0 Likes
Message 10 of 11

marcin_otręba
Advisor
Advisor

Right click on that form button, you should have edit command  under RMB menu. If not then check your external ilogic UI folder if you have rights to save there, or if it is read only.

Hi, maybe you want to check my apps:


DrawingTools   View&ColoringTools   MRUFolders

0 Likes
Message 11 of 11

arnaud.henry-lefort
Explorer
Explorer

Thanks ! this helped a lot in my trouble. I been able to locate another folder where the ilogic rule have been saved and works !

0 Likes