| 这是一个如何导出在Bricscad V11白金中绘制的X-Solid的示例。由于每个固体都在Xdata中包含其ECS,因此重新排列在WCS中旋转的固体并获取范围是一项微不足道的任务:kewl: 图片、代码和附加的解决方案
 
 // get XData and create AcGeMatrix3d
    static Acad::ErrorStatus getMatrix(AcGeMatrix3d &xform, const resbuf *pRb)
    {
        assert(pRb);
        AcGePoint3dArray points;
        Acad::ErrorStatus es = Acad::eBadUCS;
        // iterate though the xdata and collect our points
        for(const resbuf *pRbTemp = pRb;pRbTemp != NULL;pRbTemp=pRbTemp->rbnext)
        {
            if(pRbTemp->restype == 1011 /*Xdata*/)
                points.append(asPnt3d(&pRbTemp->resval.rpoint[0]));
        }
        if(points.length() == 4)
        {
            // apply the points to a matrix
            xform.setCoordSystem(points[0],
                points[1]-points[0],
                points[2]-points[0],
                points[3]-points[0]);
            es = Acad::eOk;
        }
        return es;
    }
    // print the output 
    static Acad::ErrorStatus printExtents(const AcDb3dSolid *pSolid, std::ofstream &file)
    {
        assert(pRb);
        if(!pSolid)
            return Acad::eNullPtr;
        AcDbExtents extents;
        if(pSolid->getGeomExtents(extents) == Acad::eOk)
        {
            file pSolid(ids[idx],AcDb::kForRead);
                if(pSolid.openStatus()!=eOk)
                    continue;
                ResbufList xdata(pSolid->xData(_T("_X-Solids_")));
                if(getMatrix(xfrm,xdata) == Acad::eOk)
                {
                    std::auto_ptrpTmpSolid(AcDb3dSolid::cast(pSolid->clone()));
                    if(pTmpSolid.get())
                    {
                        if(pTmpSolid->transformBy(xfrm.invert()) ==  Acad::eOk)
                            printExtents(pTmpSolid.get(),file);
                    }
                }
            }
            acedRestoreStatusBar();
        }
        catch (...) 
        {
            acutPrintf(_T("Exception writing to file"));
        }
        file.flush();
        file.close();
    }
 evqmduimrz1.PNG   eknczmsugo2.PNG   obmu1p3qrbd.PNG   本帖以下内容被隐藏保护;需要你回复后,才能看到! 游客,如果您要查看本帖隐藏内容请回复 |