[V8i MDL] How to Call ProjectWise API from native code MDL?

Hi experts,

I'm trying to call ProjectWise API from MDL like this

#include <MicroStationAPI.h>
#include "AADMSDEF.H"
#include "AADMSAPI.H"
#include "AAWINDMS.H"
#include "AAWDDEF.H"
#include "AAAPIVER.H"
#include "AAATYPES.H"
#include "AAWINAPI.H"
#include "..\TestPW.h"


extern "C" DLLEXPORT int MdlMain (int argc, char *argv[])
{
   if (aaApi_Initialize(AAMODULE_EXPLORER))
   {
	   if (aaApi_Login(AAAPIDB_ODBC,L"IDCPWIS01.corp.abcglobal.com:PW_OP_DATASOURCE",L"abcglobal\\pwbatch", L"password",NULL)}
           mdlDialog_dmsgsPrint ("log in Successfully!");;
    
   }
   return 0;
}

but VS2008 can't compile it, saying something like "Cannot open include file: 'AADMSDEF.H': No such file or directory", even though I've already added ProjectWise SDK include path. If I use similar VBA code, no problem at all.

I searched the forum, seem no examples about calling PW API from MDL, neither in PW SDK samples.

Thanks in advance. 

Parents
  • Just to back up here a bit... could you identify what it is you are trying to develop? IOW, what type of workflow or function are you looking to achieve? That might help provide some ideas and suggestions.

      

  • Thanks Jon, Jan and Phil for your quick response.

    1. I'm using VS2008, so I added the path by Tools/Options/Projects and Solutions/VC++ Directories, added "Include files" to PW SDK include folder. Also I added "Library files" to PW SDK's libwin32. So IntelliSense works file.

    2. But I'm using make file in VS2008, not VS build system. I followed Yongan's "Step by Step to learn MDL" to create external tool VS. This tool is actually using bmake..

    3. As you know, currently OpenPlant Modeler V8i and MS V8i can publish imodels. After checking out a file from ProjectWise, and publish imodel, this imodel is in the PW working directory. So what I want to do is to publish imodel and then send it back to designated folder in PW. In this way, we don't have to rely on PW automation service to create imodel at regular basis.

    Hope I provide enough info, looking forward to your help. thanks again.
  • Unknown said:
    This tool is actually using bmake

    Whatever you do in Viz Studio is not automatically updated in your make (*.mke) file.  You must edit your make file (it's plain text) and add include paths manually.  You need to specify the right switch to tell C++ to add the /I switch.  You can do that in your make file using the cincapnd.mki macro.

    See this article about C++ Projects, in particular the section about make include file cincapnd.mki.

     
    Regards, Jon Summers
    LA Solutions

  • #dirToSearch = $(MSMDE)/mdl/MicroStationAPI
    dirToSearch = $(PW)SDK/include
    %include cincapnd.mki

    Hi Jon,

    I followed the instructions in the article above, changed this line in the make file as this:

    but still can't compile it, got new error:

    fatal error C1189: #error :  UNICODE is not defined. UNICODE must be defined for correct API arguments.

    As you know, all PW APIs are Unicode.

    I can't afford too much time for doing this kind of pioneer testing, just wondering nobody has ever  done PW API calling?

  • Unknown said:
    fatal error C1189

    Well, we answered your original question: the PW header file is now seen by the C++ compiler.

    Unknown said:
    UNICODE is not defined

    Presumably that PW file, or another file that it includes, expects macro UNICODE to be #defined.  In your Viz Studio that may or may not be the case (it's an option in your Project settings).  In your bmake settings, you should add that via another compiler switch:

    nameToDefine = UNICODE
    %include cdefapnd.mki

    Unknown said:
    I can't afford too much time for doing this kind of pioneer testing

    You're a developer. You do things that others haven't done. Otherwise, it would not be development; you would be a chef and follow a recipe.

     
    Regards, Jon Summers
    LA Solutions

Reply
  • Unknown said:
    fatal error C1189

    Well, we answered your original question: the PW header file is now seen by the C++ compiler.

    Unknown said:
    UNICODE is not defined

    Presumably that PW file, or another file that it includes, expects macro UNICODE to be #defined.  In your Viz Studio that may or may not be the case (it's an option in your Project settings).  In your bmake settings, you should add that via another compiler switch:

    nameToDefine = UNICODE
    %include cdefapnd.mki

    Unknown said:
    I can't afford too much time for doing this kind of pioneer testing

    You're a developer. You do things that others haven't done. Otherwise, it would not be development; you would be a chef and follow a recipe.

     
    Regards, Jon Summers
    LA Solutions

Children
No Data