Hi all,
I was trying to use DrawLineString3d(...) function from MicroStationAPI.
I included the file IViewDraw.h as required. But as i am trying to build the application i am getting error like:
error C3861 : 'DrawLineString3d': Identifier not found.
Any idea what i might be doing wrong here? I have set the Variable MS = C:\Program Files\Bentley\MicroStation V8i (SELECTseries 1) in my system's environment settings.
Thanks and Regards,
Unknown said: error C3861 : 'DrawLineString3d': Identifier not found.
Examine the MicroStationAPI documentation carefully. Note that DrawLineString3d lives in namespace Bentley::Ustn::IDrawGeom.
To use an object in a namespace you must tell the C++ compiler how to find that object. Either use the using namespace <namespace>; directive or provide a fully-qualified name.
using namespace Bentley::Ustn::IDrawGeom; DrawLineString3d (…); Bentley::Ustn::IDrawGeom::DrawLineString3d (…);
using namespace Bentley::Ustn::IDrawGeom; DrawLineString3d (…);
Bentley::Ustn::IDrawGeom::DrawLineString3d (…);
Regards, Jon Summers LA Solutions
Jon Summers: Bentley::Ustn::IDrawGeom::DrawLineString3d (…);
I used it as said above but still getting error like illegal call of non-static member function.
I used to access the function by creating the object also getting error like a class declared as abstract cannot be instantiated.
Please can you tell me how to use this function here.
Arpan
As documented in the MicroStationAPI help, IDrawGeom provides an interface, which in C++ idiomatically is usually an abstract class. You can obtain a reference to that interface using method ViewContext.GetIDrawGeom ():
using namespace … ; IDrawGeomP drawGeom = oViewContext.GetIDrawGeom ();
Now you're going to ask me how to get a ViewContext. I don't know: this is part of the mystery of the MicroStationAPI.
A ViewContext has to be attached to a ViewPort. But I don't see a method of ViewPort to do that.
Jon Summers: I don't know: this is part of the mystery of the MicroStationAPI.
I don't know: this is part of the mystery of the MicroStationAPI.
Surprised to know there is something called as mystery of Microstation for you also. For me you are the Master of Microstation.
I was going through some posts and got this one
http://communities.bentley.com/Products/MicroStation/MicroStation_V8i/MicroStation_V8i_Programming/f/19569/t/35468.aspx
Here Mark has given one example to use IViewContext......but i am not getting how to call that
Please have a look if you can figure out something out of this
/*=================================================================================**//** * @bsiclass +===============+===============+===============+===============+===============+======*/ struct ViewTransients : public IViewTransients { /*---------------------------------------------------------------------------------**//** * @bsimethod +---------------+---------------+---------------+---------------+---------------+------*/ void ViewTransients::_DrawTransients (IViewContextP context, bool isPreUpdate) override { if (NULL == s_pointsP) return; if (isPreUpdate) return; </p> <p> bool pathPushed = false; </p> <p> // DRAW_PURPOSE_Pick: In order to support locate/accusnap you must have an elementRef...should either push one or early return! if (NULL != context->GetIPickGeom ()) { #if defined (ALLOW_CLOUD_LOCATE) // Create dummy transient because we need it's element ref to build locate hit path... if (NULL == s_transEdP) { MSElement elm; DPoint3d pts[2]; </p> <p> memset (pts, 0, sizeof (pts)); mdlLine_create (&elm, NULL, pts); </p> <p> s_transEdP = mdlTransient_addElement (NULL, &elm, false, 0, ERASE, false, false, false); } </p> <p> context->PushPath (mdlTransient_getLastElementRef (s_transEdP)); pathPushed = true; #else return; #endif } </p> <p> switch (context->GetDrawPurpose ()) { case DRAW_PURPOSE_UpdateDynamic: { // Maybe you don't want to draw all the points during viewing operation dynamics? break; } </p> <p> case DRAW_PURPOSE_RangeCalculation: { // Should optimize for performance...called A LOT for view changes to adjust Z when front/back clipping is off... break; } </p> <p> case DRAW_PURPOSE_FitView: { // Can just display all the points...may wish to optimize, called for fit view... break; } } </p> <p> IViewDrawP output = context->GetIViewDraw (); </p> <p> // Setup color, fillcolor, weight, and style for points... output->SetSymbology (makeTrgbColor (200, 100, 100, 0), 0, 1, 0); </p> <p> #if defined (SINGLE_BATCH) // Optimal to draw batches of 4000 points...if not easy to do, qv will take care of it... output->DrawPointString3d (jmdlEmbeddedDPoint3dArray_getCount (s_pointsP), jmdlEmbeddedDPoint3dArray_getPtr (s_pointsP, 0), NULL); #else int nPoints = jmdlEmbeddedDPoint3dArray_getCount (s_pointsP); DPoint3d *ptsP = jmdlEmbeddedDPoint3dArray_getPtr (s_pointsP, 0); </p> <p> for (int iPoint = 0; iPoint < nPoints; iPoint++) { #if defined (BATCH_CHANGE_COLOR) // Setup color, fillcolor, weight, and style for this point... output->SetSymbology (makeTrgbColor ((iPoint%255), 0, 1, 0), 0, 1, 0); #endif </p> <p> output->DrawPointString3d (1, ptsP++, NULL); </p> <p> #if defined (BATCH_CHECKSTOP) if (0 == (iPoint%1000) && context->CheckStop ()) break; #endif } #endif </p> <p> #if defined (ALLOW_CLOUD_LOCATE) if (pathPushed) context->PopPath (); #endif } }; </p> <p> static ViewTransients s_viewTransients;
Regards,
Arpan Sood
Unknown said: Here Mark has given one example to use IViewContext. Please have a look if you can figure out something out of this
Here Mark has given one example to use IViewContext. Please have a look if you can figure out something out of this
Take a look at the Set View Title C++ Project.
This shows how to use one or two parts of the MicroStationAPI. A lot of the MicroStationAPI defines abstract interface classes, from which you must inherit and design a concrete class.
I think you probably need to start with something like this:
IViewManagerR viewManager = Bentley::Ustn::IViewManager::GetManager ();
GetManager is a static member of IViewManager and therefore is always available. Once you have a reference to IViewManager you can use GetViewport to obtain a ViewportP. What I still don't see is how to obtain a ViewContext from a ViewportP: the documentation says:
A ViewContext must be first attached to a Viewport to be useful, and must be detached from the Viewport to free any memory associated with its internal state.
But it omits to mention how one goes about making that attachment.
This thread is now off the original topic of C3861: Identifier not found. Please start a new thread for ViewContext.
Thanks for the hint!