cancel
Showing results for 
Search instead for 
Did you mean: 
EN
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

ACAPI_Automate(APIDo_SaveID...) not saving file

I'm using AC13 and when I call

err = ACAPI_Automate(APIDo_SaveID, NULL, NULL, NULL);
from my menu handler with a new plan open from a template and it returns NoError but the file is not saved.

How can I save the current file please?
1 Solution

Accepted Solutions
Anonymous
Not applicable
n.mihaylov wrote:
I have problems saving to a solo project. There's no error when I save using the example in Automate_Functions example. But when I try to add file destination I get APIERR_GENERAL:
API_FileSavePars fsp;
	API_SavePars_PlanDump pars;
	GSErrCode err;

	BNZeroMemory (&fsp, sizeof (API_FileSavePars));
	
	IO::Location folderLoc;
	API_SpecFolderID specID = API_UserDocumentsFolderID;
	ACAPI_Environment (APIEnv_GetSpecFolderID, &specID, &folderLoc);
	fsp.file = new IO::Location (folderLoc);
	fsp.fileTypeID = APIFType_PlanFile;

	BNZeroMemory (&pars, sizeof (API_SavePars_PlanDump));

	err = ACAPI_Automate (APIDo_SaveID, &fsp, &pars);
Can someone help me?

P.S. I also havе troubles with IO::Location::AppendToLocal - what type of argument does it take so I can add the filename to the path?
Fsp.file should have the file name in it. Make sure the path you put into fsp.file has it (for example: c:\temp\file.pln is a good path)

Go to post

7 Replies 7
GDefina wrote:
err = ACAPI_Automate(APIDo_SaveID, NULL, NULL, NULL);
from my menu handler with a new plan open from a template and it returns NoError but the file is not saved.
Because the file is constructed from a template, it isn't associated with any existing file (the link with the template file is severed to prevent users from saving over it). If you want to save to a file with a specific name/location, you need to fill in the API_FileSavePars structure passed to the function.
Ralph Wessel BArch
Central Innovation
Anonymous
Not applicable
Thanks Ralph.

How can I determine the FileTypeId of the current file?
It's not part of ProjectInfo.
Or can I use APIFType_None?
GDefina wrote:
How can I determine the FileTypeId of the current file?
It's not part of ProjectInfo. Or can I use APIFType_None?
I'm assuming you want to save the project as an ArchiCAD solo project file, in which case you would use APIFType_PlanFile.
Ralph Wessel BArch
Central Innovation
Anonymous
Not applicable
Thanks.
Anonymous
Not applicable
I have problems saving to a solo project. There's no error when I save using the example in Automate_Functions example. But when I try to add file destination I get APIERR_GENERAL:
API_FileSavePars fsp;
	API_SavePars_PlanDump pars;
	GSErrCode err;

	BNZeroMemory (&fsp, sizeof (API_FileSavePars));
	
	IO::Location folderLoc;
	API_SpecFolderID specID = API_UserDocumentsFolderID;
	ACAPI_Environment (APIEnv_GetSpecFolderID, &specID, &folderLoc);
	fsp.file = new IO::Location (folderLoc);
	fsp.fileTypeID = APIFType_PlanFile;

	BNZeroMemory (&pars, sizeof (API_SavePars_PlanDump));

	err = ACAPI_Automate (APIDo_SaveID, &fsp, &pars);
Can someone help me?

P.S. I also havе troubles with IO::Location::AppendToLocal - what type of argument does it take so I can add the filename to the path?
Anonymous
Not applicable
n.mihaylov wrote:
I have problems saving to a solo project. There's no error when I save using the example in Automate_Functions example. But when I try to add file destination I get APIERR_GENERAL:
API_FileSavePars fsp;
	API_SavePars_PlanDump pars;
	GSErrCode err;

	BNZeroMemory (&fsp, sizeof (API_FileSavePars));
	
	IO::Location folderLoc;
	API_SpecFolderID specID = API_UserDocumentsFolderID;
	ACAPI_Environment (APIEnv_GetSpecFolderID, &specID, &folderLoc);
	fsp.file = new IO::Location (folderLoc);
	fsp.fileTypeID = APIFType_PlanFile;

	BNZeroMemory (&pars, sizeof (API_SavePars_PlanDump));

	err = ACAPI_Automate (APIDo_SaveID, &fsp, &pars);
Can someone help me?

P.S. I also havе troubles with IO::Location::AppendToLocal - what type of argument does it take so I can add the filename to the path?
Fsp.file should have the file name in it. Make sure the path you put into fsp.file has it (for example: c:\temp\file.pln is a good path)
Anonymous
Not applicable
Thank you! It works now!

Didn't find the answer?

Check other topics in this Forum

Back to Forum

Read the latest accepted solutions!

Accepted Solutions

Start a new conversation!