ObjectARX
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

What to do with "acgsGetGsView"-(Migration to ObjectARX AutoCAD 15)

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
mwst
1280 Views, 3 Replies

What to do with "acgsGetGsView"-(Migration to ObjectARX AutoCAD 15)

Hi Guys,

 

There is one function acgsGetGsView that seems to be taken out in R20.

 

I checked the documentation that came with ARX for migration. It just lists this function in the removed API list, but does not give any suggestions in the Use Instead column.

 

Any suggestions?

 

This is how it is being used in the source code I have.

 

resbuf cvport;

acedGetVar(L

"CVPORT", &cvport);

AcGsView *View = acgsGetGsView(cvport.resval.rint, true);

if (View)

{

double Radius = (zoom * 0.5) * GetToDWGScale();

AcGePoint3d ExtentsMin(pt.x - Radius, pt.y - Radius, pt.z);

AcGePoint3d ExtentsMax(pt.x + Radius, pt.y + Radius, pt.z);

View->zoomExtents(ExtentsMin, ExtentsMax);

BRes = acgsSetViewParameters(cvport.resval.rint, View,

true, true);

}

return Res;

3 REPLIES 3
Message 2 of 4
owenwengerd
in reply to: mwst

It looks like acgsSetViewParameters expects a view that you created. I would try to create a new view and use that with acgsGetViewParameters/acgsSetViewParameters.

--
Owen Wengerd
ManuSoft
Message 3 of 4
mwst
in reply to: owenwengerd

Thanks Owen,

 

If I use

acgsGetCurrentAcGsView

instead of

acgsGetGsView,

it seems to build and work fine so far.

 

I need more testing to say everything is fine 100%. But right now I am on my way.

I wonder if the solution was so simple, why didn't the migration document mention it.

Message 4 of 4
mwst
in reply to: mwst

 

Replacing the acgsgetgsview with acgsgetcurrentgsview does not fix the code. I can see it zooming to something, that's why I thought it is fixed. But when tested with real stuff, the behavior is different from old code. It is not zooming to the correct thing.

 

Here is the final fix

 

void ZoomGivenExtents(const AcGePoint2d& lowerLeft, const AcGePoint2d& upperRight)
{
 Acad::ErrorStatus Res = Acad::eOk;
 Adesk::Boolean BRes= Adesk::kFalse;  
 resbuf cvport;
 acedGetVar(L"CVPORT", &cvport);
#ifdef SPK_R20
 AcGsKernelDescriptor desc;
 desc.addRequirement( AcGsKernelDescriptor::k3DDrawing );
 AcGsView* View = acgsObtainAcGsView( cvport.resval.rint,desc );
#else
 AcGsView *View = acgsGetGsView(cvport.resval.rint, true);
#endif
 if (View)
 {
  View->zoomWindow(lowerLeft, upperRight);
  //View->zoomExtents(ExtentsMin, ExtentsMax);
  BRes = acgsSetViewParameters(cvport.resval.rint, View, true, true);
 }
 return;
}

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

”Boost