天气与日历 切换到窄版

 找回密码
 立即注册
中国膜结构网
十大进口膜材评选 十大国产膜材评选 十大膜结构设计评选 十大膜结构公司评选
查看: 6|回复: 0

圆柱体

[复制链接]
  • TA的每日心情
    开心
    昨天 15:23
  • 签到天数: 69 天

    [LV.6]常住居民II

    410

    主题

    167

    回帖

    2704

    积分

    管理员

    积分
    2704
    发表于 2024-6-22 09:46:18 | 显示全部楼层 |阅读模式
    // Add an entity to the current database.
    Acad::ErrorStatus postToDb(AcDbEntity* pEnt)
    {
            Acad::ErrorStatus      es, es2;
            AcDbBlockTable*        pBlockTable = 0;
            AcDbBlockTableRecord*  pSpaceRecord = 0;

            if (!pEnt)
                    return Acad::eNullEntityPointer;

            AcDbDatabase *pDb = acdbHostApplicationServices()->workingDatabase();
            if ((es = pDb->getBlockTable(pBlockTable, AcDb::kForRead)) != Acad::eOk)
                    return es;

            if ((es = pBlockTable->getAt(ACDB_MODEL_SPACE, pSpaceRecord, AcDb::kForWrite)) == Acad::eOk)
            {
                    AcDbObjectId objId;
                    es = pSpaceRecord->appendAcDbEntity(objId, pEnt);
                    es2 = pSpaceRecord->close();

                    if (es == Acad::eOk)
                    {
                            es2 = pEnt->downgradeOpen();
                            es2 = pEnt->draw();
                            pEnt->close();
                    }
            }
            es2 = pBlockTable->close();

            return es;
    }

    void CreateCylinder()
    {
            double diameter=50.0;
            AcGePoint3d p1(0,0,0), p2(0,0,100);

            AcGeVector3d v12(p2-p1);
            AcGePoint3d ptMid = p1 + v12/2;

            Acad::ErrorStatus es;
            AcDb3dSolid *cylinder = new AcDb3dSolid();
            cylinder->setDatabaseDefaults(); // set current color, layer and linetype

            double height = v12.length(), radius= diameter/2;
            es = cylinder->createFrustum(height, radius, radius, radius);

            // createFrustum() creates a cylinder with midpoint at 0,0,0 and rotation axis=Z
            // So we have to align the cylinder:
            AcGeVector3d vx, vy, vz(v12 / height);
            vx = vz.perpVector();
            vy = vz.crossProduct(vx);

            AcGeMatrix3d mat;
            mat.setCoordSystem(ptMid, vx, vy, vz);
            es = cylinder->transformBy(mat);
            es = postToDb(cylinder);
    }

     

     

     

     

    圆柱体
    中国膜结构网打造全中国最好的膜结构综合平台 ,统一协调膜结构设计,膜结构施工,膜材采购,膜材定制,膜结构预算全方位服务。 中国空间膜结构协会合作单位。
    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    QQ|Archiver|手机版|中国膜结构网|中国膜结构协会|进口膜材|国产膜材|ETFE|PVDF|PTFE|设计|施工|安装|车棚|看台|污水池|

    GMT+8, 2024-7-1 05:52 , Processed in 0.056221 second(s), 22 queries .

    Powered by Discuz! X3.5

    © 2001-2024 Discuz! Team.

    快速回复 返回顶部 返回列表