The Global ARCHICAD Community

Stay informed. Get help. Share your knowledge.

Discussions about using GRAPHISOFT's tools (API DevKit) for independent software developers

Moderators: Karl Ottenstein, LaszloNagy, ejrolon, Barry Kelly, gkmethy, MOREH Tamas, Akos Somorjai, Ed Brown, Mihály Palenik, Tibor Lorántfy, rmasaki

By SuperMelon
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!
For the Wavefront add-on:

API_ModulID mdid = { 1198731108, 1142057562 };

so the code is something like this:
Code: Select all
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);

}		// Do_Save_ObjFile
Best, Akos
Here is a possible implementation for AddParameterToCommandCall function:
Code: Select all
bool	AddParameterToCommandCall (GSHandle& parhdl, const char* parname, API_IOParams* ptr)
	API_MDCLParameter	par;
	BNZeroMemory (&par, sizeof (par)); = parname;
	par.type = MDCLPar_pointer;
	par.ptr_par = (void*) ptr;
	return ACAPI_Goodies (APIAny_AddMDCLParameterID, parhdl, &par) == NoError;