|
[code]在下文中一共展示了AcDbBlockTableRecord::appendAcDbEntity方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: Draw_Rectangle
▲ 点赞 7 ▼
AcDbObjectId Additional_Class::Draw_Rectangle( AcGePoint2d stPt, double length, double height )
{
AcDbPolyline *pPolyline = new AcDbPolyline(4);
AcGePoint2d stPt1, stPt2, stPt3, stPt4;
stPt1 = stPt;
pPolyline->addVertexAt(0, stPt1, 0, 0, 0);
stPt2.x = stPt.x +length;
stPt2.y = stPt.y;
pPolyline->addVertexAt(1, stPt2, 0, 0, 0);
stPt3.x = stPt2.x;
stPt3.y = stPt2.y + height;
pPolyline->addVertexAt(2, stPt3, 0, 0, 0);
stPt4.x = stPt3.x - length;
stPt4.y = stPt3.y;
pPolyline->addVertexAt(3, stPt4, 0, 0, 0);
pPolyline->setClosed(Adesk::kTrue);
AcDbBlockTable *pBlockTable = NULL;
acdbHostApplicationServices()->workingDatabase()->getBlockTable(pBlockTable, AcDb::kForRead);
//this->Open_BlockTable(pBlockTable, NREADMODE);
AcDbBlockTableRecord *pBlockTableRecord = NULL;
pBlockTable->getAt(ACDB_MODEL_SPACE, pBlockTableRecord, AcDb::kForWrite);
//acdbHostApplicationServices()->workingDatabase()->getBlockTable(pBlockTable, AcDb::kForRead);
//this->Open_ModelTableRecord(pBlockTableRecord, pBlockTable, NWRITEMODE);
AcDbObjectId TempLineID;
pBlockTableRecord->appendAcDbEntity(TempLineID, pPolyline);
pPolyline->close();
pBlockTable->close();
pBlockTableRecord->close();
return TempLineID;
}
开发者ID:TobeGodman,项目名称:AutoTrader,代码行数:30,代码来源:Additional_Class.cpp
示例2: createCircle
▲ 点赞 6 ▼
Acad::ErrorStatus createCircle(AcDbObjectId & idCircle)
{
CLogger::Print(L"*Call: createCircle()");
Acad::ErrorStatus es, esTmp;
AcDbBlockTable* pBlockTable = NULL;
es = acdbHostApplicationServices()->workingDatabase()
->getSymbolTable(pBlockTable, AcDb::kForRead);
if (Acad::eOk != es) {
CLogger::Print(L"*Exit: createCircle() - Fail to get the BlockTable.");
return es;
}
AcDbBlockTableRecord* pModelSpace = NULL;
es = pBlockTable->getAt(ACDB_MODEL_SPACE, pModelSpace, AcDb::kForWrite);
if (Acad::eOk != (esTmp = pBlockTable->close())) {
CLogger::Print(L"Warn: Fail to close the BlockTable!");
acrx_abort(ACRX_T("\nThere is an error occured when close the BlockTable. Message: %s")
, acadErrorStatusText(esTmp));
}
if (Acad::eOk != es) {
CLogger::Print(L"*Exit: createCircle() - Fail to get the Model Space! Error: %s", acadErrorStatusText(es));
return es;
}
idCircle = AcDbObjectId::kNull;
AcGePoint3d pt3Center(9.0, 3.0, 0.0);
AcGeVector3d vt3Normal(0.0, 0.0, 1.0);
AcDbCircle* pCircle = new AcDbCircle(pt3Center, vt3Normal, 10.0);
if (!pCircle) {
if (Acad::eOk != (esTmp = pModelSpace->close())) {
CLogger::Print(L"Warn: Fail to create new circle object!");
acrx_abort(ACRX_T("\nThere is an error occured. Error: %s")
, acadErrorStatusText(esTmp));
}
return Acad::eOutOfMemory;
}
es = pModelSpace->appendAcDbEntity(idCircle, pCircle);
if (Acad::eOk != (esTmp = pModelSpace->close())) {
CLogger::Print(L"Warn: Fail to close the Model Space!");
acrx_abort(ACRX_T("\nThere is an error occured when close the Model Space! Error: %s")
, acadErrorStatusText(esTmp));
}
if (Acad::eOk != es) {
CLogger::Print(L"*Exit: createCircle() - Fail to append new circle in to Model Space!");
delete pCircle;
return es;
}
if (Acad::eOk != (esTmp = pCircle->close())) {
CLogger::Print(L"Warn: Fail to close the circle object.");
acrx_abort(ACRX_T("\nFail to close the circle entity!, Error: %s")
, acadErrorStatusText(esTmp));
}
CLogger::Print(L"*Exit: createCircle()");
return Acad::eOk;
}
开发者ID:vuonganh1993,项目名称:arxlss,代码行数:60,代码来源:LSS10.cpp
示例3: Creat_Table
▲ 点赞 4 ▼
AcDbObjectId Additional_Class::Creat_Table(AcGePoint3d TablePoint, vector<CString> Title, double ColWidth, double RowHeight, double TextHeight)
{
AcDbTable *pTable = new AcDbTable();
AcDbObjectId TableID;
pTable->setNumColumns(Title.size());
pTable->setNumRows(1);
pTable->setColumnWidth(ColWidth);
pTable->setRowHeight(RowHeight);
pTable->setDirection(AcGeVector3d(1,0,0));
pTable->setNormal(AcGeVector3d(0,0,1));
pTable->setPosition(TablePoint);
AcDbBlockTable *pBlockTable;
AcDbBlockTableRecord *pBlockTableRecord;
acdbHostApplicationServices()->workingDatabase()->getBlockTable(pBlockTable, AcDb::kForRead);
pBlockTable->getAt(ACDB_MODEL_SPACE,pBlockTableRecord,AcDb::kForWrite);
pBlockTableRecord->appendAcDbEntity(TableID, pTable);
//pBlockTable->close();
pBlockTableRecord->close();
//pTable->setTextString(0,0, "桩 号");
//pTable->setTextHeight(0,0,10);
//pTable->setTextString(0,1, "X坐标值");
//pTable->setTextHeight(0,1,10);
//pTable->setTextString(0,2, "Y坐标值");
//pTable->setTextHeight(0,2,10);
//pTable->setTextString(0,3, "特性值");
//pTable->setTextHeight(0,3,10);
//pTable->setTextString(0,4, "长 度");
//pTable->setTextHeight(0,4,10);
pTable->close();
return TableID;
}
开发者ID:TobeGodman,项目名称:AutoTrader,代码行数:32,代码来源:Additional_Class.cpp
示例4: AcDbBlockTableRecord
▲ 点赞 1 ▼
void
makeABlock()
{
// Create and name a new block table record.
//
AcDbBlockTableRecord *pBlockTableRec
= new AcDbBlockTableRecord();
pBlockTableRec->setName("ASDK-NO-ATTR");
// Get the block table.
//
AcDbBlockTable *pBlockTable = NULL;
acdbHostApplicationServices()->workingDatabase()
->getSymbolTable(pBlockTable, AcDb::kForWrite);
// Add the new block table record to the block table.
//
AcDbObjectId blockTableRecordId;
pBlockTable->add(blockTableRecordId, pBlockTableRec);
pBlockTable->close();
// Create and add a line entity to the component's
// block record.
//
AcDbLine *pLine = new AcDbLine();
AcDbObjectId lineId;
pLine->setStartPoint(AcGePoint3d(3, 3, 0));
pLine->setEndPoint(AcGePoint3d(6, 6, 0));
pLine->setColorIndex(3);
pBlockTableRec->appendAcDbEntity(lineId, pLine);
pLine->close();
pBlockTableRec->close();
}
开发者ID:kevinzhwl,项目名称:ObjectARXMod,代码行数:35,代码来源:complex.cpp
示例5: acdbHostApplicationServices
▲ 点赞 1 ▼
Acad::ErrorStatus
postToDatabase(/*[in]*/AcDbEntity* pEnt,/*[out]*/AcDbObjectId& idObj)
//Purpose:
// Adds an entity to the MODEL_SPACE of the CURRENT database.
//Note:
// It could be generalized to add it to any block table record of
// any database, but why complicate it...
//
{
Acad::ErrorStatus es;
AcDbBlockTable* pBlockTable;
AcDbBlockTableRecord* pSpaceRecord;
AcDbDatabase *pCurDwg = acdbHostApplicationServices()->workingDatabase();
if (pCurDwg==NULL)
return Acad::eNoDatabase;
//Get a pointer to the current drawing
//and get the drawing's block table. Open it for read.
if ((es = pCurDwg->getBlockTable(pBlockTable, AcDb::kForRead))==Acad::eOk){
//Get the Model Space record and open it for write. This will be the owner of the new line.
if ((es = pBlockTable->getAt(ACDB_MODEL_SPACE, pSpaceRecord, AcDb::kForWrite))==Acad::eOk){
//Append pEnt to Model Space, then close it and the Model Space record.
if ((es = pSpaceRecord->appendAcDbEntity(idObj, pEnt))==Acad::eOk)
pEnt->close();
pSpaceRecord->close();
}
pBlockTable->close();
}
//it is good programming practice to return an error status
return es;
}
开发者ID:kevinzhwl,项目名称:ObjectARXMod,代码行数:30,代码来源:Lab8CommandUtils.cpp
示例6: postToDatabase
▲ 点赞 1 ▼
Acad::ErrorStatus postToDatabase (/*[in]*/AcDbDatabase *pDb /*=NULL*/, AcDbEntity *pEnt, AcDbObjectId &idObj) {
//----- Purpose:
//----- Adds an entity to the MODEL_SPACE of the database given in argument.
//----- * pDb: pointer to the databse where to add the entity,
//----- if NULL, then the curretn database is used.
//----- * pEnt: pointer to an entity instance.
//----- * idObj: it will contain the assign ID to the object if successfully added to the database.
//----- Note:
//----- The entity object is closed while we return from that function. Only the idObj can be used after.
assert ( pEnt != NULL ) ;
if ( pDb == NULL )
pDb =acdbHostApplicationServices ()->workingDatabase () ;
//----- Get a pointer to the current drawing
//----- and get the drawing's block table. Open it for read.
Acad::ErrorStatus es ;
AcDbBlockTable *pBlockTable ;
if ( (es =pDb->getBlockTable (pBlockTable, AcDb::kForRead)) == Acad::eOk ) {
//----- Get the Model Space record and open it for write. This will be the owner of the new line.
AcDbBlockTableRecord *pSpaceRecord ;
if ( (es =pBlockTable->getAt (ACDB_MODEL_SPACE, pSpaceRecord, AcDb::kForWrite)) == Acad::eOk ) {
//----- Append pEnt to Model Space, then close it and the Model Space record.
if ( (es =pSpaceRecord->appendAcDbEntity (idObj, pEnt)) == Acad::eOk )
pEnt->close () ;
pSpaceRecord->close () ;
}
pBlockTable->close () ;
}
//----- It is good programming practice to return an error status
return (es) ;
}
开发者ID:FengLuanShuangWu,项目名称:AutoCADPlugin-HeatSource,代码行数:31,代码来源:HlrArxSampleCommands.cpp
示例7: getSymbolTable
▲ 点赞 1 ▼
Acad::ErrorStatus
postToDb(AcDbEntity* ent, AcDbObjectId& objId)
{
Acad::ErrorStatus es;
AcDbBlockTable* pBlockTable;
AcDbBlockTableRecord* pSpaceRecord;
if ((es = acdbHostApplicationServices()->workingDatabase()->
getSymbolTable(pBlockTable, AcDb::kForRead))
!= Acad::eOk) {
return es;
}
if ((es = pBlockTable->getAt(ACDB_MODEL_SPACE,
pSpaceRecord,
AcDb::kForWrite)) != Acad::eOk) {
return es;
}
if ((es = pBlockTable->close()) != Acad::eOk) {
return es;
}
if ((es = pSpaceRecord->appendAcDbEntity(objId, ent)) != Acad::eOk) {
return es;
}
if ((es = pSpaceRecord->close()) != Acad::eOk) {
return es;
}
return ent->close();
}
开发者ID:kevinzhwl,项目名称:ObjectARXMod,代码行数:34,代码来源:utilui.cpp
示例8: insertPoints
▲ 点赞 1 ▼
bool insertPoints(std::map<std::wstring,AcGePoint3d>& m_Points, Adesk::Int16 pointStyle, double pointSize, double textHeight)
{
AcDbDatabase* pDb = acdbHostApplicationServices()->workingDatabase();
AcCmColor pointColor;
AcGePoint3d temp;
AcDbPoint* tmp_point = nullptr;
AcDbText* tmp_txt = nullptr;
AcDbBlockTable* pBT = nullptr;
AcDbBlockTableRecord* pBTR = nullptr;
ACHAR* nrPct = nullptr;
/*****************************************************************/
pointColor.setColorIndex(7);
Layer::Create(_T("pctContur"), pointColor, false, false, false);
Layer::Create(_T("nrPct"), pointColor, false, false, false);
Acad::ErrorStatus es = Acad::eOk;
es = acdbHostApplicationServices()->workingDatabase()->setPdmode(pointStyle);
es = acdbHostApplicationServices()->workingDatabase()->setPdsize(pointSize);
/*****************************************************************/
pDb->getSymbolTable(pBT, AcDb::kForRead);
pBT->getAt(ACDB_MODEL_SPACE, pBTR, AcDb::kForWrite);
pBT->close();
std::map<std::wstring, AcGePoint3d>::iterator it;
for (it = m_Points.begin(); it != m_Points.end();it++)
{
const wchar_t* key = it->first.c_str();
tmp_point = new AcDbPoint;
tmp_point->setPosition(it->second);
tmp_point->setLayer(_T("pctContur"));
tmp_txt = new AcDbText(it->second, key, AcDbObjectId::kNull, textHeight, 0);
tmp_txt->setLayer(_T("nrPct"));
pBTR->appendAcDbEntity(tmp_point);
pBTR->appendAcDbEntity(tmp_txt);
tmp_point->close();
tmp_txt->close();
}
pBTR->close();
return true;
}
开发者ID:cosmintaran,项目名称:CosminRepo,代码行数:47,代码来源:InventarCoordonate.cpp
示例9: createDatabase
▲ 点赞 1 ▼
void createDatabase()
{
// Create a new Database.
AcDbDatabase *pDb = new AcDbDatabase();
// Get the BlockTable.
AcDbBlockTable *pBTable = NULL;
pDb->getSymbolTable(pBTable, AcDb::kForRead);
// Get the ModelSpace.
AcDbBlockTableRecord *pRecord = NULL;
pBTable->getAt(ACDB_MODEL_SPACE, pRecord, AcDb::kForWrite);
pBTable->close();
// Create a new Circle.
AcDbCircle *pCircle1 = new AcDbCircle(AcGePoint3d(100,100,0),
AcGeVector3d(0,0,1),
50.0);
// Create another new Circle.
AcDbCircle *pCircle2 = new AcDbCircle(AcGePoint3d(200,200,0),
AcGeVector3d(0,0,1),
30.0);
// Append Circle1 to ModelSpace
pRecord->appendAcDbEntity(pCircle1);
pCircle1->close();
// Append Circle2 to ModelSpace
pRecord->appendAcDbEntity(pCircle2);
pCircle2->close();
pRecord->close();
// Save to file
// MUST append a DWG file extension.
acutPrintf(_T("\nSave file to \"d:\\temp\\testfile.dwg\"."));
pDb->saveAs(_T("d:\\temp\\testfile.dwg"));
delete pDb;
}
开发者ID:kevinzhwl,项目名称:ZRXSDKMod,代码行数:40,代码来源:DatabaseOp.cpp
示例10: acdbHostApplicationServices
▲ 点赞 1 ▼
void
createPolyline()
{
// Set four vertex locations for the pline.
//
AcGePoint3dArray ptArr;
ptArr.setLogicalLength(4);
for (int i = 0; i < 4; i++) {
ptArr[i].set((double)(i/2), (double)(i%2), 0.0);
}
// Dynamically allocate an AcDb2dPolyline object,
// given four vertex elements whose locations are supplied
// in ptArr. The polyline has no elevation, and is
// explicitly set as closed. The polyline is simple;
// that is, not curve fit or a spline. By default, the
// widths are all 0.0 and there are no bulge factors.
//
AcDb2dPolyline *pNewPline = new AcDb2dPolyline(
AcDb::k2dSimplePoly, ptArr, 0.0, Adesk::kTrue);
pNewPline->setColorIndex(3);
// Get a pointer to a Block Table object.
//
AcDbBlockTable *pBlockTable;
acdbHostApplicationServices()->workingDatabase()
->getSymbolTable(pBlockTable, AcDb::kForRead);
// Get a pointer to the MODEL_SPACE BlockTableRecord.
//
AcDbBlockTableRecord *pBlockTableRecord;
pBlockTable->getAt(ACDB_MODEL_SPACE, pBlockTableRecord,
AcDb::kForWrite);
pBlockTable->close();
// Append the pline object to the database and
// obtain its Object ID.
//
AcDbObjectId plineObjId;
pBlockTableRecord->appendAcDbEntity(plineObjId,
pNewPline);
pBlockTableRecord->close();
// Make the pline object reside on layer "0".
//
pNewPline->setLayer("0");
pNewPline->close();
}
开发者ID:kevinzhwl,项目名称:ObjectARXMod,代码行数:52,代码来源:complex.cpp
示例11: printFirstInteriorPoints
▲ 点赞 1 ▼
void InteriorPointsConstructor::printFirstInteriorPoints(int color, bool flag)
{
int i = 1;
int j = 0;
AcGePoint3dArray ptArr;
ptArr.setLogicalLength(_interiorArray[i].length()+1);
while (j < _interiorArray[i].length())
{
ptArr[j].set(_interiorArray[i][j].x, _interiorArray[i][j].y, _interiorArray[i][j].z);
j++;
}
ptArr[j].set(_interiorArray[0][0].x, _interiorArray[0][0].y, _interiorArray[0][0].z);
AcDb3dPolyline *pNewPline = new AcDb3dPolyline(AcDb::k3dSimplePoly , ptArr, Adesk::kFalse);
pNewPline->setColorIndex(color);
AcDbBlockTable *pBlockTable;
AcDbBlockTableRecord *pBlockTableRecord;
acdbHostApplicationServices()->workingDatabase()->getSymbolTable(pBlockTable, AcDb::kForRead);
pBlockTable->getAt(ACDB_MODEL_SPACE, pBlockTableRecord, AcDb::kForWrite);
AcDbObjectId plineObjId;
pBlockTableRecord->appendAcDbEntity(plineObjId, pNewPline);
pBlockTable->close();
pBlockTableRecord->close();
//pNewPline->setLayer(_T("0"));
//pNewPline->setClosed(Adesk::kFalse);
pNewPline->close();
//}
//delete pNewPline;
}
开发者ID:vpatrinica,项目名称:pernute,代码行数:52,代码来源:InteriorPointsConstructor.cpp
示例12: createBlock
▲ 点赞 1 ▼
void createBlock()
{
AcDbBlockTableRecord* pBTR = new AcDbBlockTableRecord();
pBTR->setName(DYNBLKSAMP_BLOCKNAME);
AcDbSymbolTable* pBT = NULL;
acdbHostApplicationServices()->workingDatabase()->getBlockTable(pBT, AcDb::kForWrite);
pBT->add(pBTR);
pBT->close();
AcGePoint3d pt1(0.0, 0.0, 0.0);
AcGePoint3d pt2(2.0, 0.0, 0.0);
AcDbLine* pLine = new AcDbLine(pt1, pt2);
pBTR->appendAcDbEntity(pLine);
pLine->close();
pt1 = pt2;
pt2.y = 2.0;
pLine = new AcDbLine(pt1, pt2);
pBTR->appendAcDbEntity(pLine);
pLine->close();
pt1 = pt2;
pt2.x = 0.0;
pLine = new AcDbLine(pt1, pt2);
pBTR->appendAcDbEntity(pLine);
pLine->close();
pt1 = pt2;
pt2.y = 0.0;
pLine = new AcDbLine(pt1, pt2);
pBTR->appendAcDbEntity(pLine);
pLine->close();
pBTR->close();
}
开发者ID:FengLuanShuangWu,项目名称:AutoCADPlugin-HeatSource,代码行数:36,代码来源:ProtocolReactors.cpp
示例13: Draw_Text
▲ 点赞 1 ▼
AcDbObjectId Additional_Class::Draw_Text( CString InputText, AcGePoint3d InsertPoint, double TextHeight, double TextAngle )
{
AcDbBlockTable *pBlockTable;
AcDbBlockTableRecord *pBlockTableRecord;
AcDbText *text_Up = new AcDbText(InsertPoint, InputText, AcDbObjectId::kNull, TextHeight, TextAngle);
acdbHostApplicationServices()->workingDatabase()->getBlockTable(pBlockTable, AcDb::kForRead);
//this->Open_BlockTable(pBlockTable, NREADMODE);
pBlockTable->getAt(ACDB_MODEL_SPACE, pBlockTableRecord, AcDb::kForWrite);
//this->Open_ModelTableRecord(pBlockTableRecord, pBlockTable, NWRITEMODE);
AcDbObjectId TextID;
pBlockTableRecord->appendAcDbEntity(TextID, text_Up);
text_Up->close();
pBlockTable->close();
pBlockTableRecord->close();
return TextID;
}
开发者ID:TobeGodman,项目名称:AutoTrader,代码行数:16,代码来源:Additional_Class.cpp
示例14: AppendEnt
▲ 点赞 1 ▼
void AppendEnt(AcDbEntity *pEnt)
{
AcDbBlockTable *pBT;
AcDbBlockTableRecord *pBTR;
acdbHostApplicationServices()->workingDatabase()->getBlockTable(pBT,AcDb::kForRead);
pBT->getAt(ACDB_MODEL_SPACE,pBTR,AcDb::kForWrite);
pBT->close();
Acad::ErrorStatus es;
//add entity to model space
es = pBTR->appendAcDbEntity(pEnt);
pBTR->close();
}
开发者ID:kevinzhwl,项目名称:ObjectARXMod,代码行数:17,代码来源:acrxEntryPoint.cpp
示例15: Draw_Circle
▲ 点赞 1 ▼
AcDbObjectId Additional_Class::Draw_Circle( AcGePoint3d ptCircle, double Radius )
{
AcGeVector3d norm(0,0,1);
AcDbCircle *pCircle = new AcDbCircle(ptCircle, norm, Radius);
AcDbBlockTable *pBlockTable;
AcDbBlockTableRecord *pBlockTableRecord;
acdbHostApplicationServices()->workingDatabase()->getBlockTable(pBlockTable, AcDb::kForRead);
//Open_BlockTable(pBlockTable, NREADMODE);
//Open_ModelTableRecord(pBlockTableRecord, pBlockTable, NWRITEMODE);
pBlockTable->getAt(ACDB_MODEL_SPACE, pBlockTableRecord, AcDb::kForWrite);
AcDbObjectId CircleId;
pBlockTableRecord->appendAcDbEntity(CircleId, pCircle);
pCircle->close();
pBlockTable->close();
pBlockTableRecord->close();
return CircleId;
}[/code] |
|