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

Identifier of navigator - project plan

Anonymous
Not applicable
Hello All !

Are there a function that return an identifier in what plans we are in ArchiCAD ??

An example : We are in a view cuts, I want the identifier of the view...

If someone understands my reasoning, Help me !

Thanks
7 REPLIES 7
ReignBough
Enthusiast
Are you pertaining to APIDb_GetCurrentWindowID?

That is: API_WindowInfo.typeID = APIWind_SectionID
~ReignBough~
ARCHICAD 26 INT (from AC18)
Windows 11 Pro, AMD Ryzen 7, 3.20GHz, 32.0GB RAM, 64-bit OS
Tibor Lorantfy
Graphisoft Alumni
Graphisoft Alumni
Hi,

Yes, you need the APIDb_GetCurrentWindowID function to get informations of the actual window.
API_WindowInfo windowInfo; 
memset (&windowInfo, 0, sizeof (windowInfo)); 
ACAPI_Database (APIDb_GetCurrentWindowID, &windowInfo, NULL); 
 
/* You will get the following informations for the current view 
 
typedef struct { 
	API_WindowTypeID				typeID; 
	Int32							index;						// database/window index 
	API_DatabaseUnId				databaseUnId;				// database unique ID 
	API_DatabaseUnId				masterLayoutUnId;			// for Layouts only; database unique ID of the master layout 
	GS::uchar_t						title[API_UniLongNameLen];	// title of the database (generally "ref"+" "+"name") - output only 
	GS::uchar_t						name[API_UniLongNameLen];	// name of the database 
	GS::uchar_t						ref[API_UniLongNameLen];	// reference string/id of the database 
	API_Guid						linkedElement;				// element linked to the database or drawing guid if (typeID == APIWind_DrawingID) (e.g. section to a section database); the element, never the section segment! 
	API_DatabaseUnId				linkedDatabaseUnId;			// for databases linked to elements (section, detail, etc.): the database containing the element 
	Int32							linkedSegmentMemoIndex;		// for interior elevations 
	Int32							filler_1[3]; 
} API_WindowInfo; 
*/ 
 
if (windowInfo.typeID == APIWind_SectionID) { // for more window types check APIdefs_Database.h header file 
	// the current window is a section view 
}


Best Regards,
Tibor Lorántfy
Anonymous
Not applicable
Thank you very much, i have resolve my problem
I can disable functions of my add-on in this window !
Ralph Wessel
Mentor
atila-diffusion wrote:
Thank you very much, i have resolve my problem
I can disable functions of my add-on in this window !
If your tool is activated through a menu, you can restrict its use to specific drawing types in the resources. Take a look at the Required Resources section in the API documentation.

For example, if a menu should only be enabled for the Floor Plan, it should be written like this:
/* [  5] */         "My menu item^D2"
Ralph Wessel BArch
Software Engineer Speckle Systems
Anonymous
Not applicable
Yeah, that an another way to disable my Iconbutton.

But Can I disable in several windows like this ??
/* [  5] */         "My menu item^D2^D3^D4"
Tibor Lorantfy
Graphisoft Alumni
Graphisoft Alumni
atila-diffusion wrote:
But Can I disable in several windows like this ??
/* [  5] */         "My menu item^D2^D3^D4"


Yes, sure.

Btw D2 is a valid control code (meaning: the command is disabled above the floor plan window), but as far as I know D3 and D4 are not.
By default the commands are disabled in 3D views (until you use E3 control code for example).

See valid control codes in Required Resources documentation Control codes section.
Anonymous
Not applicable
I going to see in the documentation Control codes section for more information.

Thank you all !