天气与日历 切换到窄版

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

Intersection of 2 Hatch

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

    [LV.6]常住居民II

    410

    主题

    167

    回帖

    2704

    积分

    管理员

    积分
    2704
    发表于 2024-6-22 09:46:18 | 显示全部楼层 |阅读模式
    The only way I have found is obtainig the loops and intersecting them (Thanks Ing. B.C.). This is my code snippet. It only works when the number of Loops are equal and loops are built from lines. This is enough for me. I dont know if there is a simply way to do the same. Any suggestions? bool IntersectionOf2Hatch(AcDbHatch *pHatch1, AcDbHatch *pHatch2) { /* Return: true: Found an intersection false: no intersections */ int loops1 = pHatch1->numLoops(); int loops2 = pHatch2->numLoops(); AcDbObjectIdArray loopIds1; AcDbObjectIdArray loopIds2; for (int i = 0; i < loops1; ++i) { long loopType1; AcGeVoidPointerArray edgePtrs1; AcGeIntArray edgeTypes1; long loopType2; AcGeVoidPointerArray edgePtrs2; AcGeIntArray edgeTypes2; AcDb3dPolyline *pPol1 = NULL; AcDb3dPolyline *pPol2 = NULL; if (pHatch1->getLoopAt(i, loopType1, edgePtrs1, edgeTypes1) == Acad::eOk) { for (int j = 0; j < edgePtrs1.length(); j++) { AcGePoint3d point1; switch (edgeTypes1){ case AcDbHatch::kLine: { AcGeLineSeg3d *pGeLine3d = (AcGeLineSeg3d*)edgePtrs1; point1 = pGeLine3d->startPoint(); AcDb3dPolylineVertex *pVertex = new AcDb3dPolylineVertex(point1); if (pPol1 == NULL) pPol1 = new AcDb3dPolyline(); pPol1->appendVertex(pVertex); } break; case AcDbHatch::kCirArc: case AcDbHatch::kEllArc: case AcDbHatch::kSpline: default: break; } } if (pPol1 != NULL) pPol1->makeClosed(); } if (pHatch2->getLoopAt(i, loopType2, edgePtrs2, edgeTypes2) == Acad::eOk) { for (int k = 0; k < edgePtrs2.length(); k++) { AcGePoint3d point2; switch (edgeTypes2){ case AcDbHatch::kLine: { AcGeLineSeg3d *pGeLine3d = (AcGeLineSeg3d*)edgePtrs2; point2 = pGeLine3d->startPoint(); AcDb3dPolylineVertex *pVertex = new AcDb3dPolylineVertex(point2); if (pPol2 == NULL) pPol2 = new AcDb3dPolyline(); pPol2->appendVertex(pVertex); } break; case AcDbHatch::kCirArc: case AcDbHatch::kEllArc: case AcDbHatch::kSpline: default: break; } } if (pPol2 != NULL) pPol2->makeClosed(); } if (pPol1 != NULL && pPol2 != NULL) { AcGePoint3dArray points; if (pPol1->intersectWith(pPol2, AcDb::kOnBothOperands, points) == Acad::eOk) { if (points.length() > 0) { delete pPol1; delete pPol2; return true; } } } if (pPol1 != NULL) delete pPol1; if (pPol2 != NULL) delete pPol2; } return false; } "developer" escribió en el mensaje news:41ff7ef0$1_1@newsprd01... > Hello, > Is there a way to know if one hatch intersects with another hatch? > Thanks in advance, > Helio. > >

     

     

     

     

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

    本版积分规则

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

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

    Powered by Discuz! X3.5

    © 2001-2024 Discuz! Team.

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