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;
Solved! Go to Solution.
Solved by owenwengerd. Go to Solution.
It looks like acgsSetViewParameters expects a view that you created. I would try to create a new view and use that with acgsGetViewParameters/acgsSetViewParameters.
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.
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;
}