Archicad C++ API
About Archicad add-on development using the C++ API.

Current files to XML

Anonymous
Not applicable
Hello,

I'm trying to write a plug-in that help to produce a XML file(s) of current objects to suit another tool of us. Therefore, some questions:
1. How can we add a type in the Save as... function (just like .aaa file). Is the API support?
2. How can we get all the objects info of the current files so I can use my function to convert them to my XML format? How can we do this with API.
I'm a little new here, so if anything wrong, pls suggest. Thanks so much.
2 REPLIES 2
Tibor Lorantfy
Graphisoft Alumni
Graphisoft Alumni
Hi,
hoangvnn wrote:
1. How can we add a type in the Save as... function (just like .aaa file). Is the API support?


Sure, you should check the ACAPI_Register_FileType function in the documentation.
/** 
* Interface definitions. 
* 
* @return ArchiCAD error code. 
*/ 
GSErrCode	__ACENV_CALL	RegisterInterface (void) 
{ 
	GSErrCode err = NoError; 
 
	err = ACAPI_Register_FileType (1, 'TEXT', 'GSAC', "aaa", 0, ID_ResourceStrTable, IDS_ResourceFileTypeText, SaveAs2DSupported + SaveAs3DSupported); 
 
	return err; 
}		// RegisterInterface ()

2. How can we get all the objects info of the current files so I can use my function to convert them to my XML format? How can we do this with API.


What kind of infos do you want to export to your XML file?
Please check the Plan_Dump and the 3D_Test example Add-Ons.
Plan_Dump exports informations about elements in the current plan. 3D_Test exports the 3D model to a file. I think you should make something similar to on of those examples.

Regards,
Tibor
Anonymous
Not applicable
Thanks so much for helping Tibor, I'll try now as your suggestion