Esempio n. 1
0
Acad::ErrorStatus
AcRectJig::setPlane()
{
    // Acquire current UCS transformation matrix.
    // We save the matrix for later use.
    //
    acdbUcsMatrix(mUcsToWcsMat);
    mWcsToUcsMat = mUcsToWcsMat.inverse();

    // Get data from user coordinate system.
    //
    AcGePoint3d orgPt;
    AcGeVector3d xAxis, yAxis, zAxis;
    mUcsToWcsMat.getCoordSystem(orgPt, xAxis, yAxis, zAxis);

    // Get the current elevation w.r.t current UCS, w.r.t the current space.
    //
    struct resbuf rb;
    ads_getvar(/*MSG0*/"CVPORT", &rb);
    double elev;
    if (rb.resval.rint == 1)
        elev = mpDb->pelevation();  // Paper space
    else
        elev = mpDb->elevation();   // Model space

    // Convert elevation from UCS to WCS.
    //
    orgPt += elev * zAxis;
    mElevation = zAxis.dotProduct(orgPt.asVector());
    mNormal = zAxis;
    mHorizDir = xAxis;
    mVertDir = mNormal.crossProduct(mHorizDir);
    return Acad::eOk;
}
Esempio n. 2
0
int ads_perror()
{
    struct resbuf *argl, errval;

    argl = ads_getargs();
    if (ads_getfuncode() != 0)      /* This is the ONLY function here */
        return RSRSLT;
    if (ads_getvar("ERRNO", &errval) == RTERROR)
        return RSRSLT;
    if ((errval.resval.rint < 1) || (errval.resval.rint > ELEMENTS(errmsg)
#ifdef MAX_OL_ERRNO
		|| errval.resval.rint > MAX_OL_ERRNO
#endif
		))
        return RSRSLT;
    if (argl && argl->restype == RTSTR && strlen(argl->resval.rstring))
        ads_printf("%s: ", argl->resval.rstring);
    ads_printf("%s\n", errmsg[errval.resval.rint - 1]);
    ads_relrb(argl);
    ads_retvoid();
    return RSRSLT;
}