- UID
- 215174
- 积分
- 286
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2005-1-29
- 最后登录
- 1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
- [FONT=courier new]
- BOOL BreakLine(IN AcGePoint3d pt1,IN AcGePoint3d pt2,
- IN AcDbObjectId curveId,
- OUT AcDbObjectId& curId1,
- OUT AcDbObjectId& curId2)
- {
- AcDbObjectPointer<AcDbCurve> spCurve(curveId,AcDb::kForRead);
- if(spCurve.openStatus() != Acad::eOk)
- return FALSE;
- AcGePoint3dArray breakPts;
- if(pt1.distanceTo(pt2) <= 0.001)
- {
- breakPts.append(pt1);
- }
- else
- {
- breakPts.append(pt1);
- breakPts.append(pt2);
- }
- AcDbVoidPtrArray curveSegments;
- COLOR=red]spCurve->getSplitCurves(breakPts,curveSegments);//有是这里会报错,是何原因[/COLOR] if(curveSegments.length() <= 2)
- {
- for(int i = 0; i < curveSegments.length();i++)
- {
- AcDbCurve *pNewCurve = static_cast<AcDbCurve*>(curveSegments[i]);
- ArxDbgUtils::addToCurrentSpace(pNewCurve);
- if(i == 0)
- {
- curId1 = pNewCurve->objectId();
- }
- else if(i == 1)
- {
- curId2 = pNewCurve->objectId();
- }
- pNewCurve->close();
- }
- }
- else if(curveSegments.length() >= 3)
- {
- for(int i = 0; i < curveSegments.length();i++)
- {
- if(i % 2 == 1)
- {
- AcDbCurve *pNewCurve = static_cast<AcDbCurve*>(curveSegments[i]);
- delete pNewCurve;
- }
- else
- {
- AcDbCurve *pNewCurve = static_cast<AcDbCurve*>(curveSegments[i]);
- ArxDbgUtils::addToCurrentSpace(pNewCurve);
- if(i == 0)
- {
- curId1 = pNewCurve->objectId();
- }
- else if(i == 2)
- {
- curId2 = pNewCurve->objectId();
- }
- pNewCurve->close();
- }
- }
- }
- spCurve->upgradeOpen();
- spCurve->erase();
- return (curId1.isValid() && curId2.isValid());
- }
- [/FONT]
复制代码 |
|