gxglhnnywzk 发表于 2005-8-22 21:23:00

请高手指点一二!

struct point
{double x,y,z;
};
int fk(point &ptMin, point &ptMax)
{    AcApDocManager *acDocManager;
    AcApDocument* pDoc = acDocManager->curDocument();
    acDocManager->lockDocument(pDoc);
    ads_point pt1,pt2;
    acedGetPoint(NULL,"Ñ¡¶¨×°ÔØ·¶Î§: ", pt1 );
    if(acedGetCorner(pt1,NULL,pt2)==RTCAN) return 0;

    if(pt1unlockDocument(pDoc);

    return 1;

}

void :inifk()
{
    AcApDocManager *acDocManager;
    AcApDocument* pDoc = acDocManager->curDocument();
    acDocManager->lockDocument(pDoc);
    CString tmp,strtmp;
    strtmp+="zoom ";;
    tmp.Format("%-10.4lf",pMin.x);
    strtmp+=tmp;strtmp+=",";
    tmp.Format("%-10.4lf",pMin.y);
    strtmp+=tmp;
    tmp.Format("%-10.4lf",pMax.x);
    strtmp+=tmp;strtmp+=",";
    tmp.Format("%-10.4lf",pMax.y);
    strtmp+=tmp;strtmp+=" ";
//AfxMessageBox(strtmp);
    acDocManager->sendStringToExecute(pDoc,strtmp,true,false,true);
    acDocManager->unlockDocument(pDoc);


}
inifk();//初始化绘图范围
fk();//选择小部分绘图范围
两个函数连续执行有点问题
单个执行都没有问题。请高手指点一二!
qq :514341794 e-mail: gxglhnnywzk@tom.com

风之助 发表于 2005-8-22 23:33:00

请教第一个问题:定义这个struct point有什么意义。
在ObjectARX中或者用ads_point,或者用AcGePoint3d类(gepnt3d.h )、AcGePoint2d类(gepnt2d.h),有现成的东东最好拿来用,因为其比较完善。
而且有现成的转换函数(geassign.h ):
double * asDblArray(const AcGePoint3d& pnt);
AcGePoint2d & asPnt2d(const double* pnt);
AcGePoint3d & asPnt3d(const double* pnt);
第二,函数 inifk()中变量pMin没有定义。

风之助 发表于 2005-8-22 23:48:00


这两个函数的现实意义或你的设想?

gxglhnnywzk 发表于 2005-8-23 08:02:00

问题关键不在与 STRUCT POINT 关键在于acDocManager->sendStringToExecute(pDoc,strtmp,true,false,true);执行后,再执行FK(),结果是先执行FK(),不能够按原来的设计执行。
请高手联编执行一下。
inifk();目的就是先将当前绘图区设置好。fk()  当前绘图区选择部分区域。
页: [1]
查看完整版本: 请高手指点一二!