i know how to create hole in slab or roof..
but mesh is impossible.. why? is there a any solution or method to create mesh hole with API.
thanks
i'm developing archicad 9...
next line is sample code..
static void Do_Poly_NewHole (void)
{
ACAPI_OpenUndoableSession ("Do_Poly_NewHole");
API_GetPointType pointInfo;
API_GetPolyType polyInfo;
API_ElementMemo memo, insMemo;
API_RoofSide roofSide;
API_ElemTypeID typeID;
long iFrom, iTo, i, index;
GSErrCode err;
// if (!ClickAnElem ("Click a polygon to insert a new hole into", API_ZombieElemID, &neig, &typeID, NULL, NULL)) {
if (!ClickAnElem ("Click a polygon to insert a new hole into", API_ZombieElemID, NULL, &typeID, &index, NULL)) {
WriteReport_Alert ("No element was clicked");
return;
}
if (typeID != API_SlabID && typeID != API_RoofID && typeID != API_MeshID) {
WriteReport_Alert ("Only slab or roof nodes/edges are excepted");
return;
}
BNZeroMemory (&pointInfo, sizeof (API_GetPointType));
BNZeroMemory (&polyInfo, sizeof (API_GetPolyType));
strcpy (pointInfo.prompt, "Click the first node of the hole");
err = ACAPI_Interface (APIIo_GetPointID, &pointInfo, NULL);
if (err == NoError) {
strcpy (polyInfo.prompt, "Enter the polygon nodes");
polyInfo.startCoord = pointInfo.pos;
err = ACAPI_Interface (APIIo_GetPolyID, &polyInfo, NULL);
}
if (err != NoError) {
BMKillHandle ((GSHandle *) &polyInfo.coords);
BMKillHandle ((GSHandle *) &polyInfo.parcs);
return;
}
err = ACAPI_Element_GetMemo (typeID, index, &memo);
if (err != NoError) {
BMKillHandle ((GSHandle *) &polyInfo.coords);
BMKillHandle ((GSHandle *) &polyInfo.parcs);
return;
}
BNZeroMemory (&insMemo, sizeof (API_ElementMemo));
insMemo.coords = polyInfo.coords;
insMemo.parcs = polyInfo.parcs;
polyInfo.coords = NULL;
polyInfo.parcs = NULL;
err = ACAPI_Goodies (APIAny_InsertSubPolyID, &memo, &insMemo);
if (err == NoError) {
switch (typeID) {
case API_MeshID:
break;
case API_SlabID:
break; // nothing to do
case API_RoofID:
if (memo.roofSides != NULL && *memo.roofSides != NULL) {
BNZeroMemory (&roofSide, sizeof (roofSide));
iFrom = BMGetHandleSize ((GSHandle) memo.roofSides) / sizeof (API_RoofSide) + 1;
iTo = BMGetHandleSize ((GSHandle) memo.coords) / sizeof (API_Coord);
for (i = iFrom; i <= iTo; i++)
InsertStructToHandle ((GSHandle) memo.roofSides, i - 1, (GSPtr) &roofSide, sizeof (roofSide));
}
break;
default:
ACAPI_DisposeElemMemoHdls (&insMemo);
ACAPI_DisposeElemMemoHdls (&memo);
return; // should never get here
}
err = ACAPI_Element_ChangeMemo (typeID, &index, APIMemoMask_Polygon, &memo);
if (err != NoError)
ShowMessageBox ("ACAPI_Element_ChangeMemo : %d", err);
} else
ShowMessageBox ("APIAny_InsertSubPolyID : %d", err);
ACAPI_DisposeElemMemoHdls (&insMemo);
ACAPI_DisposeElemMemoHdls (&memo);
ACAPI_CloseUndoableSession ();
return;
} // Do_Poly_NewHole