victor_hee 发表于 2002-8-4 18:22:00

[求助]

我怎么把一个选择集放到一个属性块的定义里去?我是这样做的,但不行!请帮帮我
        acutPrintf("It is begin!\n");
        int retCode = 0;
        AcDbBlockTable *pBlockTable = NULL;
    AcDbBlockTableRecord *pBlockRecord=new AcDbBlockTableRecord;
        AcDbObjectId entId,blockId;
        ads_name ss;
        AcDbEntity *pEnt;
    ads_point pt1,pt2;

        AcGePoint3d basepoint;
        pBlockRecord->setName("BlockWithAttribute");
    if(acedGetPoint(NULL,"Please input a point:\n",asDblArray(basepoint))!=RTNORM)
    return;
   

    pBlockRecord->setOrigin(basepoint);
        acdbHostApplicationServices()->workingDatabase()
                ->getSymbolTable(pBlockTable,AcDb::kForWrite);
    pBlockTable->add(blockId,pBlockRecord);
   
    if(acedGetPoint(NULL,"请输入左上角:\n",pt1)!=RTNORM)
    return;
       if(acedGetPoint(NULL,"请输入右下角:\n",pt2)!=RTNORM)
    return;

    acedSSGet("C",pt1,pt2,NULL,ss);
    acdbGetObjectId(entId,ss);
    acdbOpenObject(pEnt,entId,AcDb::kForNotify);
    pBlockRecord->appendAcDbEntity(entId,pEnt);
        //pCircle->close();
    acedSSFree(ss);

        AcDbAttributeDefinition *pAttdef = new AcDbAttributeDefinition;
    pAttdef->setPosition(basepoint);
    pAttdef->setHeight(10);
        pAttdef->setRotation(0);
    pAttdef->setHorizontalMode(AcDb::kTextLeft);
    pAttdef->setVerticalMode(AcDb::kTextBase);
    pAttdef->setPrompt("prompt");
    pAttdef->setTextString("DEFAULT");
    pAttdef->setTag("Tag");
        pAttdef->setInvisible(Adesk::kFalse);
    pAttdef->setVerifiable(Adesk::kFalse);
        pAttdef->setPreset(Adesk::kFalse);
        pAttdef->setConstant(Adesk::kFalse);
        pAttdef->setFieldLength(Adesk::kFalse);

        pBlockRecord->appendAcDbEntity(entId,pAttdef);

        pAttdef->close();
        pBlockRecord->close();
    pBlockTable->close();
页: [1]
查看完整版本: [求助]