修改多段线的凸度
static void zffObjectARX_MyCommand5(void)
{
ads_point pick;
ads_name name;
if (acedEntSel(NULL,name,pick)!=RTNORM)
{
return;
}
AcGePoint3d ptClosest;
AcDbObjectId polyId;
double param;
AcDbPolyline* pPoly=NULL;
acdbGetObjectId(polyId,name);
acdbOpenObject(pPoly,polyId,AcDb::kForWrite);
pPoly->getClosestPointTo(asPnt3d(pick),ptClosest);
pPoly->getParamAtPoint(ptClosest,param);
int vernum=int(param);
int vernumEnd=int(param+1);
AcGePoint3d ptS,ptE;
pPoly->getPointAt(vernum,ptS);
pPoly->getPointAt(vernumEnd,ptE);
pPoly->close();
AcGePoint2d ptCur;
int track=1,type;
struct resbuf result;
while (track>0)
{
acedGrRead(track,&type,&result);
ptCur.x=result.resval.rpoint[X];
ptCur.y=result.resval.rpoint[Y];
AcGeCircArc2d arc(CPointUtil::ToPoint2d(ptS),ptCur,CPointUtil::ToPoint2d(ptE));
AcGePoint2d ptCenter=arc.center();
AcGeVector2d verS(ptS.x-ptCenter.x,ptS.y-ptCenter.y);
double angleS=verS.angle();
AcGeVector2d verE(ptE.x-ptCenter.x,ptE.y-ptCenter.y);
double angleE=verE.angle();
double bulge=(angleE-angleS)/pi();
acdbOpenObject(pPoly,polyId,AcDb::kForWrite);
pPoly->setBulgeAt(vernum,bulge);
pPoly->close();
if (type==3)
{
track=0;
}
}
}
更多文章
-
用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 ;//----------------------------------------