|
- static int createLwPolyLine(double* pts, int npts, double elevation)
- {
- if (pts == NULL || npts == 0)
- return RTERROR;
- resbuf *pEnt = ads_newrb(0);
- pEnt->resval.rstring = _wcsdup(L"LWPOLYLINE"); //strdup
- resbuf* pTail = pEnt;
- pTail = pTail->rbnext = ads_newrb(100);
- pTail->resval.rstring = _wcsdup(L"AcDbEntity");
- pTail = pTail->rbnext = ads_newrb(100);
- pTail->resval.rstring = _wcsdup(L"AcDbPolyline");
- pTail = pTail->rbnext = ads_newrb(8);
- pTail->resval.rstring = _wcsdup(L"0");
- pTail = pTail->rbnext = ads_newrb(90);
- pTail->resval.rlong = npts;
- pTail = pTail->rbnext = ads_newrb(38);
- pTail->resval.rreal = elevation;
- for (int idx = 1; idx < npts; idx += 2)
- {
- pTail = pTail->rbnext = ads_newrb(10);
- pTail->resval.rpoint[0] = pts[idx - 1];
- pTail->resval.rpoint[1] = pts[idx];
- pTail->resval.rpoint[2] = 0.0;
- }
- pTail->rbnext = NULL;//end
- int res = ads_entmake(pEnt);
- ads_relrb(pEnt);
- return res;
- }
- static void ArxTemplate_doit(void)
- {
- double pnts[4] = { 0.0, 0.0, 0.0, 100.0 };
- createLwPolyLine(pnts, 4, 100);
- }
复制代码 |
|