Arx编程对实体的基本操作

//
// ObjectARX defined commands, created by  [2010-9-30], ,
#include "StdAfx.h"
#include "StdArx.h"
#include "dbents.h"
#include "geassign.h"
#include "dbpl.h"
蒸馏水发生器
#define PI 3.141592653589793238462643383279502884197169399375105820974944592308
BOOL AddEntityToDBS(AcDbEntity *pEntity, AcDbObjectId &Id)
{
//获取块表
    AcDbBlockTable *pBlockTable = NULL;
    if (acdbHostApplicationServices()->workingDatabase()->getBlockTable(pBlockTable, AcDb::kForRead) != Acad::eOk)
    {
        return FALSE;
    }
    //获取模型空间的快表记录
    AcDbBlockTableRecord *pBlkTabRec = NULL;android游戏引擎
    if (pBlockTable->getAt(ACDB_MODEL_SPACE, pBlkTabRec, AcDb::kForWrite) != Acad::eOk)
    {
        pBlockTable->close();
        return FALSE;
    }
    pBlkTabRec->appendAcDbEntity(Id, pEntity);
    pEntity->close();
    pBlockTable->close();
    pBlkTabRec->close();
    return TRUE;
}
//-----------绘制直线-----------------------------------------------------
// This is command 'CLINE, by  [2010-9-30], ,
void EICADDrawCLine()
{
#ifdef OARXWIZDEBUG
    acutPrintf ("\nOARXWIZDEBUG - EICADDrawCLine() called.");
#endif // OARXWIZDEBUG
    // TODO: Implement the command
    ads_point pt0;
    ads_point pt;
    AcDbObjectId EntId;
    if (ads_getpoint(NULL, _T("\n请指定起始点:"), pt0) !=RTNORM) return;
    if (ads_getpoint(pt0, _T("\n请指定终点:"), pt) != RTNORM) return;
   
    AcDbLine *pLine = new AcDbLine(asPnt3d(pt0), asPnt3d(pt));
    AddEntityToDBS(pLine, EntId);
    pLine->close();   
}
//-----------编辑直线起点-----------------------------------------------------
// This is command 'EDITLSTARTPOINT, by  [2010-9-30], ,
void EICADDRAWEditlstartpoint()
{
#ifdef OARXWIZDEBUG
    acutPrintf ("\nOARXWIZDEBUG - EICADDRAWEditlstartpoint() called.");
#endif // OARXWIZDEBUG
    // TODO: Implement the command
    ads_point pt0;
    ads_point pt;
    ads_name Ent;
能源智能控制    AcDbObjectId EntId;
    AcDbLine *pLine = NULL;
三七的花怎样制成干茶
    if (ads_entsel(_T("\n请选择对象:"), Ent, pt0) != RTNORM) return;
    if (ads_getpoint(NULL, _T("\n请选择起点:"), pt) != RTNORM) return;
    if (acdbGetObjectId(EntId, Ent) != Acad::eOk) return;
    if (acdbOpenObject(pLine, EntId, AcDb::kForWrite) != Acad::eOk) return;
    pLine->setStartPoint(asPnt3d(pt));
    pLine->close();
}
//------------编辑直线终点------------------------------------------------------
// This is command 'EDITLENDPOINT, by  [2010-9-30], ,
void EICADDRAWeditlendpoint()
{
#ifdef OARXWIZDEBUG
    acutPrintf ("\nOARXWIZDEBUG - EICADDRAWeditlendpoint() called.");
#endif // OARXWIZDEBUG亿万像素
    // TODO: Implement the command
    ads_point pt0;
    ads_point pt;
    ads_name Ent;
    AcDbObjectId EntId;
    AcDbLine *pLine = NULL;
    if (ads_entsel(_T("\n请选择对象:"), Ent, pt0) != RTNORM) return;
    if (ads_getpoint(NULL, _T("\n请选择终点:"), pt) != RTNORM) return;
    if (acdbGetObjectId(EntId, Ent) != Acad::eOk) return;
    if (acdbOpenObject(pLine, EntId, AcDb::kForWrite) != Acad::eOk) return;
   
    pLine->setEndPoint(asPnt3d(pt));
    pLine->close();
}
//----------绘制多段线------------------------------------------------------
// This is command 'CPLINE, by  [2010-9-30], ,
void EICADDRAWCPLine()
{
#ifdef OARXWIZDEBUG
    acutPrintf ("\nOARXWIZDEBUG - EICADDRAWCPLine() called.");
#endif // OARXWIZDEBUG
   
    // TODO: Implement the command
    ads_point pt0 = {0.0};
    ads_point pt = {0.0};
    AcDbObjectId EntId;
    AcGePoint2d Gpt2d;
    AcDbPolyline *pPLine = new AcDbPolyline();
    if (ads_getpoint(NULL, _T("\n请指定起始点:"), pt0) != RTNORM) return;
    Gpt2d.set(pt0[X], pt0[Y]);   
    if (pPLine->addVertexAt(0, Gpt2d) != Acad::eOk)
    {
        delete pPLine;
        return;
    }
    AddEntityToDBS(pPLine, EntId);
    pPLine = NULL;
    while (ads_getpoint(pt0, _T("\n请指定下一个点:"), pt) == RTNORM)
    {
        Gpt2d.set(pt[X], pt[Y]);
        pt0[X] = pt[X];
        pt0[Y] = pt[Y];
        if (acdbOpenObject(pPLine, EntId, AcDb::kForWrite) != Acad::eOk) return;
        if (pPLine->addVertexAt(pPLine->numVerts(), Gpt2d) != Acad::eOk)
        {
编织袋颗粒            return;
        }
        pPLine->close();
    }   
    AddEntityToDBS(pPLine, EntId);
    pPLine->close();
}
//-------------绘制圆(用户输入圆心半径画圆)-----------------------------------------------------
// This is command 'CCIRCLE, by  [2010-9-30], ,
void EICADDrawCCircle()
{
#ifdef OARXWIZDEBUG
    acutPrintf ("\nOARXWIZDEBUG - EICADDrawCCircle() called.");
#endif // OARXWIZDEBUG
   
    // TODO: Implement the command
    ads_point pt;
    ads_real pr;
    AcDbObjectId EntId;
    if (ads_getpoint(NULL, _T("\n请指定圆心:"), pt) != RTNORM) return;
    if (ads_getreal(_T("\n请输入半径:"), &pr) != RTNORM) return;
    AcDbCircle *pCircle = new AcDbCircle(asPnt3d(pt), AcGeVector3d(0.0, 0.0, 1.0), pr);
    pCircle->setColorIndex(4);

本文发布于:2024-09-23 20:20:53,感谢您对本站的认可!

本文链接:https://www.17tex.com/tex/2/200306.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:输入   直线   圆心   半径   空间   模型   起点
留言与评论(共有 0 条评论)
   
验证码:
Copyright ©2019-2024 Comsenz Inc.Powered by © 易纺专利技术学习网 豫ICP备2022007602号 豫公网安备41160202000603 站长QQ:729038198 关于我们 投诉建议