合并各种情况的圆弧
static void zffObjectARX_MyCommand18(void)
{
ads_name ss;
acedSSGet(NULL,NULL,NULL,NULL,ss);
long len;
acedSSLength(ss,&len);
double startAng,endAng;
double radius;
AcGePoint3d center;
for (int i=0;i<len;)
{
AcDbArc* pArc=NULL;
AcDbObjectId entId;
ads_name name,name1;
acedSSName(ss,i,name);
acdbGetObjectId(entId,name);
acdbOpenObject(pArc,entId,AcDb::kForWrite);
double arcStartAng=pArc->startAngle();
double arcEndAng=pArc->endAngle();
if (arcEndAng==0)
{
arcEndAng+=2*pi();
}
AcGePoint3d arcCenter=pArc->center();
double arcRadius=pArc->radius();
radius=arcRadius;
center=arcCenter;
startAng=arcStartAng;
endAng=arcEndAng;
for (int j=i+1;j<len;)
{
AcDbArc* pArc1=NULL;
acedSSName(ss,j,name1);
acdbGetObjectId(entId,name1);
acdbOpenObject(pArc1,entId,AcDb::kForWrite);
double arc1StartAng=pArc1->startAngle();
double arc1EndAng=pArc1->endAngle();
if (arc1EndAng==0)
{
arc1EndAng+=2*pi();
}
AcGePoint3d arc1Center=pArc1->center();
double arc1Radius=pArc1->radius();
if (arcCenter==arc1Center && arcRadius==arc1Radius)
{
if (arc1StartAng<startAng)
{
startAng=arc1StartAng;
}
if (arc1EndAng>endAng)
{
endAng=arc1EndAng;
}
acedSSDel(name1,ss);
pArc1->erase();
acedSSLength(ss,&len);
}
else
{
j++;
}
pArc1->close();
}
acedSSDel(name,ss);
pArc->erase();
pArc->close();
acedSSLength(ss,&len);
AcDbArc* pArcRe=new AcDbArc(center,radius,startAng,endAng);
AddToModelSpace(pArcRe);
}
}
更多文章
-
用AcedGrRead()函数实现一拖多
实现代码:#include "StdAfx.h"#include "StdArx.h"#include "..\..\Common\我的类\Arc.h"#include <acedads.h>#include "..\..\Common\Entity\LineUtil.h"#include <geassign.h>#include <dbents.h>#include "..\..\Common\Others\ConvertUtil.h"#in
-
改变多段线区直
代码:#include "StdAfx.h"#include "StdArx.h"#include <dbpl.h>#include "..\..\Common\Others\ConvertUtil.h"#include <geassign.h>#include "..\..\Common\Entity\ArcUtil.h"#include "..\..\Common\Document\DwgDatabaseUtil.h"#include <afxwin.h&
-
获取任意路径Dwg文件内所有块在控件中显示并能选择插入当前模型空间
主对话框CPP内代码:#include "StdAfx.h"#include "resource.h"#include "BlockDialog.h"#include "..\..\Common\我的类\file.h"#include "..\..\Common\Document\DwgDatabaseUtil.h"#include <dbents.h>#include <dbmain.h>#include "..\..\Chapter11
-
多段线动态切割闭合区域
#include "StdAfx.h"#include "StdArx.h"#include <dbpl.h>#include "..\..\Common\Others\ConvertUtil.h"#include "..\..\Common\Document\DwgDatabaseUtil.h"#include <dbents.h>#include <dbregion.h>#include "..\..\Common\Entity\RegionUtil.h"
-
自创实体类从AcDbCurve派生,实现一些类方法并动态绘制
MyCurve.cpp:#include "StdAfx.h"#include "MyCurve.h"#include "actrans.h"#include "aced.h"//-----------------------------------------------------------------------------Adesk::UInt32 CMyCurve::kCurrentVersionNumber =1 ;//----------------------------------------