老朋友了,送你几个函数
///////////////////////////////////////////////////////////////////////////// //////////////////////////// GLOBAL GETVAR FUNCTIONS //////////////////////// /////////////////////////////////////////////////////////////////////////////
/**************************************************************************** ** ** getSysVar (INT) ** ** **jma ** *************************************/
Acad::ErrorStatus getSysVar(LPCTSTR varName, int& val) { resbuf rb; if (acedGetVar(varName, &rb)== RTNORM) { ASSERT(rb.restype == RTSHORT); val = rb.resval.rint; return(Acad::eOk); } else return(Acad::eInvalidInput); }
/**************************************************************************** ** ** getSysVar (DOUBLE) ** ** **jma ** *************************************/
Acad::ErrorStatus getSysVar(LPCTSTR varName, double& val) { resbuf rb; if (acedGetVar(varName, &rb) == RTNORM) { ASSERT(rb.restype == RTREAL); val = rb.resval.rreal; return(Acad::eOk); } else return(Acad::eInvalidInput); }
/**************************************************************************** ** ** getSysVar (string) ** ** **jma ** *************************************/
Acad::ErrorStatus getSysVar(LPCTSTR varName, CString& val) { resbuf rb; if (acedGetVar(varName, &rb) == RTNORM) { ASSERT(rb.restype == RTSTR); val = rb.resval.rstring; free(rb.resval.rstring); return(Acad::eOk); } else return(Acad::eInvalidInput); }
/**************************************************************************** ** ** getSysVar (2D point) ** ** **jma ** *************************************/
Acad::ErrorStatus getSysVar(LPCTSTR varName, AcGePoint2d& val) { resbuf rb; if (acedGetVar(varName, &rb) == RTNORM) { ASSERT(rb.restype == RTPOINT); val.set(rb.resval.rpoint[X], rb.resval.rpoint[Y]); return(Acad::eOk); } else return(Acad::eInvalidInput); }
/**************************************************************************** ** ** getSysVar (3D point) ** ** **jma ** *************************************/
Acad::ErrorStatus getSysVar(LPCTSTR varName, AcGePoint3d& val) { resbuf rb; if (acedGetVar(varName, &rb) == RTNORM) { ASSERT(rb.restype == RT3DPOINT); val.set(rb.resval.rpoint[X], rb.resval.rpoint[Y], rb.resval.rpoint[Z]); return(Acad::eOk); } else return(Acad::eInvalidInput); }
///////////////////////////////////////////////////////////////////////////// //////////////////////////// GLOBAL SETVAR FUNCTIONS //////////////////////// /////////////////////////////////////////////////////////////////////////////
/**************************************************************************** ** ** setSysVar(INT) ** ** **jma ** *************************************/
Acad::ErrorStatus setSysVar(LPCTSTR varName, int val) { ASSERT(varName != NULL);
resbuf rb; rb.restype = RTSHORT; rb.resval.rint = val;
return(SdSysVarStack::setVar(varName, &rb)); }
/**************************************************************************** ** ** setSysVar (DOUBLE) ** ** **jma ** *************************************/
Acad::ErrorStatus setSysVar(LPCTSTR varName, double val) { ASSERT(varName != NULL);
resbuf rb; rb.restype = RTREAL; rb.resval.rreal = val;
return(SdSysVarStack::setVar(varName, &rb)); }
/**************************************************************************** ** ** setSysVar (STRING) ** ** **jma ** *************************************/
Acad::ErrorStatus setSysVar(LPCTSTR varName, const char* val) { ASSERT(varName != NULL);
resbuf rb; rb.restype = RTSTR; rb.resval.rstring = const_cast<char*>(val);
return(SdSysVarStack::setVar(varName, &rb)); }
/**************************************************************************** ** ** setSysVar (3D POINT) ** ** **jma ** *************************************/
Acad::ErrorStatus setSysVar(LPCTSTR varName, const AcGePoint3d& val) { ASSERT(varName != NULL);
resbuf rb; rb.restype = RT3DPOINT; copyAdsPt(rb.resval.rpoint, asDblArray(val));
return(SdSysVarStack::setVar(varName, &rb)); }
/**************************************************************************** ** ** setSysVar (2D POINT) ** ** **jma ** *************************************/
Acad::ErrorStatus setSysVar(LPCTSTR varName, const AcGePoint2d& val) { ASSERT(varName != NULL);
resbuf rb; rb.restype = RTPOINT; copyAdsPt(rb.resval.rpoint, asDblArray(val));
return(SdSysVarStack::setVar(varName, &rb)); }
|