Getting ViewContext from IViewManager

Hi guys,

 On including the IViewManager.h to my application i got this error msg.

 C:\PROGRA~1\Bentley\MICROS~1\MICROS~1\mdl\MicroStationAPI\interface\IViewManager.h(126) : error C2061: syntax error : identifier 'IRedrawOperation'

I checked the function in the documentation and its like this

void DoElementAgendaDynamics (ElementAgendaP, IRedrawOperation *, ClipDescrP)

and in the header file its like this

MSCORE_EXPORT void DoElementAgendaDynamics (ElementAgendaP, IRedrawOperation*, ClipDescrP);

So both looks same but still getting the error....any idea why?

 Thanks and Regards,

Arpan

  • Please ignore the last post....i got it working.

    I got the viewPort and still trying to find out how to get the viewContext from that.

    Brien gave some hint about it in http://communities.bentley.com/Products/MicroStation/MicroStation_V8i/MicroStation_V8i_Programming/f/19569/t/47082.aspx but i didnot get what exactly he meant.

    Regards,
    Arpan

  • Hi Mark,

     Thanks for sending the link, however when i am trying to access the link i am getting this message.

    Weblog not found
    Either the Weblog you are trying to access does not exist or you do not have permission to access it. If it is a Communities Weblog you need to be a member of that Community in order to participate.

    Where i should register to get access to that link? Does my current account of Bentley communities not having the permissions to this link???

     Thanks and Regards,

    Arpan

  • That specific blog article is in the Bentley Developer Network community, which is something that current Bentley Developer Network members can access.

      

  • Dear Phil,

    I went to Bentley Developer Network and sent a request to join the group. Is this all the procedure? Or i have to register somewhere else also? I m just waiting for my request to be accepted.

     Thanks,

    Arpan

  • You first need to be a Bentley Developer Network member. Please see your Private Messages for more information regarding that.

      

  • Hi Guys,

    I cheked the example given in the BDN community but still having some doubts.....

    1) How to call ViewTransients::DrawTransients (IViewContextP context, bool isPreUpdate) method?

    I am trying as ViewTransients::DrawTransients(Context, false);

    But the question is how to pass the Context into the function? What i am having is

    IViewManagerR viewManager = Bentley::Ustn::IViewManager::GetManager();
    ViewportP viewPort = viewManager.GetViewport(1);

    But how to get Context from here to pass it to the DrawTransients function?

     

    2)  I am trynig to use context->GetIDrawGeom() inside the DrawTransients function.

    But i am getting errors like

    D:\Lidar\basic\basic.cpp(203) : error C2027: use of undefined type 'Bentley::Ustn::ViewContext'
    C:\PROGRA~1\Bentley\MICROS~1\MICROS~1\mdl\include\mstypes.h(456) : see declaration of 'Bentley::Ustn::ViewContext'
    D:\Lidar\basic\basic.cpp(203) : error C2227: left of '->GetIDrawGeom' must point to class/struct/union/generic type
    D:\Lidar\basic\basic.cpp(203) : error C2227: left of '->DrawPointString3d' must point to class/struct/union/generic type

    I tired to include Bentley::Ustn::IDrawGeom (and Bentley::Ustn::ViewContext also) and then IDrawGeomP drawGeom = context->GetIDrawGeom ();

    But getting errors again : 

    D:\Lidar\basic\basic.cpp(201) : error C2867: 'Bentley::Ustn::IDrawGeom' : is not a namespace

    D:\Lidar\basic\basic.cpp(203) : error C3622: 'Bentley::Ustn::IDrawGeom': a class declared as 'abstract' cannot be instantiated
    C:\PROGRA~1\Bentley\MICROS~1\MICROS~1\mdl\MicroStationAPI\interface\IViewDraw.h(523) : see declaration of Bentley::Ustn::IDrawGeom'
    D:\Lidar\basic\basic.cpp(203) : error C2027: use of undefined type 'Bentley::Ustn::ViewContext'
    C:\PROGRA~1\Bentley\MICROS~1\MICROS~1\mdl\include\mstypes.h(456) : see declaration of 'Bentley::Ustn::ViewContext'
    D:\Lidar\basic\basic.cpp(203) : error C2227: left of '->GetIDrawGeom' must pointto class/struct/union/generic type

     I want to use DrawPointString3d(...) method and for that getting context and getting object of context->GetIDrawGeom (); is really important but somehow these two important things seems to be missing everywhere.

    Can i get some simple example how to use DrawPointString3d(...)  function??

     Thanks and Regards,

    Arpan

  • Arpan:

    I checked the example given in the BDN community but still having some doubts.....

    I've attached an incomplete example that may help. It's a work-in-progress, but it shows how to do what you want from a ViewContext.

    It draws a line-string and a circle at the origin. Coordinates are hard-coded — it's not interactive.

    Regards, Jon Summers
    LA Solutions

     
    Regards, Jon Summers
    LA Solutions

    ViewTransients-MicroStationAPI.zip
  • Jon Summers:

    I've attached an incomplete example that may help

    Thanks a Ton Jon, that really helped.....i was trying to working up with your example.

    Now i am having DPoint3d Array and want it to convert to EmbeddedDPoint3dArray using jmdlEmbeddedDPoint3dArray_new () and jmdlEmbeddedDPoint3dArray_addDPoint3dArray(...) so that i can use output->DrawPointString3d (jmdlEmbeddedDPoint3dArray_getCount (pMyArray), jmdlEmbeddedDPoint3dArray_getPtr (pMyArray, 0), NULL).

    I have included header file <msembeddedarray.h> and <embeddeddpoint3darray.fdf>.

    On compilation i am getting error :

    error LNK2019: unresolved external symbol _jmdlEmbeddedDPoint3dArray_new referenced in function

    C:\PROGRA~1\Bentley\MICROS~1\MICROS~1\mdlapps\ViewTransients.dll : fatal error LNK1120: 1 unresolved externals

    Any idea what i am doing wrong here?

    Regards,

    Arpan

  • Build, Compile, or Link?

    Arpan:

    On compilation I am getting error :

    error LNK2019: unresolved external symbol _jmdlEmbeddedDPoint3dArray_new referenced in function

    C:\PROGRA~1\Bentley\MICROS~1\MICROS~1\mdlapps\ViewTransients.dll : fatal error LNK1120: 1 unresolved externals

    That's not a compilation error, it's a linker error.

    Let's understand what is happening when a project is built. The make file invokes the:

    1. compiler to convert your source code (*.h, *.cpp) to intermediate object modules (*.obj)
    2. linker to merge your object modules (*.obj) and resolve function calls with external libraries (*.lib, *.dll)

    When the Visual C++ compiler detects a source code error it issues an error code C1234. Note the 'C' prefix. When the Visual C++ linker is unable to locate the compiled definition of a function in an object or library it issues an error code LNK234. Note the 'LNK' prefix.

    Your error is fairly explanatory: your compilation has succeeded, but the linker can't find the definition of jmdlEmbeddedDPoint3dArray_new. Lookup that function in MDL help: it tells you to #include <embeddeddoublearray.fdf> in your source code, and to link with mtg.lib. In other words, you need to include mtg.lib in the project's linker options in your bmake (.mke) file:

    
    DLM_LIBRARY_FILES 	=	$(mdlLibs)BentleyDgn.lib	\
    $(mdlLibs)toolsubs.lib		\
    $(mdlLibs)ditemlib.lib		\
    $(mdlLibs)mdllib.lib 		\
    $(mdlLibs)mdlbltin.lib
    
    

    If you fire up MSDN help (or locate MSDN's web site) you can look up Microsoft compiler and linker errors.

    Regards, Jon Summers
    LA Solutions

     
    Regards, Jon Summers
    LA Solutions