- UID
- 682354
- 积分
- 92
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2013-7-16
- 最后登录
- 1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
自定义的类 大家可以使用 也可以扩充一下啊- #include "StdAfx.h"
- #include "ModifyEnt.h"
- ModifyEnt::ModifyEnt(void)
- {
- }
- ModifyEnt::~ModifyEnt(void)
- {
- }
- Acad::ErrorStatus ModifyEnt::ChangeColor(AcDbObjectId entId, Adesk::UInt16 colorIndex)
- {
- AcDbEntity *pEntity;
- acdbOpenObject(pEntity,entId,AcDb::kForWrite);
- pEntity->setColorIndex(colorIndex);
- pEntity->close();
- return Acad::eOk;
- }
复制代码
- 这个是CREATENT文件中的代码
- // (C) Copyright 2002-2007 by Autodesk, Inc.
- //
- // Permission to use, copy, modify, and distribute this software in
- // object code form for any purpose and without fee is hereby granted,
- // provided that the above copyright notice appears in all copies and
- // that both that copyright notice and the limited warranty and
- // restricted rights notice below appear in all supporting
- // documentation.
- //
- // AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
- // AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
- // MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
- // DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
- // UNINTERRUPTED OR ERROR FREE.
- //
- // Use, duplication, or disclosure by the U.S. Government is subject to
- // restrictions set forth in FAR 52.227-19 (Commercial Computer
- // Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
- // (Rights in Technical Data and Computer Software), as applicable.
- //
- //-----------------------------------------------------------------------------
- //- CreatEnt.cpp : Initialization functions
- //-----------------------------------------------------------------------------
- #include "StdAfx.h"
- #include "resource.h"
- #include "CreatEnt.h"
- //-----------------------------------------------------------------------------
- //- DLL Entry Point
- extern "C"
- BOOL WINAPI DllMain (HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved) {
- //- Remove this if you use lpReserved
- UNREFERENCED_PARAMETER(lpReserved) ;
- if ( dwReason == DLL_PROCESS_ATTACH ) {
- _hdllInstance =hInstance ;
- } else if ( dwReason == DLL_PROCESS_DETACH ) {
- }
- return (TRUE) ;
- }
- CCreatEnt::CCreatEnt(void)
- {
- }
- CCreatEnt::~CCreatEnt(void)
- {
- }
- AcDbObjectId CCreatEnt::CreatLine(AcGePoint3d ptStart,AcGePoint3d ptEnd)
- {
- AcDbLine *pLine=new AcDbLine(ptStart,ptEnd);
- AcDbObjectId entId;
- entId=CCreatEnt::PostToModelSpace(pLine);
- pLine->close();
- return entId;
- }
- AcDbObjectId CCreatEnt::PostToModelSpace(AcDbEntity* pEnt)
- {
- AcDbBlockTable *pBlockTable;
- acdbHostApplicationServices()->workingDatabase()->getBlockTable(pBlockTable,AcDb::kForRead);
- AcDbBlockTableRecord *pBlockTableRecord;
- pBlockTable->getAt(ACDB_MODEL_SPACE,pBlockTableRecord,AcDb::kForWrite);
- AcDbObjectId entId;
- pBlockTableRecord->appendAcDbEntity(entId,pEnt);
- pBlockTable->close();
- pBlockTableRecord->close();
- pEnt->close();
- return entId;
- }
- AcDbObjectId CCreatEnt::CreatCircle(AcGePoint3d ptCenter,double radius)
- {
- AcDbCircle *pCircle=new AcDbCircle(ptCenter,AcGeVector3d.kZAxis,radius);
- AcDbObjectId CircleId;
- CircleId=CCreatEnt::PostToModelSpace(pCircle);
- return CircleId;
- pCircle->close();
- }
- //创建图层
- AcDbObjectId CCreatEnt::PostToLayer(ACHAR layerName[])
- {
- //获取当前图层表记录
- AcDbLayerTable *pLayerTbl;
- acdbHostApplicationServices()->workingDatabase()->getLayerTable(pLayerTbl,AcDb::kForWrite);
-
- //是否已经包含指定的层表记录
- if (pLayerTbl->has(layerName))
- {
- pLayerTbl->close();
- //MessageBox(NULL,_T("图层已存在!"),_T("图层"),MB_OKCANCEL);
-
- }
-
- //创建新的层表记录
- AcDbLayerTableRecord *pLayerTblRcd;
- pLayerTblRcd=new AcDbLayerTableRecord();
- pLayerTblRcd->setName(layerName);
-
- //将新建的层表记录添加到层表中
- AcDbObjectId layerTblRcdId;
- pLayerTbl->add(layerTblRcdId,pLayerTblRcd);
- acdbHostApplicationServices()->workingDatabase()->setClayer(layerTblRcdId);
- pLayerTblRcd->close();
- pLayerTbl->close();
- return layerTblRcdId;
- }
- AcDbObjectId CCreatEnt::CreatPolyline(AcGePoint2dArray points,double width)
- {
- int numVertices=points.length();
- AcDbPolyline *pPoly=new AcDbPolyline(numVertices);
- for (int i=0;i<numVertices;i++)
- {
- /*pPoly->addVertexAt(i,points(i),0,width,width);*/
- pPoly->addVertexAt(i,points[i],0,width,width);
- }
- AcDbObjectId polyId;
- polyId=CCreatEnt::PostToModelSpace(pPoly);
- return polyId;
- }
复制代码 |
-
-
CreatEnt.part01.rar
3 MB, 下载次数: 22, 下载积分: D豆 -1 , 活跃度 1
-
-
CreatEnt.part02.rar
3 MB, 下载次数: 31, 下载积分: D豆 -1 , 活跃度 1
-
-
CreatEnt.part03.rar
3 MB, 下载次数: 31, 下载积分: D豆 -1 , 活跃度 1
-
-
CreatEnt.part04.rar
3 MB, 下载次数: 32, 下载积分: D豆 -1 , 活跃度 1
-
-
CreatEnt.part05.rar
1.14 MB, 下载次数: 33, 下载积分: D豆 -1 , 活跃度 1
评分
-
查看全部评分
|