C++ Close command does not purge *lck file

C++ Close command does not purge *lck file

Anonymous
Not applicable
731 Views
9 Replies
Message 1 of 10

C++ Close command does not purge *lck file

Anonymous
Not applicable

Hi, 

 

I have a trouble with my current Inventor Application coded in C++.

 

Here what I do :

 

- Copy an ipt file into a temp folder

- Load the ipt file into Inventor.

- Save it as sat.

- Close the document

- Delete the temp folder

 

The problem I have is the following, I can't delete the temp folder because there is a lockfile.lck file, even if I wait a few seconds the file is still there and prevent my delete action.

 

What I notice is : 

- if I start Inventor (GUI opens), the problem happens.

if I do not start Inventor, the problem does not happen.

 

Here is the code I use :

 

mModelDoc = application->Documents->Open(
static_cast<LPCTSTR>( filePath ),
VARIANT_FALSE
);

 

CString newFilePath = folderPath; ::PathAppend( newFilePath.GetBuffer( MAX_PATH ), fileName + _T( ".sat" ) ); newFilePath.ReleaseBuffer();
mModelDoc->SaveAs( static_cast<LPCTSTR>( newFilePath ), VARIANT_TRUE);
mModelDoc->Close( VARIANT_TRUE ); mModelDoc = NULL;

 

 

Can someone help me to understand the problem?

 

Thanks,

 

 

 

0 Likes
732 Views
9 Replies
Replies (9)
Message 2 of 10

johnsonshiue
Community Manager
Community Manager

Hi! Could you tell me what release of Inventor you are using? I cannot seem to reproduce it on 2018.

Many thanks!

 



Johnson Shiue (johnson.shiue@autodesk.com)
Software Test Engineer
0 Likes
Message 3 of 10

Anonymous
Not applicable

Thanks for your quick reply.

 

I have used 2018 and 2016 version and I got the same results. I even tried a very old version inventor 11 and I had same results.

 

I guess I have missed something which must be linked with the way I load the model. With the Inventor GUI case, I have noticed that when I called the load function, I see updates on the application task-bar :

  1. Module loaded
  2. Loading file xxx.ipt
  3. Loading...

 

It keeps on displaying 'Loading...' and I don't see the model loaded graphically. When code reaches 'saveas' command, it does the job but the close function does not seem to have any effects.

 

Could you send me your test code so that I could identify what I did wrong?

0 Likes
Message 4 of 10

johnsonshiue
Community Manager
Community Manager

Hi! I did not try the workflow programmatically. I manually delete the folder and the lck file after close doc. It seems to work fine. Could you try it manually and see if the same behavior happens?

Many thanks!

 



Johnson Shiue (johnson.shiue@autodesk.com)
Software Test Engineer
0 Likes
Message 5 of 10

bradeneuropeArthur
Mentor
Mentor
Is the inventor application correctly released?

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 10

Anonymous
Not applicable

I have tested it manually and all seems ok : I have deleted the *.lck after unloading the file.

0 Likes
Message 7 of 10

Anonymous
Not applicable

I think so, I am able to use Inventor without any issues.

0 Likes
Message 8 of 10

bradeneuropeArthur
Mentor
Mentor
With released I mean unloaded from task manager.

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 10

Anonymous
Not applicable

I'll check this out

0 Likes
Message 10 of 10

ggXWU4P
Explorer
Explorer

I have solved my problem.

 

It seems Inventor needs to have full control on the folder where the model file is. I have solved my problem by copying the model into a temp folder and perform all action there.

 

What I don't understand is that the folder where the model initially seats, everyone - full control rights.

 

Thanks everyone for help.

0 Likes