//0表示wcs 1表示ucs 2 DCS, 3 PSDCSAcGePoint3dCGlobalHelper::TransformPoint(constAcGePoint3d&point,intnFromType,intnToType){AcGePoint3dpt;//从ucs转到wcsstructresbufrbFrom,rbTo;rbFrom.restype=RTSHORT;rbFrom.resval.rint=nFromType;// from wcsrbTo.restype=RTSHORT;rbTo.resval.rint=nToType;// from ucsacedTrans(asDblArray(point),&rbFrom,&rbTo,Adesk::kFalse,asDblArray(pt));returnpt;}
voidCGlobalHelper::ZOOMWINDOW(AcGePoint3dminPt,AcGePoint3dmaxPt){// get the extents of the drawingAcDbViewTableRecordview;AcGePoint2dmax_2d(maxPt[X],maxPt[Y]);AcGePoint2dmin_2d(minPt[X],minPt[Y]);// now set the view centre pointview.setCenterPoint(min_2d+(max_2d-min_2d)/2.0);// now height and width of viewview.setHeight(max_2d[Y]-min_2d[Y]);view.setWidth(max_2d[X]-min_2d[X]);// set the viewacedSetCurrentView(&view,NULL);// updates the extentsacdbHostApplicationServices()->workingDatabase()->updateExt(TRUE);}
structresbufrbFrom,rbTo;rbFrom.restype=RTSHORT;rbFrom.resval.rint=0;// from WCSrbTo.restype=RTSHORT;if(m_bISModelType){rbTo.resval.rint=2;// to dcs}else{rbTo.resval.rint=2;// to pdcsacedTrans(asDblArray(maxPt),&rbFrom,&rbTo,Adesk::kFalse,asDblArray(maxPt));acedTrans(asDblArray(minPt),&rbFrom,&rbTo,Adesk::kFalse,asDblArray(minPt));rbFrom.resval.rint=2;// from UCSrbTo.resval.rint=3;}intnCvport=2;utils.GetVar(_T("CVPORT"),&nCvport);if(nCvport>=2){acedTrans(asDblArray(maxPt),&rbFrom,&rbTo,Adesk::kFalse,asDblArray(maxPt));acedTrans(asDblArray(minPt),&rbFrom,&rbTo,Adesk::kFalse,asDblArray(minPt));}es=pPSV->setPlotWindowArea(pPlotSettings,minPt.x,minPt.y,maxPt.x,maxPt.y);
The points that you receive are relative to the coordinate system of the owning
AcDbBlockTableRecord. If you want to convert them to coordinate system of the
AcDbBlockTableRecord in which you have the AcDbBlockReference, you must
transform them by the AcDbBlockReference::blockTransform().
You probably first want to transform the "specified point" by the inverse of
AcDbBlockReference::blockTransform(), do the closest point calculation, then
convert the resulting point back to the original space.