|
发表于 2002-8-8 17:39:00
|
显示全部楼层
AcDbBlockTable *pBlockTable;
AcDbObjectId Id;
double ht=5.0;
acdbHostApplicationServices()->workingDatabase()
->getSymbolTable(pBlockTable, AcDb::kForWrite);//以写模式打开图块表
AcDbBlockTableRecord *pBlockTableRecord=new AcDbBlockTableRecord;
pBlockTableRecord->setName("表面粗糙度代号");
pBlockTable->add(Id, pBlockTableRecord);//添加图块表记录
pBlockTable->close();//关闭图块表
AcDbLine* pLine1=new AcDbLine();//直线
pLine1->setStartPoint(AcGePoint3d(0,0,0));
pLine1->setEndPoint(AcGePoint3d(-sqrt(2.0)/2.0*ht,
sqrt(6.0)/2.0*ht,0));
AcDbLine* pLine2=new AcDbLine();//直线
pLine2->setStartPoint(AcGePoint3d(0,0,0));
pLine2->setEndPoint(AcGePoint3d(sqrt(2.0)*ht,sqrt(6.0)*ht,0));
pBlockTableRecord->appendAcDbEntity(Id, pLine1);//添加实体返回ID
pBlockTableRecord->appendAcDbEntity(Id, pLine2);//添加实体返回ID
AcDbAttributeDefinition* pAttDef=new AcDbAttributeDefinition;
pAttDef->setTag("表面粗糙度");
pAttDef->setPrompt("请输入表面粗糙度的值:");
pAttDef->setTextString("3.2");
pAttDef->setPosition(AcGePoint3d(-sqrt(2.0)/2.0*ht,
sqrt(6.0)/2.0*ht*1.3,0));
pAttDef->setHeight(ht*0.8);
pAttDef->setConstant(Adesk::kFalse);
pAttDef->setInvisible(Adesk::kFalse);
pAttDef->setPreset(Adesk::kFalse);
pBlockTableRecord->appendAcDbEntity(Id, pAttDef);//添加实体返回ID
pBlockTableRecord->close();//关闭图块表记录
pLine1->close();//关闭实体
pLine2->close();//关闭实体
pAttDef->close();//关闭实体 |
|