Developer forum
cancel
Showing results for 
Search instead for 
Did you mean: 

Plugin\plugin button disabled in South Elevation/3D All/Action Center and other view

Konstantin
Newcomer
Hello everybody. I have a problem. My plugin/plugin button is disabled in South Elevation / 3D All / Action Center views, but everything works fine in the ground floor view. Tell me why this is happening?? Thx
1 ACCEPTED SOLUTION

Solution
Tibor Lorantfy
Graphisoft Alumni
Graphisoft Alumni
Konstantin wrote:
In my plugin I get doors :

GS::Array<API_Guid> elementList;
 ACAPI_Element_GetElemList(API_DoorID, &elementList, APIFilt_OnVisLayer);
In 3D window view or Ground Floor I successfully getting the data list, but in Elevations my doors list is empty.

How can I get data in Elevations windows or other(Worksheets/Welcome ...)? Can I somehow get a document and get all the information I need from it, for example, a door?
In Section or Elevation windows there are no doors and windows, you can see only section elements instead (type is API_SectElemID). The parent of the section elements are the doors/windows/etc., see this code:
static GS::Array<API_Guid> GetElemListByTypeFromSectionElevation (API_ElemTypeID elemTypeId)
{
	GS::Array<API_Guid> result;

	GS::Array<API_Guid> sectElemList;
	ACAPI_Element_GetElemList (API_SectElemID, &sectElemList, APIFilt_OnVisLayer);

	for (const API_Guid& sectElemGuid : sectElemList) {
		API_Element elem = {};
		elem.header.guid = sectElemGuid;
		ACAPI_Element_Get (&elem);
		if (elem.sectElem.parentID == elemTypeId) {
			result.Push (elem.sectElem.parentGuid);
		}
	}

	return result;
}

// Usage

API_WindowInfo	currWindowInfo = {};
ACAPI_Database (APIDb_GetCurrentWindowID, &currWindowInfo);

static const GS::HashSet<API_WindowTypeID> sectElemOnlyWindows = {
	APIWind_SectionID,
	APIWind_ElevationID,
	APIWind_InteriorElevationID
};

GS::Array<API_Guid> elementList;
if (sectElemOnlyWindows.Contains (currWindowInfo.typeID)) {
	elementList = GetElemListByTypeFromSectionElevation (API_DoorID);
} else {
	ACAPI_Element_GetElemList (API_DoorID, &elementList, APIFilt_OnVisLayer);
}

View solution in original post

4 REPLIES 4

Viktor Kovacs
Graphisoft Alumni
Graphisoft Alumni
You can specify in the grc file where your command will be available. The magically looking tokens (E3, ES, etc.) are for this purpose.

'STR#' ID_ADDON_MENU "Strings for the Menu" {
/* [  1] */		"Example AddOn Command... ^E3 ^ES ^EE ^EI ^ED ^ET ^10001"
}
You can check the complete list here:
http://download.graphisoft.com/ftp/techsupport/documentation/developer_docs/APIDevKit51/APIHTMLLibra...

Konstantin
Newcomer
Viktor wrote:
You can specify in the grc file where your command will be available. The magically looking tokens (E3, ES, etc.) are for this purpose.

'STR#' ID_ADDON_MENU "Strings for the Menu" {
/* [  1] */		"Example AddOn Command... ^E3 ^ES ^EE ^EI ^ED ^ET ^10001"
}
You can check the complete list here:
http://download.graphisoft.com/ftp/techsupport/documentation/developer_docs/APIDevKit51/APIHTMLLibra...
Thanks a lot, it really works. But now I have a new question.
In my plugin I get doors :

GS::Array<API_Guid> elementList;
 ACAPI_Element_GetElemList(API_DoorID, &elementList, APIFilt_OnVisLayer);
In resources, I used "^ES^EE^EI^ED^EW^E3^EL" and I can call my plugin. In 3D window view or Ground Floor I successfully getting the data list, but in Elevations my doors list is empty.

How can I get data in Elevations windows or other(Worksheets/Welcome ...)? Can I somehow get a document and get all the information I need from it, for example, a door?

Viktor Kovacs
Graphisoft Alumni
Graphisoft Alumni
Archicad API commands are context sensitive. It means that you can't access the same data from every window. This is why usually it's a good idea to make commands work over floor plan only (some of the internal commands work this way, too).

When you are over a section window, you can access only the elements on that section. It is possible to switch to floor plan database, access the elements and switch back to the original database, but I don't recommend this workflow. If it's not a strong requirement to make it work over sections, it's a better choice to disable it.

Solution
Tibor Lorantfy
Graphisoft Alumni
Graphisoft Alumni
Konstantin wrote:
In my plugin I get doors :

GS::Array<API_Guid> elementList;
 ACAPI_Element_GetElemList(API_DoorID, &elementList, APIFilt_OnVisLayer);
In 3D window view or Ground Floor I successfully getting the data list, but in Elevations my doors list is empty.

How can I get data in Elevations windows or other(Worksheets/Welcome ...)? Can I somehow get a document and get all the information I need from it, for example, a door?
In Section or Elevation windows there are no doors and windows, you can see only section elements instead (type is API_SectElemID). The parent of the section elements are the doors/windows/etc., see this code:
static GS::Array<API_Guid> GetElemListByTypeFromSectionElevation (API_ElemTypeID elemTypeId)
{
	GS::Array<API_Guid> result;

	GS::Array<API_Guid> sectElemList;
	ACAPI_Element_GetElemList (API_SectElemID, &sectElemList, APIFilt_OnVisLayer);

	for (const API_Guid& sectElemGuid : sectElemList) {
		API_Element elem = {};
		elem.header.guid = sectElemGuid;
		ACAPI_Element_Get (&elem);
		if (elem.sectElem.parentID == elemTypeId) {
			result.Push (elem.sectElem.parentGuid);
		}
	}

	return result;
}

// Usage

API_WindowInfo	currWindowInfo = {};
ACAPI_Database (APIDb_GetCurrentWindowID, &currWindowInfo);

static const GS::HashSet<API_WindowTypeID> sectElemOnlyWindows = {
	APIWind_SectionID,
	APIWind_ElevationID,
	APIWind_InteriorElevationID
};

GS::Array<API_Guid> elementList;
if (sectElemOnlyWindows.Contains (currWindowInfo.typeID)) {
	elementList = GetElemListByTypeFromSectionElevation (API_DoorID);
} else {
	ACAPI_Element_GetElemList (API_DoorID, &elementList, APIFilt_OnVisLayer);
}

View solution in original post

Still looking?

Browse more topics

Back to forum

See latest solutions

Accepted solutions

Start a new discussion!