gnanapaul 发表于 2009-12-16 09:50:38

显示中心点

**** Hidden Message *****

MickD 发表于 2009-12-16 15:24:02

您需要将该点分解成它的三维部分,例如,acutPrintf("centre %f,%f,%f ",ptCentre。x,ptCentre。y,ptCentre。z);
或者类似的东西

gnanapaul 发表于 2009-12-16 22:41:08


你好。。。
感谢您的回复。
问题在
if (objid != NULL)
如何从数据库获取AcDbObjectId?
请告诉我...

MickD 发表于 2009-12-16 23:42:34

试试这样的东西-
void CSampDialog::OnShowPoints()
{
        AcDbObjectId objid; // this gets assigned to in the acdbOpenObject method.
        AcDbObject* pObj;
        AcDbEntity* pObj = NULL;// ----- you need to get/select an object to set this so you can open it
        if(acdbOpenObject(pObj,objid,AcDb::kForRead) == Acad::eOk)
        {
                AcDbCircle* pCirc = AcDbCircle::cast(pObj);
                if (pCirc !=NULL)
                {
                        double dRadius = pCirc->radius();
                        AcGePoint3d ptCenter = pCirc->center();
                        acutPrintf("center %f radius %f", ptCenter, dRadius);
                }
                pObj->close();
        }
        else
                acutPrintf("\nFailed to open the object.");
        }
}

gnanapaul 发表于 2009-12-17 00:18:07

嗨,米克,
感谢您的回复
我用了你的代码。但它显示未能笔对象。
我在这里的事情,我必须从数据库中的对象中获取选定的对象的objectId。
但我不知道如何从数据库获取objectid。
请帮帮我。
再次感谢...

gnanapaul 发表于 2009-12-17 00:34:53

您针对的是哪个版本的 Acad?

gnanapaul 发表于 2009-12-17 00:37:17

您可以使用 acdbGetCurrentSelectionSet
获取当前选择集中的 ID 数组

gnanapaul 发表于 2009-12-17 00:59:16

嗨,丹尼尔,
感谢您的回复。
我是arx的新手。请给出 acdbGetCurrentSelectionSet 的代码语法。
我正在使用Autocad 2000和vc6.0
非常感谢....

gnanapaul 发表于 2009-12-17 01:17:58

类似
void CSampDialog::OnShowPoints()
{
AcDbObjectIdArray ids;
if(acdbGetCurrentSelectionSet(ids) == eOk)
{
    for(size_t i = 0; i radius();
          AcGePoint3d ptCenter = pCirc->center();
          acutPrintf("center (%g,%g,%g) radius %g",
            ptCenter.x,ptCenter.y,ptCenter.z, dRadius);
      }
      pObj->close();
      }
      else
      acutPrintf("\nFailed to open the object.");
    }
}
}

gnanapaul 发表于 2009-12-17 01:30:39

嗨,丹尼尔,
我用了你的代码。但是,
error C2065: 'acdbGetCurrentSelectionSet' : undeclared identifier
error C2065: 'eOk' : undeclared identifier
warning C4018: '<' : signed/unsigned mismatch
我是否应该包含任何头文件???
再次感谢...
问候,
保罗.G
页: [1] 2
查看完整版本: 显示中心点