当前位置:   article > 正文

CAD切地形剖面图_cad地形图切剖面插件

cad地形图切剖面插件

2023.06.21 本文最后开放部分源码,供大家交流学习。

 简介

1. 支持CAD2008~CAD2023; 

2.命令行输入ap,加载插件。输入 gsp,选择一条或者多条多段线(暂不支持直线)作为剖面线,确定,再根据提示选择与剖面线相交的等高线,确定,再点击选择放置的基点,即可生成剖面图;

3.可设置水平、竖直方向的比例;

4.纯命令操作,无界面,快捷方便;

5.下载链接: https://pan.baidu.com/s/1GM4YV2sy8Fwccge78YJp4w  提取码: kwew ; 或者 加群下载插件,QQ群:1148455637

注意:

1.等高线所在图层需要设置为“Level 42,DGX,等高线,HC811,HC812,7101010,7101020,

Contour_Line_Minor,Contour_Line_Major,Contour_Line_Intermediate”中任意一个;

2.剖面线可以是折线;

3.插件会忽略高程小于0的等高线;

4.默认水平、竖直比例是1:1000;

5.如果切出来的剖面高程都是0,请把图复制粘贴到新的CAD里。

插件加载:

参数设置:

​​​​​​

操作示例:

2021.8.26日更新:

1.修改了剖面的放置方式。在生成多个剖面时,可选择水平或者竖直排列剖面图,更加整齐美观;

 2.增加了设置背景网格线的选项,可单独设置水平或者竖直的背景网格线;


 2021.8.14日更新:

1.等高线支持多段线、二维多段线、三维多段线及样条曲线;


2021.8.2日更新:

1.修复了当剖面线为折线时,在拐点处高程取值出现双值的错误;

2.拐点处的高程值采用IDW方法插值得到;


  1. //根据选择的剖面线提取剖面
  2. static void GetSectionsFromPlines_ARX_GSP()
  3. {
  4. CString csDGXlayer = _T("Level 42,DGX,等高线,HC811,HC812,7101010,7101020,Contour_Line_Minor,Contour_Line_Major,Contour_Line_Intermediate");
  5. acutPrintf(_T("\n等高线要设置在以下图层上: %s"), csDGXlayer);
  6. //横纵比例
  7. REAL nRatioX = 1000.0;
  8. REAL nRatioY = 1000.0;
  9. //刻度间距
  10. int delty = 10;
  11. //标尺宽度
  12. int nWidth = 1;
  13. //标尺最底部高程为5的倍数
  14. int timesOfAltt = 5;
  15. //底部标尺刻度线最小间距
  16. REAL nVW = 1.0;
  17. //底部高程栏高度、距离栏高度
  18. REAL dH_ad = 8.0;
  19. //左侧标尺与剖面线最左侧点的间距
  20. REAL dSeparate = 3.0;
  21. //放置方向,竖向、水平放置
  22. bool bSetV = true;
  23. //背景网格
  24. int iBox = 0;
  25. //用户设置
  26. if (setUserSettings(nRatioX, nRatioY, delty, nWidth, nVW, dH_ad, bSetV, iBox) == 0) return;
  27. nRatioX = nRatioX / 1000;
  28. nRatioY = nRatioY / 1000;
  29. //选择剖面线
  30. ads_name ss;
  31. int lengthQX = 0;//切线数量
  32. struct resbuf* pRbList = NULL;
  33. TCHAR* promptStr[2];
  34. //获得当前图形窗口中已经选择的实体(PickFirst 选择集)
  35. if (RTNORM == acedSSGet(_T("I"), NULL, NULL, NULL, ss))
  36. {
  37. if (RTNORM != acedSSLength(ss, (Adesk::Int32*)&lengthQX)) return;
  38. }
  39. else
  40. {
  41. pRbList = acutBuildList(RTDXF0, _T("lwpolyline"), RTNONE);
  42. promptStr[0] = _T("\n请选择剖面线:");
  43. promptStr[1] = _T("");
  44. if (RTNORM != acedSSGet(_T(":$"), promptStr, NULL, pRbList, ss))
  45. {
  46. acutRelRb(pRbList);
  47. return;
  48. }
  49. acutRelRb(pRbList);
  50. acedSSLength(ss, (Adesk::Int32*)&lengthQX);
  51. //acedSSSetFirst(ss, NULL);//亮显对象
  52. }
  53. if (lengthQX == 0L) return;
  54. //获取等高线
  55. ads_name ssDGX;
  56. pRbList = acutBuildList(RTDXF0, _T("lwpolyline,POLYLINE,SPLINE"), 8, csDGXlayer, RTNONE);
  57. promptStr[0] = _T("\n请选择等高线:");
  58. promptStr[1] = _T("");
  59. if (RTNORM != acedSSGet(_T(":$"), promptStr, NULL, pRbList, ssDGX))
  60. {
  61. acutRelRb(pRbList);
  62. return;
  63. }
  64. acutRelRb(pRbList);
  65. long lengthDGX;//等高线数量
  66. acedSSLength(ssDGX, (Adesk::Int32*)&lengthDGX);
  67. if (lengthDGX == 0L) return;
  68. //指定绘制剖面的基点
  69. AcGePoint2d ptbase;
  70. AcGePoint2d ptbaseTemp;
  71. int nReturn = acedGetPoint(NULL, TEXT("\n请选择基点:"), asDblArray(ptbase));
  72. if (nReturn != RTNORM) return;
  73. //对多条剖面线进行循环
  74. vector<CVert>pl_pt;
  75. //需要填充的矩形
  76. AcDbObjectIdArray loopIds;
  77. //进度条
  78. //acedSetStatusBarProgressMeter(TEXT("正在计算..:"), 0, lengthQX - 1);
  79. CString ARXCurrentDirectory = CAppDirectoryUtil::GetCurrentDirectory();
  80. CString fn = CT2A(ARXCurrentDirectory);
  81. fn += "\\GSP-距离与高程.txt";
  82. ofstream fout(fn);
  83. fout << "切线号\t"<< "累计距离\t" << "实际高程" << endl;
  84. for (int ii = 0; ii < lengthQX; ii++)
  85. {
  86. //acedSetStatusBarProgressMeterPos(ii);
  87. AcGePoint3dArray polyLine;//所有交点的数组
  88. AcGePoint2dArray polyLinexy;
  89. AcGePoint3dArray intersectPoints;//切线与某条等高线交点的数组
  90. ads_name ent;
  91. acedSSName(ss, ii, ent);
  92. AcDbObjectId objId;
  93. acdbGetObjectId(objId, ent);
  94. //使用ARX智能指针打开对象,实体类对象可以使用这种方式直接打开.
  95. AcDbObjectPointer<AcDbPolyline> pLine(objId, AcDb::kForRead);
  96. //判断是否打开成功
  97. //注意ARX智能指针使用智能指针成员函数的时候是点符号"."不是指针符号"->"
  98. if (Acad::eOk != pLine.openStatus())
  99. {
  100. //根据情况做打开失败处理
  101. acutPrintf(_T("\n(c)打开剖面线对象失败! 错误码: %s"), acadErrorStatusText(pLine.openStatus()));
  102. return;
  103. }
  104. //获取切线上的顶点
  105. AcGePoint3dArray pLineVerts;
  106. AcGePoint2d ptV;
  107. for (unsigned j = 0; j < pLine->numVerts(); j++)
  108. {
  109. pLine->getPointAt(j, ptV);
  110. pLineVerts.append(AcGePoint3d(ptV.x, ptV.y, 10000));
  111. }
  112. //设定投影面
  113. AcGePlane plane;
  114. AcDb::Planarity flag;
  115. //获得交点
  116. AcGePoint3d pt(0,0,-1000);//记录等高线标高
  117. AcDbObjectId objIdDGX;
  118. AcDbPolyline* pLineDGX = NULL;
  119. AcDb3dPolyline* pLine3dDGX = NULL;
  120. AcDb2dPolyline* pLine2dDGX = NULL;
  121. AcDbSpline* pSplineDGX = NULL;
  122. //acutPrintf(_T("\nlengthDGX: %d"), lengthDGX);
  123. for (long i = 0; i < lengthDGX; i++)
  124. {
  125. // 获得指定元素的ObjectId
  126. ads_name entDGX;
  127. acedSSName(ssDGX, i, entDGX);
  128. acdbGetObjectId(objIdDGX, entDGX);
  129. //使用ARX智能指针打开对象,实体类对象可以使用这种方式直接打开.
  130. AcDbObjectPointer<AcDbEntity> pEntDGX(objIdDGX, AcDb::kForRead);
  131. //判断是否打开成功
  132. //注意ARX智能指针使用智能指针成员函数的时候是点符号"."不是指针符号"->"
  133. if (Acad::eOk != pEntDGX.openStatus())
  134. {
  135. //根据情况做打开失败处理
  136. acutPrintf(_T("\n(c)打开等高线对象失败! 错误码: %s"), acadErrorStatusText(pEntDGX.openStatus()));
  137. continue;
  138. }
  139. //样条曲线
  140. if (pEntDGX->isKindOf(AcDbSpline::desc()))
  141. {
  142. pSplineDGX = AcDbSpline::cast(pEntDGX);
  143. if (pSplineDGX) pSplineDGX->getStartPoint(pt);
  144. }
  145. //三维多段线
  146. if (pEntDGX->isKindOf(AcDb3dPolyline::desc()))
  147. {
  148. pLine3dDGX = AcDb3dPolyline::cast(pEntDGX);
  149. if (pLine3dDGX)
  150. {
  151. AcDbObjectIterator* pItr = pLine3dDGX->vertexIterator();
  152. for (pItr->start(); !pItr->done(); pItr->step())
  153. {
  154. AcDb3dPolylineVertex* pVertex = NULL;
  155. AcDbObjectId vId = pItr->objectId();
  156. acdbOpenObject(pVertex, vId, AcDb::kForRead);
  157. pt = pVertex->position();
  158. break;
  159. }
  160. }
  161. }
  162. //二维多段线
  163. if (pEntDGX->isKindOf(AcDb2dPolyline::desc()))
  164. {
  165. pLine2dDGX = AcDb2dPolyline::cast(pEntDGX);
  166. if (pLine2dDGX)
  167. {
  168. AcDbObjectIterator* pItr = pLine2dDGX->vertexIterator();
  169. for (pItr->start(); !pItr->done(); pItr->step())
  170. {
  171. AcDb2dVertex* pVertex = NULL;
  172. AcDbObjectId vId = pItr->objectId();
  173. acdbOpenObject(pVertex, vId, AcDb::kForRead);
  174. pt = pVertex->position();
  175. break;
  176. }
  177. }
  178. }
  179. //多段线
  180. if (pEntDGX->isKindOf(AcDbPolyline::desc()))
  181. {
  182. pLineDGX = AcDbPolyline::cast(pEntDGX);
  183. if (pLineDGX)
  184. {
  185. for (unsigned j = 0; j < pLineDGX->numVerts(); j++)
  186. {
  187. pLineDGX->getPointAt(j, pt);
  188. break;
  189. }
  190. }
  191. }
  192. //if (pt.z < 0.000) continue;
  193. pLine->getPlane(plane, flag);
  194. pLine->intersectWith(pEntDGX, AcDb::kOnBothOperands, plane, intersectPoints);
  195. for (int j = 0; j < intersectPoints.length(); j++)
  196. {
  197. intersectPoints[j].z = pt.z;
  198. polyLine.append(intersectPoints[j]);
  199. }
  200. intersectPoints.removeAll();
  201. pt.set(0, 0, -1000);
  202. }
  203. //添加切线上的点
  204. polyLine.append(pLineVerts);
  205. pLineVerts.removeAll();
  206. //获取交点在切线上的投影点,计算投影点到起点的距离,并排序
  207. AcGePoint3d ptOnCurve;
  208. REAL dist;
  209. int numpt = polyLine.length();
  210. pl_pt.resize(numpt);
  211. for (int i = 0; i < numpt; i++)
  212. {
  213. pt = polyLine[i];
  214. pl_pt[i].x0 = pt.x;
  215. pl_pt[i].y0 = pt.y;
  216. pl_pt[i].z0 = pt.z;
  217. if (pLine->getClosestPointTo(pt, ptOnCurve) != Acad::eOk) return;
  218. if (pLine->getDistAtPoint(ptOnCurve, dist) != Acad::eOk) return;
  219. pl_pt[i].dist = dist;
  220. }
  221. if (numpt < 1) break;
  222. //排序
  223. InsertionSortDIST(pl_pt, numpt);
  224. REAL MINZ = pl_pt[0].z0;//三维剖面线最低点
  225. for (int i = 0; i < numpt; i++)
  226. {
  227. polyLine[i].x = pl_pt[i].x0;
  228. polyLine[i].y = pl_pt[i].y0;
  229. polyLine[i].z = pl_pt[i].z0;
  230. //查找最低点
  231. if (MINZ > pl_pt[i].z0)
  232. {
  233. MINZ = pl_pt[i].z0;
  234. }
  235. //给切线的顶点赋高程值
  236. if (pl_pt[i].z0 == 10000 && i > 0 && i < numpt - 1)
  237. {
  238. REAL dist0 = sqrt((pl_pt[i - 1].x0 - pl_pt[i].x0) * (pl_pt[i - 1].x0 - pl_pt[i].x0) +
  239. (pl_pt[i - 1].y0 - pl_pt[i].y0) * (pl_pt[i - 1].y0 - pl_pt[i].y0));
  240. REAL dist1 = sqrt((pl_pt[i + 1].x0 - pl_pt[i].x0) * (pl_pt[i + 1].x0 - pl_pt[i].x0) +
  241. (pl_pt[i + 1].y0 - pl_pt[i].y0) * (pl_pt[i + 1].y0 - pl_pt[i].y0));
  242. if (dist0 < 0.001) polyLine[i].z = pl_pt[i - 1].z0;
  243. if (dist1 < 0.001) polyLine[i].z = pl_pt[i + 1].z0;
  244. //IDW
  245. if (dist0 >= 0.001 && dist1 >= 0.001)
  246. polyLine[i].z = pl_pt[i - 1].z0 * (1 / dist0) / (1 / dist0 + 1 / dist1) + pl_pt[i + 1].z0 * (1 / dist1) / (1 / dist0 + 1 / dist1);
  247. pl_pt[i].z0 = polyLine[i].z;
  248. pl_pt[i].JTorZT = -2;
  249. }
  250. if (pl_pt[i].z0 == 10000 && i == 0)
  251. {
  252. polyLine[i].z = pl_pt[i + 1].z0;
  253. pl_pt[i].z0 = polyLine[i].z;
  254. pl_pt[i].JTorZT = 0;
  255. }
  256. if (pl_pt[i].z0 == 10000 && i == numpt - 1)
  257. {
  258. polyLine[i].z = pl_pt[i - 1].z0;
  259. pl_pt[i].z0 = polyLine[i].z;
  260. pl_pt[i].JTorZT = 0;
  261. }
  262. }
  263. //在xy平面绘制
  264. ptbaseTemp = ptbase;
  265. pl_pt[0].x = ptbaseTemp.x;//剖面线起点
  266. pl_pt[0].y = ptbaseTemp.y;//剖面线起点
  267. REAL xdist = 0;//水平距离x
  268. REAL ydist = 0;//竖直距离y
  269. AcGePoint2d ptxy;//存储二维剖面线
  270. REAL xmin, ymin, xmax, ymax;
  271. xmin = pl_pt[0].x;
  272. ymin = pl_pt[0].y;
  273. xmax = pl_pt[0].x;
  274. ymax = pl_pt[0].y;
  275. polyLinexy.append(ptbaseTemp);
  276. for (int i = 1; i < numpt; i++)
  277. {
  278. xdist += sqrt((polyLine[i].x - polyLine[i - 1].x) * (polyLine[i].x - polyLine[i - 1].x) +
  279. (polyLine[i].y - polyLine[i - 1].y) * (polyLine[i].y - polyLine[i - 1].y));
  280. ydist = polyLine[i].z - polyLine[0].z;
  281. pl_pt[i].x = xdist / nRatioX + ptbaseTemp.x;
  282. pl_pt[i].y = ydist / nRatioY + ptbaseTemp.y;
  283. if (xmin > pl_pt[i].x) xmin = pl_pt[i].x;
  284. if (ymin > pl_pt[i].y) ymin = pl_pt[i].y;
  285. if (xmax < pl_pt[i].x) xmax = pl_pt[i].x;
  286. if (ymax < pl_pt[i].y) ymax = pl_pt[i].y;
  287. }
  288. polyLine.removeAll();
  289. REAL dDeltY = ptbaseTemp.y - ymin;
  290. polyLinexy[0].y = polyLinexy[0].y + dDeltY;
  291. for (int i = 1; i < numpt; i++)
  292. {
  293. ptxy.x = pl_pt[i].x;
  294. ptxy.y = pl_pt[i].y + dDeltY;
  295. polyLinexy.append(ptxy);
  296. }
  297. ptbaseTemp.y = ptbaseTemp.y + dDeltY;
  298. //二维剖面尺寸
  299. ymax = ymax + dDeltY;
  300. ymin = ymin + dDeltY;
  301. xdist = xmax - xmin;
  302. ydist = ymax - ymin;
  303. //绘制标尺
  304. //刻度数量
  305. int num = (int)(round(ydist / delty) + 4);
  306. //acutPrintf(_T("\nnum:%d"), num);
  307. //baseZ为刻度线标尺起点高程
  308. REAL baseZ = round(MINZ / timesOfAltt) * timesOfAltt - 2 * delty;
  309. //刻度线标尺起点y坐标,与baseZ对应
  310. REAL baseY = ptbaseTemp.y - (pl_pt[0].z0 - baseZ) / nRatioY;
  311. int num0 = 0;
  312. while (true)
  313. {
  314. if ((baseY + num0 * delty) > ymax)
  315. {
  316. num = num0 + 1;
  317. break;
  318. }
  319. num0++;
  320. }
  321. AcGePoint3d ptbase3d(0, 0, 0);
  322. //“高程”
  323. ptbase3d.x = xmin - dSeparate - nWidth * 2;
  324. ptbase3d.y = baseY + (num + 0.2) * delty;
  325. ptbase3d.z = 0;
  326. CString csText = _T("高程(m)");
  327. CTextUtil::AddText(ptbase3d, csText, AcDb::kTextRight, 0.8, AcDbObjectId::kNull, 2.5, 0);
  328. //绘制 水平比例尺 竖直比例尺 文字
  329. ptbase3d.x = xmin + xdist / 2;
  330. ptbase3d.y = baseY + (num + 1.0) * delty;
  331. ptbase3d.z = 0;
  332. csText = _T("水平 1:") + CConvertUtil::ToString(nRatioX*1000, 0) + _T(" 竖直 1:") + CConvertUtil::ToString(nRatioY*1000, 0);
  333. CTextUtil::AddText(ptbase3d, csText, AcDb::kTextMid, 0.8, AcDbObjectId::kNull, 4.0, 0);
  334. //标尺矩形框
  335. AcGePoint2d pt0, pt1;
  336. pt0.x = xmin - dSeparate;
  337. pt0.y = baseY - delty;
  338. pt1.x = pt0.x - 2 * nWidth;
  339. pt1.y = baseY + num * delty;
  340. CPolylineUtil::AddRectangle(pt0, pt1, 0);
  341. //矩形框中线
  342. pt0.x = xmin - dSeparate - nWidth;
  343. pt1.x = pt0.x;
  344. pt0.y = baseY - delty;
  345. pt1.y = baseY + num * delty;
  346. CPolylineUtil::Add(pt0, pt1, 0);
  347. //竖直刻度线数量
  348. int num5 = (int)((xmax + 2 * nVW - xmin) / nVW) / 10 * 10 + 10;
  349. //刻度线及高程
  350. for (int j = 1; j < num + 1; j++)
  351. {
  352. pt0.x = xmin - dSeparate;
  353. pt0.y = baseY - delty + j * delty;
  354. pt1.x = pt0.x - 3 * nWidth;
  355. pt1.y = pt0.y;
  356. CPolylineUtil::Add(pt0, pt1, 0);
  357. REAL altitude = (pt0.y - baseY)* nRatioY + baseZ;//刻度线对应的高程
  358. //高程
  359. pt.y = pt1.y - 1.0;
  360. pt.x = pt1.x - 2.0;
  361. //绘制刻度线左侧的高程
  362. CString csral = CConvertUtil::ToString(altitude, 0);
  363. CTextUtil::AddText(pt, csral, AcDb::kTextRight, 0.8, AcDbObjectId::kNull, 2.5, 0);
  364. //绘制水平背景网格
  365. if (iBox == 1 || iBox == 3)
  366. {
  367. pt1.x = pt0.x + dSeparate + num5 * nVW;
  368. CPolylineUtil::AddPolylineWithColor(pt0, pt1, 8, 0);
  369. }
  370. }
  371. //需要填充的矩形
  372. for (int j = 0; j < num + 1; j++)
  373. {
  374. if (j % 2 == 0)
  375. {
  376. pt0.x = xmin - dSeparate;
  377. pt0.y = baseY - delty + j * delty;
  378. pt1.x = pt0.x - nWidth;
  379. pt1.y = pt0.y + delty;
  380. }
  381. else
  382. {
  383. pt0.x = xmin - dSeparate - nWidth;
  384. pt0.y = baseY - delty + j * delty;
  385. pt1.x = pt0.x - nWidth;
  386. pt1.y = pt0.y + delty;
  387. }
  388. objId = CPolylineUtil::AddRectangle(pt0, pt1, 0);
  389. loopIds.append(objId);
  390. //填充
  391. CHatchUtil::Add(loopIds, TEXT("SOLID"));
  392. loopIds.removeAll();
  393. }
  394. //底部距离标尺
  395. pt0.x = xmin - 18 - dSeparate;
  396. pt0.y = baseY - delty - dH_ad;
  397. pt1.x = xmin + (num5 + 5) * nVW;
  398. pt1.y = pt0.y;
  399. CPolylineUtil::Add(pt0, pt1, 0);
  400. //底部矩形框
  401. pt0.x = xmin - 18 - dSeparate;
  402. pt0.y = baseY - delty;
  403. pt1.x = xmin + (num5 + 5) * nVW;
  404. pt1.y = pt0.y - dH_ad * 2;
  405. CPolylineUtil::AddRectangle(pt0, pt1, 0.25);
  406. //底部标题栏竖线
  407. pt0.x = xmin- dSeparate;
  408. pt0.y = baseY - delty;
  409. pt1.x = pt0.x;
  410. pt1.y = pt0.y - dH_ad * 2;
  411. CPolylineUtil::Add(pt0, pt1, 0);
  412. //“距离(m)”
  413. csText = _T("距离(m)");
  414. pt.x = xmin - 9- dSeparate;
  415. pt.y = baseY - delty - 1.5 * dH_ad;
  416. CTextUtil::AddText(pt, csText, AcDb::kTextMid, 0.8, AcDbObjectId::kNull, 2.5, 0);
  417. //“地面高程(m)”
  418. csText = _T("地面高程(m)");
  419. pt.x = xmin - 9- dSeparate;
  420. pt.y = baseY - delty - 0.5 * dH_ad;
  421. CTextUtil::AddText(pt, csText, AcDb::kTextMid, 0.8, AcDbObjectId::kNull, 2.5, 0);
  422. //底部高程栏, 高程竖向及高程值
  423. for (int j = 0; j < numpt; j++)
  424. {
  425. pt0.x = pl_pt[j].x;
  426. pt0.y = baseY - delty;
  427. pt1.x = pl_pt[j].x;
  428. pt1.y = pt0.y - dH_ad;
  429. CPolylineUtil::Add(pt0, pt1, 0);
  430. csText = CConvertUtil::ToString(pl_pt[j].z0, 2);
  431. CTextUtil::AddText(AcGePoint3d(pt1.x, pt1.y + dH_ad/2, 0), csText, AcDb::kTextCenter, 0.8, AcDbObjectId::kNull, 1.5, PI/2);
  432. }
  433. //底部距离标尺-刻度、距离
  434. //每5个刻度标中长线,每10个刻度标长线并标距离
  435. for (int j = 0; j <= num5; j++)
  436. {
  437. pt0.x = xmin + j * nVW;
  438. pt0.y = baseY - delty - dH_ad;
  439. pt1.x = pt0.x;
  440. pt1.y = pt0.y - 1.0;
  441. CPolylineUtil::Add(pt0, pt1, 0);
  442. if (j % 5 == 0)
  443. {
  444. pt1.y = pt0.y - 2.0;
  445. CPolylineUtil::Add(pt0, pt1, 0);
  446. }
  447. if ((j % 10) == 0)
  448. {
  449. pt1.y = pt0.y - 3.0;
  450. CPolylineUtil::Add(pt0, pt1, 0);
  451. csText = CConvertUtil::ToString(j * nVW * nRatioX, 0);
  452. CTextUtil::AddText(AcGePoint3d(pt0.x, pt0.y - 5.0, 0), csText, AcDb::kTextMid, 0.8, AcDbObjectId::kNull, 2.0, 0);
  453. //绘制竖直背景网格
  454. if (iBox == 2 || iBox == 3)
  455. {
  456. pt0.y = baseY - delty;
  457. pt1.y = baseY + (num - 1) * delty;
  458. CPolylineUtil::AddPolylineWithColor(pt0, pt1, 8, 0);
  459. }
  460. }
  461. }
  462. //当切线为折线时,在剖面中折线结点处绘制竖线
  463. if (pLine->numVerts() > 1)
  464. {
  465. for (unsigned j = 3; j < numpt; j++)
  466. {
  467. if (pl_pt[j].JTorZT == -2)
  468. {
  469. pt0.x = pl_pt[j].x;
  470. pt0.y = pl_pt[j].y + dDeltY + ydist / 6;
  471. pt1.x = pt0.x;
  472. pt1.y = pl_pt[j].y + dDeltY - ydist / 6;
  473. CPolylineUtil::Add(pt0, pt1, 0);
  474. }
  475. }
  476. }
  477. //绘制二维剖面线
  478. Adesk::UInt16 color = 3;
  479. AcDbObjectId polyId = CPolylineUtil::Add(polyLinexy, color, 0);
  480. for (unsigned j = 0; j < polyLinexy.length(); j++)
  481. {
  482. fout << ii << "\t" << polyLinexy[j].x - polyLinexy[0].x << "\t" << pl_pt[j].z0 << endl;
  483. }
  484. //确定下一个剖面基点坐标
  485. if (bSetV)
  486. {
  487. ptbase.y += ydist + 100;//竖向放置剖面
  488. }
  489. else
  490. {
  491. ptbase.x += xdist + 100;//横向放置剖面
  492. }
  493. pl_pt.clear();
  494. #if ACADV_RELMAJOR > 18
  495. pl_pt.shrink_to_fit();
  496. #endif
  497. polyLinexy.removeAll();
  498. }
  499. fout.close();
  500. ShellExecute(NULL, _T("open"), fn, NULL, NULL, SW_SHOWNORMAL);
  501. // 释放内存
  502. acedSSFree(ss); // 删除选择集
  503. // 释放内存
  504. acedSSFree(ssDGX); // 删除选择集
  505. // 还原状态栏之前的样子
  506. //acedRestoreStatusBar();
  507. }

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/不正经/article/detail/114349
推荐阅读
相关标签
  

闽ICP备14008679号