Why does this code fail when I refresh the file after move it?

Why does this code fail when I refresh the file after move it?

Darkforce_the_ilogic_guy
Advisor Advisor
460 Views
6 Replies
Message 1 of 7

Why does this code fail when I refresh the file after move it?

Darkforce_the_ilogic_guy
Advisor
Advisor

I have a code that work fine on save .  But if I move a file and refresh the file  , It trigger the before save ilogic code and  it fail to run 

oBOM.ImportBOMCustomization(sPathFile)

If i do a  normal save. If work ok . why does it fail   and is there a way to fix it without making Try Cathc as I have done in the code now 

 

Sub main()
	

Dim oDoc As Document = ThisDoc.Document

If oDoc.DocumentType <> DocumentTypeEnum.kAssemblyDocumentObject Then Exit Sub
	
Dim oADoc As AssemblyDocument = oDoc


Dim oBOM As BOM = oADoc.ComponentDefinition.BOM

Dim sPathFile As String = "C:\Working Folder\CAD\Kallesoe\Kallesoe iLogic\UpdateBOMSetup\BOMSetting.xml"
Try
oBOM.ImportBOMCustomization(sPathFile)

Catch
	Logger.Error("This fail when update files in iam after have move it in vault")

End Try

End Sub

 

Darkforce_the_ilogic_guy_0-1710229812205.png

 

 

0 Likes
461 Views
6 Replies
Replies (6)
Message 2 of 7

bradeneuropeArthur
Mentor
Mentor

On which Event does the code run.

bradeneuropeArthur_0-1710268657865.png

 

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 3 of 7

bradeneuropeArthur
Mentor
Mentor

Because the file is ReadOnly After moving Checkin to the Vault.

 

Sub main()
	
Dim oDoc As Document = ThisDoc.Document
Dim fio As New System.IO.FileInfo(oDoc.FullFileName)

If fio.IsReadOnly = False Then
	MsgBox ("nro")
If oDoc.DocumentType <> DocumentTypeEnum.kAssemblyDocumentObject Then Exit Sub
	
Dim oADoc As AssemblyDocument = oDoc
Dim oBOM As BOM = oADoc.ComponentDefinition.BOM

Dim sPathFile As String = "C:\Working Folder\CAD\Kallesoe\Kallesoe iLogic\UpdateBOMSetup\BOMSetting.xml"

oBOM.ImportBOMCustomization(sPathFile)

Else
MsgBox ("ro")
	Logger.Error("This fail when update files in iam after have move it in vault")
End If

End Sub

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 7

the ilogic run on the iam, that it is a part of , not the have been move. In may test the iam file was not check in to vault jet, but the file that was move was a check into vault

0 Likes
Message 5 of 7

Have a look at my first question about what event the code is in!

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 6 of 7

 

 

 

it is before save document

 

Darkforce_the_ilogic_guy_1-1710340399637.png

 

0 Likes
Message 7 of 7

This is the error that popup if I dont use the Try and Catch

 

Darkforce_the_ilogic_guy_0-1710340547491.pngDarkforce_the_ilogic_guy_1-1710340547515.png

 

0 Likes