objectARX说明函数(2)

2020-04-21 00:53

int ptNum,i,interNum; AcGePoint3d ptA,ptB;

ads_point pt0,pt1,pt2,ptIns,ptX;

interNum = 0; pt0[X] = 0.0; pt0[Y] = 0.0; pt0[Z] = 0.0; ptX[X] = pt.x; ptX[Y] = pt.y; ptX[Z] = pt.z;

ptNum = ptArr.length(); for (i = 0;i < ptNum - 1;i++){ ptA = ptArr.at(i); ptB = ptArr.at(i + 1); pt1[X] = ptA.x; pt1[Y] = ptA.y; pt1[Z] = 0.0; pt2[X] = ptB.x; pt2[Y] = ptB.y; pt2[Z] = 0.0;

if (acdbInters(ptX,pt0,pt1,pt2,1,ptIns) == RTNORM){ interNum++; } }

if (interNum % 2 == 0){ return false; }else{ return true; }

2008-05-29 13:58

/****************************************************************** 函数名: setView

功能: 设置视图(相当于Zoom Window命令) 输入参数: Pt1 -- 视图左上角点 Pt2 -- 视图右下角点

ex_ratio -- 扩展比率,一般为1.0 输出参数: 返回值: void 其它:

*****************************************************************/ void setView(AcGePoint2d Pt1, AcGePoint2d Pt2, double ex_ratio) {

AcGePoint2d CenterPt;

//若X坐标或Y坐标重合,判为意外,不进行SetView操作 if ((fabs(Pt1.x-Pt2.x)<1e-6)||(fabs(Pt1.y-Pt2.y)<1e-6)) return;

//确保两个坐标点分别为左上角和右下角 if (Pt1.x>Pt2.x) { double tmp; tmp = Pt1.x; Pt1.x = Pt2.x; Pt2.x = tmp; }

if (Pt2.y>Pt1.y) { double tmp; tmp = Pt1.y; Pt1.y = Pt2.y; Pt2.y = tmp; }

//获取当前DwgView的尺寸 CRect CADrect;

acedGetAcadDwgView()->GetClientRect(&CADrect); double width,height,ratio;

ratio = (double)(CADrect.right-CADrect.left)/(double)(CADrect.bottom-CADrect.top); if (fabs(ratio)<1e-6) return;

if ((Pt2.x-Pt1.x)/(Pt1.y-Pt2.y) > ratio) { width = Pt2.x-Pt1.x;

height = width/ratio; }else{

height = Pt1.y-Pt2.y; width = height * ratio; }

//设置当前视图中心点 CenterPt.x = (Pt1.x+Pt2.x)/2; CenterPt.y = (Pt1.y+Pt2.y)/2; //改变当前视图

AcDbViewTableRecord pVwRec; pVwRec.setCenterPoint(CenterPt); pVwRec.setWidth(width * ex_ratio); pVwRec.setHeight(height * ex_ratio); acedSetCurrentView( &pVwRec, NULL ); }

/////////////////////////////////////////////////////////////// // 函 数 名 : oxaGetVar // 函数功能 : // 处理过程 : // 备 注 : // 作 者 : user

// 时 间 : 2004年6月16日 // 返 回 值 : int

// 参数说明 : const CString strSym, // AcGePoint3d &vOut

/////////////////////////////////////////////////////////////// int oxaGetVar(const CString strSym, AcGePoint3d &vOut ) {

resbuf rbVar ;

int iRt=acedGetVar(strSym, &rbVar) ; if (iRt!=RTNORM) {

return iRt; }

//oxaPrint(&rbVar);

if (rbVar.restype==RTPOINT) {

vOut.x=rbVar.resval.rpoint[0]; vOut.y=rbVar.resval.rpoint[1]; }

if (rbVar.restype==RT3DPOINT) {

vOut.x=rbVar.resval.rpoint[0]; vOut.y=rbVar.resval.rpoint[1]; vOut.z=rbVar.resval.rpoint[2]; }

return RTNORM; }

///////////////////////////////////////////////////////////////////////////////// //# DOC.BEGIN

//# 函数名称: oxaGetVar //# 函数编号: OXA //# 函数声明:

//# 函数参数: const CString strSym, // int &vOut //# 返回值: int //# 函数分类:

//# 函数功能: 获取系统变量, 封装acedGetVar() //# 注意事项: //# 涉及的全局变量: //# 调用的OXARX函数: //# 函数算法:

//# ACAD版本:R14 R15 R16 //# 配合函数: //# 类似函数: //# 替换函数: //# 现存缺陷: //# 示例程序: //# 测试要求:

//# 历史记录: 2003年11月10日 , zjw ,完成 //

//# DOC.END

////////////////////////////////////////////////////////////////////////// int oxaGetVar(const CString strSym, int &vOut ) {

resbuf rbVar;

int iRt=acedGetVar(strSym, &rbVar) ; if (iRt!=RTNORM) {

return iRt; }

if (rbVar.restype==RTLONG) {

vOut=rbVar.resval.rlong; }

if (rbVar.restype==RTSHORT) {

vOut=rbVar.resval.rint; }

return RTNORM; }

///////////////////////////////////////////////////////////////////////////////// //# DOC.BEGIN

//# 函数名称: oxaGetVar //# 函数编号: OXA //# 函数声明:

//# 函数参数: const CString strSym, // double &vOut //# 返回值: int //# 函数分类:

//# 函数功能: 获取系统变量, 封装acedGetVar() //# 注意事项: //# 涉及的全局变量: //# 调用的OXARX函数: //# 函数算法:

//# ACAD版本:R14 R15 R16 //# 配合函数:


objectARX说明函数(2).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:(道歉信)给女友的感人道歉信范文3篇

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: