天气与日历 切换到窄版

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

三点画弧ARX源代码

[复制链接]

该用户从未签到

主题

0

回帖

2912

积分

管理员

积分
2912
发表于 2024-6-22 09:46:18 | 显示全部楼层 |阅读模式
AcDbBlockTableRecord *GetModelSpace(AcDb::OpenMode Mode){
AcDbDatabase *pDwg = acdbHostApplicationServices()->workingDatabase();
AcDbBlockTable *pBlockTable;
AcDbBlockTableRecord *pModelSpace;
pDwg->getSymbolTable(pBlockTable, AcDb::kForRead);
pBlockTable->getAt(ACDB_MODEL_SPACE, pModelSpace, Mode);
pBlockTable->close();
return pModelSpace;
}
//功能:三点画弧
//编程:包达勇
//时间:20080812
AcDbObjectId CreateArc(ads_point pt1,ads_point pt2,ads_point pt3){
bool LongARC=FALSE;
AcDbCurve *pCur;
AcDbArc *pArc;
ads_point /*pt1,pt2,pt3,*/cpt,mp1,mp2,mp3,mp4;
ads_real GDist1,GDist2,Dist,Angle1,Angle2,Radius,StartAngle,EndAngle;
GDist1=GDist2=0;
AcGePoint3d Mid,Mp1,Mp2,Cpt;
AcGePoint3d Spt,Mpt,Ept;
Spt=asPnt3d(pt1);Mpt=asPnt3d(pt2);Ept=asPnt3d(pt3);
Mid=Mpt;
Dist=acutDistance(pt1,pt2);
Angle1=acutAngle(pt1,pt2);
Angle2=acutAngle(pt3,pt2);
acutPolar(pt1,Angle1,acutDistance(pt1,pt2)*0.5,mp1);
acutPolar(pt3,Angle2,acutDistance(pt3,pt2)*0.5,mp2);
acutPolar(mp1,Angle1+(pi*0.5),Dist,mp3);
acutPolar(mp2,Angle2+(pi*0.5),Dist,mp4);
acdbInters(mp1,mp3,mp2,mp4,FALSE,cpt);
Cpt=asPnt3d(cpt);
Radius=acutDistance(cpt,pt2);
StartAngle=acutAngle(cpt,pt1);
EndAngle=acutAngle(cpt,pt3);
AcDbObjectId ObjID,ObjID1,ObjID2;
AcDbBlockTableRecord *pModelSpace =GetModelSpace(AcDb::kForWrite);
AcDbArc *Narc1=new AcDbArc(Cpt,Radius,StartAngle,EndAngle);
AcDbArc *Narc2=new AcDbArc(Cpt,Radius,EndAngle,StartAngle);
pModelSpace->appendAcDbEntity(ObjID1,Narc1);
pModelSpace->appendAcDbEntity(ObjID2,Narc2);
Narc1->close();
Narc2->close();
pModelSpace->close();
acdbOpenObject(pCur,ObjID1,AcDb::kForRead);
pCur->getDistAtPoint(Mid,GDist1);
pCur->close();
acdbOpenObject(pCur,ObjID2,AcDb::kForRead);
pCur->getDistAtPoint(Mid,GDist2);
pCur->close();
if (GDist1>GDist2) {
  EraseEntity(ObjID2);
  ObjID=ObjID1;
}else{
  EraseEntity(ObjID1);
  ObjID=ObjID2;
}
return ObjID;
}

 

 

 

 

三点画弧ARX源代码
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

GMT+8, 2024-11-1 11:32 , Processed in 0.120144 second(s), 26 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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