web.pawan 发表于 2009-12-23 04:09:37

关于arx中的尺寸

亲爱的成员们,
任何人都知道如何在arx中创建维度
在autolisp中,我将使用_。dimaligned
(setqpt1 (list 5 5))
(setqpt2 (list 10 10))
(command "line" pt1 pt2        "")
(command "_.dimaligned" pt1 pt2       (polar pt2 01))

带有代码的简单示例会很好workingDatabase();
    AcDbBlockTableRecordPointer pBlockTableRecord(pDatabase->currentSpaceId(),AcDb::kForWrite);
    AcDbAlignedDimension *dim = new AcDbAlignedDimension (pr1.Point,pr2.Point,pr3.Point);
    dim->setDatabaseDefaults(pDatabase);
    pBlockTableRecord->appendAcDbEntity(dim);
    dim->close();
}

web.pawan 发表于 2010-1-1 20:28:20

你好Daniel,
我使用了你之前的代码,只是修改了一些以使用我的数据库。
以下代码在autocad中抛出错误对话框。
是否有我丢失的东西?如果我使用workingDatabase,它不会报告此错误。
关于,
Pawan
int test_save()
{
        AcDbDatabase *pDb = new AcDbDatabase();
        AcDbBlockTable *pBtbl;
        pDb->getSymbolTable(pBtbl, AcDb::kForRead);
        AcDbBlockTableRecord *pBtblRcd;
        pBtbl->getAt(ACDB_MODEL_SPACE, pBtblRcd, AcDb::kForWrite);
        pBtbl->close();
        ////////////////dim starts
        ads_point pt1 = {5,10};
        ads_point pt2 = {15,10};
        ads_point pt3 = {10,10};
        ads_point temp = {10,10};
        ads_real tAngle = 0;
        AcGePoint3d stpt(asPnt3d(pt1)); //3d starting point
        AcGePoint3d endpt(asPnt3d(pt2));; //3d ending point
        acutPolar(pt3, tAngle, 0, temp);
        AcGePoint3d dimPoint(asPnt3d(temp)); //3d dim point

//    if i use working database, this doesn't give error
//    AcDbDatabase *pDb= acdbHostApplicationServices()->workingDatabase();
//    AcDbBlockTableRecordPointer pBtblRcd(pDb->currentSpaceId(),AcDb::kForWrite);
   
      AcDbAlignedDimension *dim = new AcDbAlignedDimension (stpt,endpt,dimPoint);
        dim->setDatabaseDefaults(pDb);
        pBtblRcd->appendAcDbEntity(dim);
      dim->close();
        ////////////////dim ends
       
        //close the blocktable record
        pBtblRcd->close();
        //save the file
        Acad::ErrorStatus es = pDb->saveAs(_T("c:\\temp\\test.dwg"));
        //delete the database
        delete pDb;
        return 0;
}

web.pawan 发表于 2010-1-1 21:49:38


永远不要假设返回Acad::ErrorStatus的函数将返回Acad::eOk,检查它们。很肯定你会发现你描述的问题。

pkohut 发表于 2010-4-3 11:09:15

我发现了问题。
AcDbAlignedDimension*dim=new AcDbAlignedDimension(stpt, endpt, dimPoint);
与新数据库一起使用时,AcDbAlignedDimension()需要dimstyle。
这就是它之前报告错误的原因。
页: [1]
查看完整版本: 关于arx中的尺寸