Part Document Save as Error

Part Document Save as Error

muthukumar.kVVK9E
Contributor Contributor
158 Views
3 Replies
Message 1 of 4

Part Document Save as Error

muthukumar.kVVK9E
Contributor
Contributor

Dear Friends,

 

i am developing the Standalone App in Inventor API using VB.net.

 

this below error occurring not frequently, sometimes...

 

While saving the updated part doc, getting the following Error.

 

System.ArgumentException: 'The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))'

 

Code Snippet:

PartDoc.Update2()

Dim PartFileName As String = ""

PartFileName = DwgFolderPath & "\Bunker_Top.ipt"

PartDoc.SaveAs2(PartFileName, True)  ---> this Line getting Error

 

Kindly give the Solution .

 

Thanks in advance

 

 

 

0 Likes
159 Views
3 Replies
Replies (3)
Message 2 of 4

mateusz_baczewski
Advocate
Advocate

Hi,

Your code seems to look fine, especially since you mentioned that this error occurs rarely. Therefore, if you're creating a standalone application, try debugging the code and see what causes this error.

Maybe PartFileName = DwgFolderPath & "\Bunker_Top.ipt" // =Bunker_top.ipt or PartDoc is null. It's hard to determine based on what you sent.

If you found it helpful, a "Like" would be much appreciated!
If this post solved your problem, please mark it as "Solution.".

0 Likes
Message 3 of 4

ryan.rittenhouse
Advocate
Advocate

I agree. Most of the time when I see this error the filename is wrong. The other possibility I've seen with this failure is that the file already exists and is read only. You might want to throw in a check for that.

If this solved your problem, or answered your question, please click Accept Solution.
0 Likes
Message 4 of 4

Curtis_Waguespack
Consultant
Consultant

Hi @muthukumar.kVVK9E , 

 

What is your reason to use SaveAs2 rather than SaveAs ?

 

I think you can likely just use SaveAs

Dim PartDoc = ThisDoc.Document
PartFileName = "C:\Temp" & "\Bunker_Top.ipt"

PartDoc.SaveAs(PartFileName, True)

 

Typically we would not use SaveAs2, unless specifically wanting to set some save options. 

Example:

https://help.autodesk.com/view/INVNTOR/2025/ENU/?guid=GUID-SaveOptions

Dim PartDoc = ThisDoc.Document
PartFileName = "C:\Temp" & "\Bunker_Top.ipt"

Dim oOptions As NameValueMap
oOptions = ThisApplication.TransientObjects.CreateNameValueMap

oOptions.Value("PromptSaveForMigration") = False
PartDoc.SaveAs2(PartFileName, True, oOptions)


 

Hope that helps,

Curtis

 

EESignature

0 Likes