We value your input! Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey
2004-06-15 07:45 PM - last edited on 2023-08-07 12:21 PM by Doreena Deng
Looking at the PDF link that you posted, I think you're in for some "fun", Tor Jørgen! Welcome!I'm glad for the welcome, but I worry that maybe I'm in over my head - I guess thats where the fun starts...
2004-06-21 06:50 PM
stefan wrote:OK, I've looked into this (as I'm responsible for that AppWizard since I've created it ... ). The problem seems to be the following:
STEP 2 : creating a skeleton addon
(I'll explain it for Windows, but I guess it won't be too much different on the Mac)
In Visual Studio 6.0 you can create a new ArchiCAD Add-on with the provided wizard. Select the API DevKit folder and (optionally) add support for dialogs & input/output. We won't need them for "Hello World".
Let it generate a complete project and try to compile. It won't work!RFIX.WIN\..\Debug\HelloWorldFix.grc.rc2 (26): error RC2104 : undefined keyword or key name: WIN_LANGUAGE_IDAdd the Developer ID
...
Correct the missing keywords
This part is what I am not so sure about, but I've got it to work, so here it goes: the WIN_LANGUAGE_ID which is not recognised is actually defined in "GSLocalization.h". This file is included in the "HelloWorldFix.grc" file, which is used by the "Resource Conversion" program to generate a real resource file: "HelloWorldFix.grc.rc2".
In the localization header, we can see some info about the different language versions of ArchiCAD. I wasn't so sure how to solve it, but I tried and the following got it going: I added a few extra defines in my header files, so the included Localization file can derive the correct definitions. Inside "HelloWorld.rc2" I added a few lines like this, after the #include <Windows.h>:#include <Windows.h> #define INT__APP #define INTERNAL_NAME "HelloWorld" #define ORIGINAL_NAME "HelloWorld.apx" #if !defined (WINDOWS) #define WINDOWS #endifI guess the strings don't matter that much, but the first define made the lookup in the Localization header work.
And yes, now it compiles fine.
checking the compiled APX
...
@#define INT__APP @#define INTERNAL_NAME "Hello World" @#define ORIGINAL_NAME "HelloWorld.apx" @ @#define COMPANY_STR "Some Company" @#define COPYRIGHT_STR "Copyright © Some Company 2004" @#define FILEDESC_STR "API DevKit Sample" @AddOnFix.grc should contain:
@#include "GSLocalization.h" @ /* Version resource - uses strings defined in the localizable resource file */ 'VERS' { COMPANY_STR COPYRIGHT_STR FILEDESC_STR 1.00 1.00 "ArchiCAD" 8.1 }Hope that clears up the problem...
2004-06-23 11:45 AM
The behavior of ACAPI_WriteReport depends on the "Write Report" switch in Imaging and Calculation preferences.I tried switching it on and off, but no message box appeared. I then tried switching off the "Interrupt with error messages" switch, and suddenly I've got greetings both in the message box and the report window
If you want an alert box which appears in every case, use DGAlert, DGResAlert, or DGResAlertParam.I would love to use them, but again I'm struggling to figure out what is the bare essentials here. When I study the example Add Ons it's hard, for me at least [newbie], to grasp what it is I need for this simple task and what do I need for another one...
2004-06-23 12:52 PM
vannassen wrote:First up, use the documentation provided with the developer kit - it has a very good description of these functions. You really
Then Akos wrote:If you want an alert box which appears in every case, use DGAlert, DGResAlert, or DGResAlertParam.I would love to use them, but again I'm struggling to figure out what is the bare essentials here.
DGAlert(DG_INFORMATION, "Hello Alert", "Hello World", 0, "OK", 0, 0);This will display a standard message alert titled "Hello Alert" and displaying the message "Hello World" with a single "OK" button. You will ultimately not want to hard-code your strings as shown above. Put them in your add-ons resources instead, i.e. into a .grc file, and retrieve them with 'ACAPI_Resource_GetLocStr'
2004-06-23 03:28 PM
.HODE 0: ! ..TEGNSETT DOSN8 ! ..TRANSPAR ! ...KOORDSYS 41 ! ...ORIGO-Nù 0 0 ! ...ENHET 0.010 ! ..OMRèDE ! ...MIN-Nù 6526954 311542 ! ...MAX-Nù 6527158 311652 ! ..SOSI-VERSJON 3.1 ! ..SOSI-NIVè 4 ! .BUE 1: ..OBJTYPE SenterlinjeVeg ..RADIUS 44.565 ..LTEMA 7001 ..NùH 652701270 31156088 0 652700509 31157665 0 .LINJE 2: ..OBJTYPE SenterlinjeVeg ..LTEMA 7001 ..NùH 652700509 31157665 0 652697796 31161213 0 ... and so on...which is a way of spesifying the head 0 (general info), arc 1, line 2, coordinates, what layer it should be put on, and so on. I'm thinking that maybe this should have been a xml file, and I have this problem with the characterset, as you see, but as it's the norwegian department in charge of mapping who's in charge, I shouldn't hope for too much...
2004-06-23 03:50 PM
Tor wrote:That's a common problem with any API - there usually
I am,really, trying to familiarize myself with the documentation. I guess my real problem is that I haven't done this type of programming before, and that the first thing is just as new and overwhelming as the next.
Tor wrote:I don't think it will work on a Mac - the last time I looked at that, it was a Windows-only feature. Someone correct me if that has changed.
so for now I'll just leave the fact that I couldn't get the icon thing from LubosC to work...
2004-06-24 03:54 PM
2004-06-24 10:43 PM
Tor wrote:Have you searched for any existing resources for reading this file format? There may be code/libraries available, especially if this format is in the public domain, i.e. it is not a proprietry format. If you can find anything, it may be a starting point for an ArchiCAD-based reader.
What I'm trying to do is reading the sosi-file I showed a bit of in my last posting, and build some ArchiCAD-stuff from it
Tor wrote:These questions are too open-ended - you need to work through the problem some more. Look for existing resources which might relate to this problem. Do some research. Write some psuedo-code. Break the problem into smaller modules, and then progressively work up the detail for each of them. Then some answers to your questions might start to become apparent and you can come back with more detailed questions.
what are the recommended classes to use for that kind of thing ...
I'm also concerned with stucture; should I keep all the routines for handling the reading of the file in one cpp-file, and than the buildingroutines in another cpp-file?
2004-06-25 10:06 AM
You can debug, set break points, inspect variable/memory, etc. You need to set ArchiCAD as the target executable in your runtime settings so that it is launched when you 'Run' your add-on, and the build settings need to be appropriate for debugging, e.g. low optimisation. I could be more specific if you can provide a brief description of the platform you are using, e.g. OS, IDE/compiler, AC version, etc.
2004-06-25 11:17 AM
Tor wrote:First check that you have a Debug target in your project. If you used the 'Graphisoft Add-on' template when you created the project, you should have two targets: Final and Debug. You want to use the Debug target. All the files should be set to compile for debugging (in the debug column in the main project window). Optimisation should be turned off. Breakpoints can be set by clicking in the column to the far left of the relevant line of code.
Ralph wrote:You can debug, set break points, inspect variable/memory, etc. You need to set ArchiCAD as the target executable in your runtime settings
I've set the working ArchiCAD application as target under 'Runtime settings'. Usually I just click 'Compile' and then 'Make' and then use 'Add-On manager' in ArchiCAD to get the Add-On. That works, but then I can't see any debug info anywhere. I've tried choosing 'Debug' instead, but then everything (CodeWarrior) freezes...
2004-07-02 01:04 PM
All the files should be set to compile for debugging (in the debug column in the main project window).I'm not quite shure what you mean, but I've clicked the little dot under the little green bug in the main project window.