API Development Kit Version: 5.1

Frequently Asked Questions

 

  1. How do I create a template library part to be used in my add-on?

  2. You can find the answer here.

     

  3. How do I create an associative dimension in ArchiCAD 8?

    An example from the Automatic Dimensioning add-on shows how you can convert the old neig IDs to the new bool fields in API_Base:

    bool    NeigID2Line (API_NeigID neigID)
    {
        return (neigID == APINeig_WallOn     ||
                neigID == APINeig_WallPlOn   ||
                neigID == APINeig_BeamOn     ||
                neigID == APINeig_CeilOn     ||
                neigID == APINeig_RoofOn     ||
                neigID == APINeig_MeshOn     ||
                neigID == APINeig_HatchOn    ||
                neigID == APINeig_LineOn     ||
                neigID == APINeig_ArcOn      ||
                neigID == APINeig_SplineOn);
    }
    
    bool    NeigID2Special (API_NeigID neigID)
    {
        return   (neigID == APINeig_WallPl    || neigID == APINeig_WallPlOn ||
                  neigID == APINeig_BeamHole  ||
                  neigID == APINeig_WindHole  ||
                  neigID == APINeig_DoorHole  ||
                  neigID == APINeig_MeshRidge || neigID == APINeig_MeshRidgeOn);
    }
    
    static void MakeDimelemForWD (API_DimElem* dimelem, const MyCoord& mc)
    {
        WallRef     wr;
        long        i;
    
        for (i = 1; i <= mc.wrs.Count (); i++) {
            wr = mc.wrs[i];
    
            if (wr.openingpt != NOOPENINGPT) {
                dimelem->base.base.typeID  = (wr.iswindow ? API_WindowID : API_DoorID);
                dimelem->base.base.special = true;
                dimelem->base.base.line    = false;
                dimelem->base.base.index   = wr.wdindex;
                switch (wr.openingpt) {
                    case OPENINGPT0:
                        dimelem->base.base.inIndex = wr.inIndex;
                        break;
                    case OPENINGPT1:
                        dimelem->base.base.inIndex = wr.inIndex;
                        break;
                    default:
                        dimelem->base.base.inIndex = 4;   // center
                        break;
                }
                return;
            }
        }
    
        // Error if it comes here...
        return;
    }
    
  4. (Win only) My add-on runs perfectly on my development machine, but when I install it on a demo machine it refuses to load.

  5. This usually happens from one of the following reasons:

    • Visual Studio installs its own runtime libraries (MSVCxx.DLL and MSVCPxx.DLL) in the WINNT\System32 folder, and the APX is usually dynamically linked to those, i.e. it expects the DLLs to be there. On the systems you didn't install Visual Studio, the DLLs are simply not there. You can try to solve this by copying those files over to the appropriate place from the machines where you have Visual Studio installed.
      Note: ArchiCAD installs the necessary runtime libraries if they are not there.
    • You are trying to install a debug version of your add-on onto the demo machine. This won't work, because it is linked to the debug libraries of Visual Studio, which are not present on the demo machine. Compile a release version instead.

     

  6. Can I compile a GDL add-on, which uses the services of the General API DevKit?

  7. No. GDL add-ons use their own API environment, and that mixes quite badly with the General API running environment.

     

  8. How can I catch notifications immediately?

  9. Return APIAddon_Preload from your CheckEnvironment () function. This will ensure that your Initialize () function will be called immediately after the call to Registerface (), without requiring the user to perform any action. You can then safely install the notification callback function(s) from Initialize ().

     

  10. We defined an icon in the GRC file in the 3.1 DevKit, but they doesn't seem to appear with 4.1, and I also receive a resource conversion error. Also, what does those three numbers mean in the resource?

  11. 'GICN' 32501 "General Settings" {
       0  128  128
    }
    

    The '0 128 128' is the RGB color of the transparent area in the icon; in the range 0-255. The reason why is doesn't compile with DevKit 4.1 is because some of the colors (black and white) should be in fixed places within the icon's color table: black should be the first color, and white should be the last. Note that the icons are converted to 32-bit depth, so you cannot use arbitrary big sizes.

     

  12. I'm creating a library part from my add-on, and I also put in a preview picture, but it doesn't appear.

  13. In ArchiCAD 8 you should add the MIME type of the preview picture as a C string (with the terminating 0) to the beginning of the data handle containing the preview picture. (e.g. "image/png\0" for a PNG image)

     

  14. I have modified the .grc file but when I compile only the .ro file is being updated and the .rc file is unchanged. Is there a way to force the .rc file to recompile? I am using visual C++ 6.0.

  15. Open "Settings..." for the .rc file, click on "Dependencies..." in the lower right corner, and add the .grc files in the dialog.

     

  16. Is there a default callback for the simple popup menu-like custom control?

  17. No. You'll have to write your own callback to load the data from your resource file, and pass it to the user control with UC257SetData. You'll also have to call UC257SetType, and possibly UC257SetStyle. Send an email to devsup if you need help.

     

  18. (Win only) When I link my add-on, I receive the following warning:
    LINK : warning LNK4098: defaultlib "MSVCRT" conflicts with use of other libs; use /NODEFAULTLIB:library

  19. This only means that you are compiling the debug version of your add-on (thus linking to the debug version of the runtime DLLs), whereas the libraries shipped with the DevKit are release versions (which are linked to the release version of the runtime DLLs). This doesn't cause any problem.

     

width=31 Copyright © 2003 - Graphisoft R&D Software Development Rt. All rights reserved worldwide.
Built on February 28, 2003