<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Code to do SAVE AS operation in Archicad C++ API</title>
    <link>https://community.graphisoft.com/t5/Archicad-C-API/Code-to-do-SAVE-AS-operation/m-p/276137#M5595</link>
    <description>&lt;BLOCKQUOTE&gt;Bianca wrote:&lt;BR /&gt;Hi&lt;BR /&gt;
&lt;BR /&gt;
Is there a function to do a SAVE AS operation?&lt;BR /&gt;
&lt;BR /&gt;
I have found the Save function but I need to save the opened Archicad to be a different name.&lt;/BLOCKQUOTE&gt;

Yes there is.&lt;BR /&gt;

&lt;PRE&gt;static void		Do_Save_Plan (void)
{
	GSErrCode	err;

	err = ACAPI_Automate (APIDo_SaveID, NULL, NULL);
	if (err != NoError) {
		char msgStr[256];
		sprintf (msgStr, "Error in APIDo_SaveID: %d", (int) err);
		ACAPI_WriteReport (msgStr, true);
	}

	return;
}		// Do_Save_Plan


// -----------------------------------------------------------------------------
// Save the current plan into a picture
// -----------------------------------------------------------------------------

static void		Do_Save_TiffFile (void)
{
	API_FileSavePars		fsp;
	API_SavePars_Picture	pars_pict;
	GSErrCode				err;

	BNZeroMemory (&amp;amp;fsp, sizeof (API_FileSavePars));
	fsp.fileTypeID = APIFType_TIFFFile;

	IO::Location folderLoc;
	API_SpecFolderID specID = API_UserDocumentsFolderID;
	ACAPI_Environment (APIEnv_GetSpecFolderID, &amp;amp;specID, &amp;amp;folderLoc);
	fsp.file = new IO::Location (folderLoc, IO::Name ("PictTest.tif"));

	BNZeroMemory (&amp;amp;pars_pict, sizeof (API_SavePars_Picture));
	pars_pict.colorDepth = APIColorDepth_256C;
	pars_pict.dithered   = false;
	pars_pict.view2D     = true;
	pars_pict.crop       = true;

	err = ACAPI_Automate (APIDo_SaveID, &amp;amp;fsp, &amp;amp;pars_pict);
	if (err != NoError) {
		char msgStr[256];
		sprintf (msgStr, "Error in APIDo_SaveID (pict): %d", (int) err);
		ACAPI_WriteReport (msgStr, true);
	}

	delete fsp.file;

	return;
}		// Do_Save_TiffFile


// -----------------------------------------------------------------------------
// Save the current plan to an IFC file
// -----------------------------------------------------------------------------

static void		Do_Save_IfcFile (void)
{
	API_FileSavePars	fsp;
	API_SavePars_Ifc	pars_ifc;
	GSErrCode			err;

	BNZeroMemory (&amp;amp;fsp, sizeof (API_FileSavePars));
	fsp.fileTypeID = APIFType_IfcFile;

	IO::Location folderLoc;
	API_SpecFolderID specID = API_UserDocumentsFolderID;
	ACAPI_Environment (APIEnv_GetSpecFolderID, &amp;amp;specID, &amp;amp;folderLoc);
	fsp.file = new IO::Location (folderLoc, IO::Name ("IfcTest.ifc"));

	BNZeroMemory (&amp;amp;pars_ifc, sizeof (pars_ifc));
	pars_ifc.subType = APIIfc_2x3;

	err = ACAPI_Automate (APIDo_SaveID, &amp;amp;fsp, &amp;amp;pars_ifc);
	if (err != NoError) {
		char msgStr[256];
		sprintf (msgStr, "Error in APIDo_SaveID (Ifc): %s", ErrID_To_Name (err));
		ACAPI_WriteReport (msgStr, true);
	}

	delete fsp.file;

	return;
}		// Do_Save_IfcFile


// -----------------------------------------------------------------------------
// Save the current plan to an Pdf file
// -----------------------------------------------------------------------------

static void		Do_Save_PdfFile (void)
{
	API_FileSavePars	fsp;
	GSErrCode			err;

	BNZeroMemory (&amp;amp;fsp, sizeof (API_FileSavePars));
	fsp.fileTypeID = APIFType_PdfFile;

	IO::Location folderLoc;
	API_SpecFolderID specID = API_UserDocumentsFolderID;
	ACAPI_Environment (APIEnv_GetSpecFolderID, &amp;amp;specID, &amp;amp;folderLoc);
	fsp.file = new IO::Location (folderLoc, IO::Name ("PdfTest.pdf"));

	err = ACAPI_Automate (APIDo_SaveID, &amp;amp;fsp, NULL);
	if (err != NoError) {
		char msgStr[256];
		sprintf (msgStr, "Error in APIDo_SaveID (Pdf): %s", ErrID_To_Name (err));
		ACAPI_WriteReport (msgStr, true);
	}

	delete fsp.file;

	return;
}		// Do_Save_PdfFile&lt;/PRE&gt;

By the way you can look at Automate_Functions example</description>
    <pubDate>Fri, 12 Jun 2015 12:52:04 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2015-06-12T12:52:04Z</dc:date>
    <item>
      <title>Code to do SAVE AS operation</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Code-to-do-SAVE-AS-operation/m-p/276136#M5594</link>
      <description>&lt;DIV class="actalk-migrated-content"&gt;Hi&lt;BR /&gt;&lt;BR /&gt;Is there a function to do a SAVE AS operation?&lt;BR /&gt;&lt;BR /&gt;I have found the Save function but I need to save the opened Archicad to be a different name.&lt;/DIV&gt;</description>
      <pubDate>Thu, 13 Jul 2023 13:53:20 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Code-to-do-SAVE-AS-operation/m-p/276136#M5594</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-07-13T13:53:20Z</dc:date>
    </item>
    <item>
      <title>Re: Code to do SAVE AS operation</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Code-to-do-SAVE-AS-operation/m-p/276137#M5595</link>
      <description>&lt;BLOCKQUOTE&gt;Bianca wrote:&lt;BR /&gt;Hi&lt;BR /&gt;
&lt;BR /&gt;
Is there a function to do a SAVE AS operation?&lt;BR /&gt;
&lt;BR /&gt;
I have found the Save function but I need to save the opened Archicad to be a different name.&lt;/BLOCKQUOTE&gt;

Yes there is.&lt;BR /&gt;

&lt;PRE&gt;static void		Do_Save_Plan (void)
{
	GSErrCode	err;

	err = ACAPI_Automate (APIDo_SaveID, NULL, NULL);
	if (err != NoError) {
		char msgStr[256];
		sprintf (msgStr, "Error in APIDo_SaveID: %d", (int) err);
		ACAPI_WriteReport (msgStr, true);
	}

	return;
}		// Do_Save_Plan


// -----------------------------------------------------------------------------
// Save the current plan into a picture
// -----------------------------------------------------------------------------

static void		Do_Save_TiffFile (void)
{
	API_FileSavePars		fsp;
	API_SavePars_Picture	pars_pict;
	GSErrCode				err;

	BNZeroMemory (&amp;amp;fsp, sizeof (API_FileSavePars));
	fsp.fileTypeID = APIFType_TIFFFile;

	IO::Location folderLoc;
	API_SpecFolderID specID = API_UserDocumentsFolderID;
	ACAPI_Environment (APIEnv_GetSpecFolderID, &amp;amp;specID, &amp;amp;folderLoc);
	fsp.file = new IO::Location (folderLoc, IO::Name ("PictTest.tif"));

	BNZeroMemory (&amp;amp;pars_pict, sizeof (API_SavePars_Picture));
	pars_pict.colorDepth = APIColorDepth_256C;
	pars_pict.dithered   = false;
	pars_pict.view2D     = true;
	pars_pict.crop       = true;

	err = ACAPI_Automate (APIDo_SaveID, &amp;amp;fsp, &amp;amp;pars_pict);
	if (err != NoError) {
		char msgStr[256];
		sprintf (msgStr, "Error in APIDo_SaveID (pict): %d", (int) err);
		ACAPI_WriteReport (msgStr, true);
	}

	delete fsp.file;

	return;
}		// Do_Save_TiffFile


// -----------------------------------------------------------------------------
// Save the current plan to an IFC file
// -----------------------------------------------------------------------------

static void		Do_Save_IfcFile (void)
{
	API_FileSavePars	fsp;
	API_SavePars_Ifc	pars_ifc;
	GSErrCode			err;

	BNZeroMemory (&amp;amp;fsp, sizeof (API_FileSavePars));
	fsp.fileTypeID = APIFType_IfcFile;

	IO::Location folderLoc;
	API_SpecFolderID specID = API_UserDocumentsFolderID;
	ACAPI_Environment (APIEnv_GetSpecFolderID, &amp;amp;specID, &amp;amp;folderLoc);
	fsp.file = new IO::Location (folderLoc, IO::Name ("IfcTest.ifc"));

	BNZeroMemory (&amp;amp;pars_ifc, sizeof (pars_ifc));
	pars_ifc.subType = APIIfc_2x3;

	err = ACAPI_Automate (APIDo_SaveID, &amp;amp;fsp, &amp;amp;pars_ifc);
	if (err != NoError) {
		char msgStr[256];
		sprintf (msgStr, "Error in APIDo_SaveID (Ifc): %s", ErrID_To_Name (err));
		ACAPI_WriteReport (msgStr, true);
	}

	delete fsp.file;

	return;
}		// Do_Save_IfcFile


// -----------------------------------------------------------------------------
// Save the current plan to an Pdf file
// -----------------------------------------------------------------------------

static void		Do_Save_PdfFile (void)
{
	API_FileSavePars	fsp;
	GSErrCode			err;

	BNZeroMemory (&amp;amp;fsp, sizeof (API_FileSavePars));
	fsp.fileTypeID = APIFType_PdfFile;

	IO::Location folderLoc;
	API_SpecFolderID specID = API_UserDocumentsFolderID;
	ACAPI_Environment (APIEnv_GetSpecFolderID, &amp;amp;specID, &amp;amp;folderLoc);
	fsp.file = new IO::Location (folderLoc, IO::Name ("PdfTest.pdf"));

	err = ACAPI_Automate (APIDo_SaveID, &amp;amp;fsp, NULL);
	if (err != NoError) {
		char msgStr[256];
		sprintf (msgStr, "Error in APIDo_SaveID (Pdf): %s", ErrID_To_Name (err));
		ACAPI_WriteReport (msgStr, true);
	}

	delete fsp.file;

	return;
}		// Do_Save_PdfFile&lt;/PRE&gt;

By the way you can look at Automate_Functions example</description>
      <pubDate>Fri, 12 Jun 2015 12:52:04 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Code-to-do-SAVE-AS-operation/m-p/276137#M5595</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-06-12T12:52:04Z</dc:date>
    </item>
    <item>
      <title>Re: Code to do SAVE AS operation</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Code-to-do-SAVE-AS-operation/m-p/276138#M5596</link>
      <description>Thank you for your response.&lt;BR /&gt;
&lt;BR /&gt;
However I am looking for a 'SAVE AS' function, I believe this one from the examples is just a 'SAVE' function</description>
      <pubDate>Sun, 14 Jun 2015 23:03:39 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Code-to-do-SAVE-AS-operation/m-p/276138#M5596</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-06-14T23:03:39Z</dc:date>
    </item>
    <item>
      <title>Re: Code to do SAVE AS operation</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Code-to-do-SAVE-AS-operation/m-p/276139#M5597</link>
      <description>Not sure about this, but have you tried changing the &lt;FONT color="#808080"&gt;API_FileSavePars.file&lt;/FONT&gt; to your desired "different" file name?</description>
      <pubDate>Wed, 01 Jul 2015 02:14:57 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Code-to-do-SAVE-AS-operation/m-p/276139#M5597</guid>
      <dc:creator>ReignBough</dc:creator>
      <dc:date>2015-07-01T02:14:57Z</dc:date>
    </item>
  </channel>
</rss>

