• 使用画圆的方法来标注指定Id的实体


    //entId为指定实体的Id

    void SignEnt(AcDbObjectId entId)
    {
    AcDbEntity *pEnt = NULL;
    AcDbBlockReference *pRef;
    //打开对应实体
    Acad::ErrorStatus es = acdbOpenObject(pEnt, entId, ZcDb::kForRead, false);
    if ( Acad::eOk != es )
    {
    acutPrintf(_T(" 打开对应Id的实体失败!"));
    return ;
    }
    if(pEnt->isKindOf(AcDbBlockReference::desc()))
    {
    //将实体转化为块参照
    pRef = AcDbBlockReference::cast(pEnt);

    //获得块参照的外框
    AcDbExtents exts;
    pRef->getGeomExtents(exts);

    AcGePoint3d ptMin = exts.minPoint();//外框最小点
    AcGePoint3d ptMax = exts.maxPoint();//外框最大点

    //获取块参照的外框中心点, MidPoint函数为自己编写,即求两点之间的中心点
    AcGePoint3d ptCenter = MidPoint(ptMin, ptMax);
    pRef->close();

    //获得两点连线的一半长度,HalfLength函数为自己编写,即求两点连线的长度的一半
    double radius = HalfLength(ptMin, ptMax);

    //以插入点为圆心画圆,标记重复的编号
    AcGeVector3d vec(0, 0, 1);

    //创建实体圆
    AcDbCircle *pCircle = new AcDbCircle(ptCenter, vec, radius);


    //将圆添加到模型空间,PostToModelSpace函数为自己编写的,作用是向模型空间中添加实体
    PostToModelSpace(pCircle);
    }

  • 相关阅读:
    回溯算法
    cannot import name 'np' in mxnet
    Linux后台运行任务 nohup &
    为Windows Terminal添加右键菜单
    Outlook设置QQ邮箱
    逻辑回归 logistic regression
    Python添加自定义目录到sys.path
    强化学习 策略梯度
    为Windows terminal preview添加右键菜单
    双系统使用Linux引导
  • 原文地址:https://www.cnblogs.com/pengjun-shanghai/p/4786341.html
Copyright © 2020-2023  润新知