cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X

Delete creo files from folder

Sekar1
12-Amethyst

Delete creo files from folder

Hi,

I want to delete creo files from a particular folder.

Please let me know if any c++ toolkit api is available for this.

 

Thanks and regards,

Sekar

1 REPLY 1
sully7
13-Aquamarine
(To:Sekar1)

In the context of your code, do you already know where the folder is? I don't believe that any of the Pro/TOOLKIT APIs have a specific "delete from folder" type function... but you could always use the windows APIs for this?

 

You would include your windows headers/libs. Then, collect files in the desired directory using "FindFirstFile" (usually "FindFirstFileW"). Alternatively, you could also collect files in the directory using the Pro/Toolkit function "ProFilesList".

 

From there, you could call "DeleteFile", (usually "DeleteFileW") on anything with a PRT, ASM, or DRW extension. or There's also obviously functionality inside of the c++ std lib too -  http://www.cplusplus.com/reference/cstdio/remove/ 

So it really just depends on how "compliant" you are trying to be with C++ standards vs how much you want to leverage OS-specific methods:

 

Past that, if you are instead trying to "get" the directory of a model that is already loaded into Creo... you could get the path of the mode. If you are using Pro/TOOLKIT, I believe you can do that with "ProModel" (as opposed to ProMdl). If you are using Object Toolkit (OTK), you can do this with the pfcModelDescriptor.

 

Hope this helps.

 

Thanks, 

James Sullivan

President & Founder
CadActive Technologies - www.cadactive.com
Top Tags