License Delivery maintenance is expected to occur on Saturday, November 30, between 8 AM and 11 AM CET. This may cause a short 3-hours outage in which license-related tasks: license key upload, download, update, SSA validation, access to the license pool and Graphisoft ID authentication may not function properly. We apologize for any inconvenience.
Archicad C++ API
About Archicad add-on development using the C++ API.

Communication Manager - saving as OBJ

Anonymous
Not applicable
First post on that Forum - hello everybody,

Problem: I'm developing a simple add-on. At some point it should save current project (3D data) in Wavefront OBJ format. There's already an add-on for writing out OBJ format, which works fine, so I should use it from my add-on.

Question: how do I know the MDID (module identifier) to properly call the third-party add-on from my add-on?

I know there's Communication Manager, and I've searched the docs and this forum. Looks like this should be pretty straightforward, yet: what is the OBJ add-on MDID?

In the doc's example they use DXF/DWG:
API_ModulID mdid = { 1198731108, 1322668197 }; // MDID of the DXF/DWG add-on

Again, how they know what is the mdid of that module? How to find it?

I'm rookie with ArchiCAD API - hope you guys can help!
10 REPLIES 10
Anonymous
Not applicable
I am trying to do the exact same thing..
Anyone knows how can I find the MDID?
Akos Somorjai
Graphisoft
Graphisoft
For the Wavefront add-on:

API_ModulID mdid = { 1198731108, 1142057562 };

so the code is something like this:
static void		Do_Save_ObjFile (void)
{
	IO::Location folderLoc;
	API_SpecFolderID specID = API_UserDocumentsFolderID;
	ACAPI_Environment (APIEnv_GetSpecFolderID, &specID, &folderLoc);
	IO::Name		objName ("ObjTest.obj");
	IO::Location	objFile (folderLoc, objName);

	if (!objFile.IsEmpty ()) {
		API_IOParams ioParams;
		ioParams.method = IO_SAVEAS3D;
		ioParams.refCon = 1;
		ioParams.fileLoc = &objFile;
		ioParams.saveFileIOName = &objName;
		ioParams.noDialog = true;

		GSHandle	parhdl = nullptr;
		GSErrCode	err = ACAPI_Goodies (APIAny_InitMDCLParameterListID, &parhdl);
		if (err == NoError) {
			if (AddParameterToCommandCall (parhdl, "ioParams", &ioParams)) {
				API_ModulID	mdid;
				BNZeroMemory (&mdid, sizeof (mdid));
				mdid.developerID = 1198731108;
				mdid.localID = 1142057562;
				ACAPI_Command_Call (&mdid, 'OBJO', 1, parhdl, nullptr, false);
			}
			ACAPI_Goodies (APIAny_FreeMDCLParameterListID, &parhdl);
		}
	}

	return;
}		// Do_Save_ObjFile
Best, Akos
Anonymous
Not applicable
Akos thank you so much!
Thats very helpful!!
Have a great day
Anonymous
Not applicable
Hello again akos, I’m having trouble making that function work, I can’t find the AddParameterToCommandCall functio. What is it?
Tibor Lorantfy
Graphisoft Alumni
Graphisoft Alumni
Here is a possible implementation for AddParameterToCommandCall function:
bool	AddParameterToCommandCall (GSHandle& parhdl, const char* parname, API_IOParams* ptr)
{
	API_MDCLParameter	par;
	BNZeroMemory (&par, sizeof (par));
	par.name = parname;
	par.type = MDCLPar_pointer;
	par.ptr_par = (void*) ptr;
	return ACAPI_Goodies (APIAny_AddMDCLParameterID, parhdl, &par) == NoError;
}
Anonymous
Not applicable
Hi,
I’m running the code and the archicad is crashing every time, says it’s ucrtbase.pdb error

Any ideas how to solve?
Anonymous
Not applicable
Ziv wrote:
Hi,
I’m running the code and the archicad is crashing every time, says it’s ucrtbase.pdb error

Any ideas how to solve?
I also get this message
Akos Somorjai
Graphisoft
Graphisoft
Hi,

The 3D window has to be active when you call this function.

Hope this helps, Akos
Anonymous
Not applicable
Akos wrote:
Hi,

The 3D window has to be active when you call this function.

Hope this helps, Akos
Yep I know, but it still crashes..