天气与日历 切换到窄版

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

[每日一码] XCLIP xrefs using ObjectARX

[复制链接]
  • TA的每日心情
    开心
    半小时前
  • 签到天数: 20 天

    [LV.4]偶尔看看III

    115

    主题

    11

    回帖

    1393

    积分

    管理员

    积分
    1393
    QQ
    发表于 2024-3-14 20:52:30 | 显示全部楼层 |阅读模式
    1. static void MyTestApp采用MyClip()
    2. {
    3.     ads采用point pt1,pt2;
    4.     ads采用name ent;
    5.     if (acedEntSel(采用T("Select xref:"),ent,pt1)!=RTNORM)
    6.         return;
    7.     AcDbObjectId idXref;
    8.     if (acdbGetObjectId(idXref,ent)!=Acad::eOk)
    9.         return;
    10.     AcDbObjectPointer<AcDbBlockReference> pRef(idXref,AcDb::kForRead);
    11.     if (pRef.openStatus()!=Acad::eOk)
    12.     {
    13.         acutPrintf(采用T("Not an xref!\n"));
    14.         return;
    15.     }
    16.     AcGePoint2dArray pts;
    17.     if (acedGetPoint(NULL,采用T("First point:"),pt1)!=RTNORM)
    18.         return;
    19.     //the ECS of the vertices must be defined in the
    20.     //coordinate system of the 采用block采用 so let's calculate
    21.     //transform all points to that coordinate system
    22.     AcGeMatrix3d mat(pRef->blockTransform());
    23.     mat.invert();
    24.     AcGePoint3d pt3d(asPnt3d(pt1));
    25.     pt3d.transformBy(mat);
    26.     pts.append(AcGePoint2d(pt3d.x,pt3d.y));
    27.     while (acedGetPoint(pt1,采用T("Next point:"),pt2)==RTNORM)
    28.     {
    29.         acedGrDraw(pt1,pt2,1,1);
    30.         pt3d = asPnt3d(pt2);
    31.         pt3d.transformBy(mat);
    32.         pts.append(AcGePoint2d(pt3d.x,pt3d.y));
    33.         memcpy(pt1,pt2,sizeof(ads采用point));
    34.     }
    35.     acedRedraw(NULL,0);
    36.     AcDbDatabase* pDb = acdbHostApplicationServices()->workingDatabase();
    37.     AcGeVector3d normal;
    38.     double elev;
    39.     if (pDb->tilemode())
    40.     {
    41.         normal = pDb->ucsxdir().crossProduct(pDb->ucsydir());
    42.         elev = pDb->elevation();
    43.     }
    44.     else
    45.     {
    46.         normal = pDb->pucsxdir().crossProduct(pDb->pucsydir());
    47.         elev = pDb->pelevation();
    48.     }
    49.     normal.normalize();
    50.     Acad::ErrorStatus es = pRef.object()->upgradeOpen();
    51.     if (es !=Acad::eOk)
    52.         return;
    53.     //create the filter
    54.     AcDbSpatialFilter* pFilter = new AcDbSpatialFilter;
    55.     if (pFilter->setDefinition(pts,normal,elev,
    56.         ACDB采用INFINITE采用XCLIP采用DEPTH,-ACDB采用INFINITE采用XCLIP采用DEPTH,true)!=Acad::eOk)
    57.     {
    58.         delete pFilter;
    59.         return;
    60.     }
    61.     //add it to the extension dictionary of the block reference
    62.     //the AcDbIndexFilterManger class provides convenient utility functions
    63.     if (AcDbIndexFilterManager::addFilter(pRef.object(),pFilter)!=Acad::eOk)
    64.         delete pFilter;
    65.     else
    66.     {
    67.         acutPrintf(采用T("Filter has been succesfully added!\n"));
    68.         pFilter->close();
    69.     }
    70. }
    复制代码

     

     

     

     

    [每日一码] XCLIP xrefs using ObjectARX
    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

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

    GMT+8, 2024-11-5 06:07 , Processed in 0.133988 second(s), 26 queries .

    Powered by Discuz! X3.5

    © 2001-2024 Discuz! Team.

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