- 积分
- 749
- 明经币
- 个
- 注册时间
- 2003-3-8
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
发表于 2003-3-8 11:46:00
|
显示全部楼层
下面是一个画直线的例子,可参考
SAFEARRAYBOUND pSab[1];
pSab[0].lLbound = 0;
pSab[0].cElements = 3;
SAFEARRAY *pSa, *pSb;
pSa = SafeArrayCreate(VT_R8, 1, pSab);
pSb = SafeArrayCreate(VT_R8, 1, pSab);
double value;
value = 0;
long ix[1];
ix[0] = 0;
SafeArrayPutElement(pSa, ix, &value);
ix[0] = 1;
SafeArrayPutElement(pSa, ix, &value);
value = 0;
ix[0] = 2;
SafeArrayPutElement(pSa, ix, &value);
value = 30;
ix[0] = 0;
SafeArrayPutElement(pSb, ix, &value);
value = 79;
ix[0] = 1;
SafeArrayPutElement(pSb, ix, &value);
value = 0;
ix[0] = 2;
SafeArrayPutElement(pSb, ix, &value);
VARIANT v1, v2;
VariantInit(&v1);
v1.vt = VT_ARRAY | VT_R8;
v1.parray = pSa;
VariantInit(&v2);
v2.vt = VT_ARRAY | VT_R8;
v2.parray = pSb;
pAcadDoc = pAcadApp->ActiveDocument;
IAcadModelSpacePtr pAcadSpace = pAcadDoc->GetModelSpace();
pAcadSpace->AddLine(v1, v2);
// pAcadApp->ActiveDocument->ModelSpace->AddLine(v1, v2);
SafeArrayDestroy(pSa);
SafeArrayDestroy(pSb); |
|