Esempio n. 1
0
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();
}
Esempio n. 2
0
AcDbObjectId Additional_Class::Draw_Line(AcGePoint3d stPoint, AcGePoint3d enPoint)
{
	AcDbLine *pLineTemp = new AcDbLine();
	pLineTemp->setStartPoint(stPoint);
	pLineTemp->setEndPoint(enPoint);
	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, pLineTemp);
	pLineTemp->close();
	pBlockTable->close();
	pBlockTableRecord->close();
	return TempLineID;
}
Esempio n. 3
0
void Additional_Class::Change_Line(AcDbObjectId LineID, AcGePoint3d ptStart, AcGePoint3d ptEnd )
{
	AcDbEntity *pEnt_Temp;
	if (acdbOpenAcDbEntity(pEnt_Temp, LineID, AcDb::kForWrite)!= Acad::eOk)
	{
		acutPrintf(_T("\nOPEN ENETITY ERROR"));
		return;
	}
	if (!pEnt_Temp->isKindOf(AcDbLine::desc()))
	{
		acutPrintf(_T("\nENTITY IS NOT LINE"));
		return;
	}
	AcDbLine *pLineChange;
	pLineChange = AcDbLine::cast(pEnt_Temp);
	AcGePoint3d pLineE;
	pLineChange->setStartPoint(ptStart);
	pLineChange->setEndPoint(ptEnd);
	pEnt_Temp->close();
	pLineChange->close();
	return;
}