2008-12-17 03:38 PM - last edited on 2023-08-04 02:49 PM by Doreena Deng
API_HotlinkNode myAPI_HotlinkNode; GSErrCode err; IO::Location location("c:\\test.MOD"); API_Guid myAPI_HotlinkNodeGuid; API_Element element; API_ElementMemo memo; /***************************************************************************************************/ /******************************REMPLISSAGE DE LA STRUCTURE******************************************/ /***************************************************************************************************/ BNZeroMemory (&myAPI_HotlinkNode, sizeof (API_HotlinkNode)); //Charge le module en mode unique (define single story mode) myAPI_HotlinkNode.storyRangeType = APIHotlink_SingleStory; //Precise les que les extensions possibles sont :.pln, .mod, .plp or .2dl file. (define file type) myAPI_HotlinkNode.type = APIHotlink_Module; //Définie le fichier à charger (define file to load) myAPI_HotlinkNode.sourceLocation = &location; //definie l'étage comme étant l'étage -2 myAPI_HotlinkNode.refFloorInd = -2; CHANSI2Unicode ("Module 1", GS::CStringLen, myAPI_HotlinkNode.name,API_UniLongNameLen, CC_Default, NULL); /***************************************************************************************************/ /******************************FIN REMPLISSAGE DE LA STRUCTURE**************************************/ /***************************************************************************************************/ /********************CREATION DU GUID*************************************/ err = ACAPI_Database (APIDb_CreateHotlinkNodeID,&myAPI_HotlinkNode,NULL,NULL); if (err != NoError) { afficheMessage("HotlinkNode parameter is NULL or sourceLocation is NULL or invalid",err); return err; } /*************************************************************************/ myAPI_HotlinkNodeGuid = myAPI_HotlinkNode.guid; /********************MISE A JOUR DU CACHE*********************************/ err = ACAPI_Database (APIDb_UpdateHotlinkCacheID,&myAPI_HotlinkNodeGuid,NULL,NULL); if (err != NoError) { switch(err) { case APIERR_BADPARS: afficheMessage("hotlinkNodeGuid parameter is NULL",err); break; case APIERR_BADID: afficheMessage("hotlinkNodeGuid is invalid",err); break; default: afficheMessage("APIDb_UpdateHotlinkCacheID",err); break; } return err; } /*************************************************************************/ /******************PLACE LE MODULE LIE DANS LA DATABASE*******************/ err = ACAPI_OpenUndoableSession ("Place le module"); if (err == NoError) { BNZeroMemory (&element, sizeof (API_Element)); element.header.typeID = API_HotlinkID ; element.header.index = 1; err = ACAPI_Element_GetDefaults (&element, &memo); if (err == NoError) { element.hotlink.type = APIHotlink_Module; element.hotlink.hotlinkNodeGuid = myAPI_HotlinkNodeGuid; err = ACAPI_Element_Create(&element, &memo); if (err != NoError) { switch(err) { case APIERR_BADPARS: afficheMessage("The passed parameter is NULL; element",err); break; case APIERR_BADID: afficheMessage("The element type is invalid, or the element type is not supported by the server application",err); break; case APIERR_BADDATABASE: afficheMessage("The current database is not proper for the operation",err); break; case APIERR_REFUSEDPAR: afficheMessage("The element->header.typeID parameter was incorrect. It might happen if you want to create something in a window not capable to display it, for example a wall in a section window. ",err); break; case APIERR_NOTMINE: afficheMessage("The element was attempted to be created on a layer owned by someone else. Most likely to occur when working on documents in teamwork mode. ",err); break; case APIERR_LOCKEDLAY: afficheMessage("The element attempted to be created was on a locked layer",err); break; case APIERR_HIDDENLAY: afficheMessage("The element attempted to be created was on a hidden layer.",err); break; case APIERR_INVALFLOOR: afficheMessage("The element->header.floorInd parameter is out of range.",err); break; case APIERR_REFUSEDCMD: afficheMessage("The passed identifier is not subject to the operation.",err); break; default: afficheMessage("ACAPI_Element_Create",err); break; } return err; } err = ACAPI_Database (APIDb_RedrawCurrentDatabaseID,NULL,NULL,NULL); if (err != NoError) afficheMessage("APIDb_RedrawCurrentDatabaseID",err); ACAPI_DisposeElemMemoHdls (&memo); } else afficheMessage("ACAPI_Element_GetDefaults",err); ACAPI_CloseUndoableSession(); } else afficheMessage("ACAPI_OpenUndoableSession",err);if someone would know the thing i forgot to do, thank you in advance for your help.
2008-12-18 01:22 AM
atila-diffusion wrote:Is an error returned at any point in this function? If so, where, and which error code?
Hello,
i'm trying since last month to write a plugin which load an external Hotlinked Module and place it on the project.
I'm near the end , i'v loaded the module, assigned it to an element but i don't succeed to place it on the project.
2008-12-18 09:03 AM
2008-12-18 10:45 AM
atila-diffusion wrote:Check the easy things first - have you checked the storey (floor) and layer applied? And what does the transformation matrix contain?
not any error is returned, that's why I really don't know what is missing.
2008-12-18 11:28 AM
element.hotlink.transformation.tmx[3] = 10; element.hotlink.transformation.tmx[7] = 4; double co = cos (0.52359877556); double si = sin (0.52359877556); element.hotlink.transformation.tmx[0] = element.hotlink.transformation.tmx[5] = co; element.hotlink.transformation.tmx[1] = -si; element.hotlink.transformation.tmx[4] = si;about the layer is it this :
element.header.layer = 1;
2008-12-18 11:35 AM
2008-12-18 12:15 PM
2008-12-18 12:21 PM
atila-diffusion wrote:Yes, you need a developer ID from Graphisoft to enable the add-on to work with the commercial version of ArchiCAD. Take a look at the information here:
Do you know if we have to ask for a validation to graphisoft before to sell a plugin, or to do something else?
2008-12-18 02:08 PM