没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
ObjectArx的一次常用方法 https://www.cnblogs.com/luzhiw/p/4043723.html
1.画一条直线
static void ArxProject1_DrawLine(void)
{
//定义两点确定一条直线
AcGePoint3d ptStart( 0 , 0 , 0);
AcGePoint3d ptEnd( 100 , 100 , 0);
AcDbLine* lnNew = new AcDbLine( ptStart , ptEnd);
//获取当前图形数据库
AcDbBlockTable* pBlockTable = NULL;
acdbHostApplicationServices()->workingDatabase()->getBlockTable(pBlockTable , AcDb::kForWrite);
AcDbBlockTableRecord* pBlockTableRecord = NULL;
pBlockTable->getAt(ACDB_MODEL_SPACE , pBlockTableRecord , AcDb::kForWrite);
//插入当前的图形数据库
AcDbObjectId lnId;
pBlockTableRecord->appendAcDbEntity( lnId , lnNew);
//关闭对象
lnNew->close();
pBlockTableRecord->close();
pBlockTable->close();
1.画一条直线
static void ArxProject1_DrawLine(void)
{
//定义两点确定一条直线
AcGePoint3d ptStart( 0 , 0 , 0);
AcGePoint3d ptEnd( 100 , 100 , 0);
AcDbLine* lnNew = new AcDbLine( ptStart , ptEnd);
//获取当前图形数据库
AcDbBlockTable* pBlockTable = NULL;
acdbHostApplicationServices()->workingDatabase()->getBlockTable(pBlockTable , AcDb::kForWrite);
AcDbBlockTableRecord* pBlockTableRecord = NULL;
pBlockTable->getAt(ACDB_MODEL_SPACE , pBlockTableRecord , AcDb::kForWrite);
//插入当前的图形数据库
AcDbObjectId lnId;
pBlockTableRecord->appendAcDbEntity( lnId , lnNew);
//关闭对象
lnNew->close();
pBlockTableRecord->close();
pBlockTable->close();
}
2.画一段圆弧
static void ArxProject1_DrawArc(void)
{
//三点创建一个圆弧
AcGePoint2d ptStartPoint( 0 , 100 );
AcGePoint2d ptEndPoint( 0 , 100 );
AcGePoint2d ptCenterPoint(0 , 0);
AcGeVector2d vecStart(ptStartPoint.x - ptCenterPoint.x , ptStartPoint.y - ptCenterPoint.y);
AcGeVector2d vecEnd(ptEndPoint.x - ptCenterPoint.x , ptEndPoint.y - ptCenterPoint.y);
double StartAng = vecStart.angle();
double EndAng = vecEnd.angle();
AcGePoint3d pt( 0 , 0, 0);
AcGeVector3d vec( 0 , 0 ,1);
AcDbArc* Acr = NULL;
Acr = new AcDbArc(pt ,vec , 100, StartAng , EndAng);
AcDbBlockTable* pBlockTable = NULL;
ErrorStatus es = acdbHostApplicationServices()->workingDatabase()->getBlockTable(pBlockTable , AcDb::kForWrite);
AcDbBlockTableRecord* pBlockTableRecord = NULL;
es = pBlockTable->getAt(ACDB_MODEL_SPACE , pBlockTableRecord, AcDb::kForWrite);
AcDbObjectId oid;
es = pBlockTableRecord->appendAcDbEntity(oid , Acr);
2.画一段圆弧
static void ArxProject1_DrawArc(void)
{
//三点创建一个圆弧
AcGePoint2d ptStartPoint( 0 , 100 );
AcGePoint2d ptEndPoint( 0 , 100 );
AcGePoint2d ptCenterPoint(0 , 0);
AcGeVector2d vecStart(ptStartPoint.x - ptCenterPoint.x , ptStartPoint.y - ptCenterPoint.y);
AcGeVector2d vecEnd(ptEndPoint.x - ptCenterPoint.x , ptEndPoint.y - ptCenterPoint.y);
double StartAng = vecStart.angle();
double EndAng = vecEnd.angle();
AcGePoint3d pt( 0 , 0, 0);
AcGeVector3d vec( 0 , 0 ,1);
AcDbArc* Acr = NULL;
Acr = new AcDbArc(pt ,vec , 100, StartAng , EndAng);
AcDbBlockTable* pBlockTable = NULL;
ErrorStatus es = acdbHostApplicationServices()->workingDatabase()->getBlockTable(pBlockTable , AcDb::kForWrite);
AcDbBlockTableRecord* pBlockTableRecord = NULL;
es = pBlockTable->getAt(ACDB_MODEL_SPACE , pBlockTableRecord, AcDb::kForWrite);
AcDbObjectId oid;
es = pBlockTableRecord->appendAcDbEntity(oid , Acr);
剩余12页未读,继续阅读
资源评论
qw1355188058
- 粉丝: 1
- 资源: 4
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功