明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 13651|回复: 75

123

  [复制链接]
发表于 2012-3-28 11:23:03 | 显示全部楼层 |阅读模式
本帖最后由 CTC 于 2012-9-24 19:16 编辑

123                  

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

x
 楼主| 发表于 2012-3-28 18:17:41 来自手机 | 显示全部楼层
沉得好快,顶起
发表于 2012-3-28 20:52:00 | 显示全部楼层
CTC 发表于 2012-3-28 18:17
沉得好快,顶起

参见11楼
http://bbs.mjtd.com/forum.php?mo ... mp;page=2#pid510267

点评

CTC
之前问题可能未表述清楚,现已更新,请Gu_xl 版主关注下。谢谢  发表于 2012-3-29 00:29
 楼主| 发表于 2012-3-28 21:02:09 | 显示全部楼层
Gu_xl 发表于 2012-3-28 20:52
参见11楼
http://bbs.mjtd.com/forum.php?mod=viewthread&tid=92355&page=2#pid510267

谢谢GU_xl大哥,我想找一个是框选图形,然后转为对应方向的轴测视图,我的那些图是没有画三维立体的,都是平面二维图。
发表于 2012-3-29 00:00:51 | 显示全部楼层
道理一样呀,

点评

CTC
之前问题可能未表述清楚,现已更新,请大师关注下。谢谢  发表于 2012-3-29 00:28
 楼主| 发表于 2012-3-29 00:06:44 | 显示全部楼层
cable2004 发表于 2012-3-29 00:00
道理一样呀,

cable2004 大师也是深夜不眠呀。。。我这些图全部是在二维平面上的,我那原图是二维线来的,不是三维的。
发表于 2012-3-29 09:54:04 | 显示全部楼层
以前研究过透视图,给你作为参考。

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

x
 楼主| 发表于 2012-3-29 12:35:55 | 显示全部楼层
langjs 发表于 2012-3-29 09:54
以前研究过透视图,给你作为参考。

又是朗哥出手,出手都非同凡响呀。程序都非常完美,透视图转角可转为30.-30度,相当于主视,左视,请朗哥帮我加一个可转为俯视的。
发表于 2012-3-29 15:18:23 | 显示全部楼层
本帖最后由 Gu_xl 于 2012-3-29 21:51 编辑
CTC 发表于 2012-3-29 12:35
又是朗哥出手,出手都非同凡响呀。程序都非常完美,透视图转角可转为30.-30度,相当于主视,左视,请朗哥 ...

试试这个
主程序核心源码,仅供参考,部分自定义函数未打包,附件有VLX可供使用
  1. ;;c:ZDZCT 正等轴测图
  2. (defun c:ZDZCT (/ TRANSPOINT TRANSENTITY SS POS BOX OFFSET ORIGN _Type obj)
  3.   ;;转换透视点,参数 pt = 要转换的点 orign = 要转换的点的坐标基点
  4.   ;;                 pos = 轴测图的基点
  5.   ;;                 _Type = 1 主视图绘制 2 = 左视图绘制 3 = 俯视图绘制
  6.   (defun transpoint (pt orign pos _Type / p x y)
  7.     (cond ((= _Type 1) ;_ 主视图
  8.     (setq p (mapcar 'abs (mapcar '- orign pt)) ;_ orign坐标系
  9.    x (car p)
  10.    y (cadr p)
  11.    )
  12.     (polar (polar pos (+ pi (/ pi 6)) x) pi2 y)
  13.     )
  14.    ((= _Type 2) ;_ 左视图
  15.     (setq p (mapcar 'abs (mapcar '- orign pt)) ;_ orign坐标系
  16.    x (car p)
  17.    y (cadr p)
  18.    )
  19.     (polar (polar pos (- 2pi (/ pi 6)) x) pi2 y)
  20.     )
  21.    ((= _Type 3) ;_ 俯视图
  22.     (setq p (mapcar 'abs (mapcar '- orign pt)) ;_ orign坐标系
  23.    x (car p)
  24.    y (cadr p)
  25.    )
  26.     (polar (polar pos (+ pi (/ pi 6)) x) (- 2pi (/ pi 6)) y)
  27.     )
  28.    )
  29.     )
  30.   ;;转换对象
  31.   (defun transEntity (ENT ORIGN POS _TYPE / ENL RADIUSRATIO P1 P2 P3 P4 OBJ)
  32.     (vla-copy (vlax-ename->vla-object ent))
  33.     (setq ent (entlast))
  34.     (cond ((= "LINE" (gxl-dxf ent 0))
  35.     (setq enl (entget ent))
  36.     (setq enl (mapcar '(lambda (x)
  37.     (if (or (= 10 (car x))
  38.      (= 11 (car x))
  39.      )
  40.       (cons (car x) (transpoint (cdr x) orign pos _Type))
  41.       x
  42.       )
  43.     )
  44.         enl
  45.         )
  46.    )
  47.     (entmod enl)
  48.     )
  49.    ((= "LWPOLYLINE" (gxl-dxf ent 0))
  50.     (setq enl (entget ent))
  51.     (setq enl (mapcar '(lambda (x / i)
  52.     (if (= 10 (setq i (car x)))
  53.       (cons i (transpoint (cdr x) orign pos _Type))
  54.       x
  55.       )
  56.     )
  57.         enl
  58.         )
  59.    )
  60.     (entmod enl)
  61.     )
  62.    ;;圆弧拟合
  63.    ((or (= "CIRCLE" (gxl-dxf ent 0))(= "ARC" (gxl-dxf ent 0))(= "ELLIPSE" (gxl-dxf ent 0)))
  64.     (setq pl (Gxl-DivdeCurve ent (setq P1 (vlax-curve-getStartPoint ent)) (setq P2 (vlax-curve-getEndPoint ent)) t 40))
  65.     (setq pl (mapcar '(lambda (x) (transpoint x orign pos _Type)) (append (list p1) pl (list p2))))
  66.     (if (equal (car pl) (cadr pl) 1e-6) (setq pl (cdr pl)))
  67.     (setq pl (reverse pl))
  68.     (if (equal (car pl) (cadr pl) 1e-6) (setq pl (cdr pl)))
  69.     (setq pl (reverse pl))
  70.     (entdel ent)
  71.     (vl-cmdf "_pline" (car pl) "A")
  72.     (setq pl (cdr pl))
  73.     (while pl
  74.       (vl-cmdf "s" (car pl) (cadr pl))
  75.       (setq pl (cddr pl))
  76.       )
  77.      (vl-cmdf "")
  78.     )
  79.    ((= "DIMENSION" (GXL-DXF ent 0))
  80.     (setq enl (entget ent))
  81.     (setq enl (mapcar '(lambda (x / i)
  82.     (if (or (= 10 (setq i (car x))) (= 11 i) (= 13 i) (= 14 i) (= 15 i))
  83.       (cons i (transpoint (cdr x) orign pos _Type))
  84.       x
  85.       )
  86.     )
  87.         enl
  88.         )
  89.    )
  90.     (entmod enl)
  91.     )
  92.    
  93.    )
  94.     )
  95.   (setierr)
  96.   (princ "\n选择等轴测图物体:")
  97.   (setq ss (ssget '((0 . "*line,circle,arc,ELLIPSE,DIMENSION"))))
  98.   (if ss
  99.     (progn
  100.       (while (not (setq pos (getpoint "\n摆放位置:"))))
  101.       ;;选择集包围框 列表中四个点[<左下角点> <右下角点> <右上角点> <左上角点>]
  102.       (setq box (gxl-GET-PointList-4pt (GXL-GETSSBOX ss)))
  103.       (setq offset (* 0.2 (distance (car box) (caddr box))))
  104.       (setq obj (GXL-AX:ADDLINE *MODEL-SPACE* pos (polar pos pi2 (* 7 offset))))
  105.       (vla-put-color obj 1)
  106.       (setq obj (GXL-AX:ADDLINE *MODEL-SPACE* pos (polar pos (- 2pi (/ pi 6)) (* 7 offset))))
  107.       (vla-put-color obj 1)
  108.       (setq obj (GXL-AX:ADDLINE *MODEL-SPACE* pos (polar pos (+ pi (/ pi 6)) (* 7 offset))))
  109.       (vla-put-color obj 1)
  110.       ;;主视图绘制 _Type = 1
  111.       (setq _Type 1)
  112.       ;;右下角为原点
  113.       (setq orign (polar (polar (cadr box) 0 offset) 3pi2 offset))
  114.       (gxl-sel-mapcar ss '(lambda (X) (transEntity x orign pos _Type)))
  115.       ;;左视图绘制 _Type = 2
  116.       (setq _Type 2)
  117.       ;;左下角为原点
  118.       (setq orign (polar (polar (car box) pi offset) 3pi2 offset))
  119.       (gxl-sel-mapcar ss '(lambda (X) (transEntity x orign pos _Type)))
  120.       ;;府视图绘制 _Type = 3
  121.       (setq _Type 3)
  122.       ;;右上角为原点
  123.       (setq orign (polar (polar (caddr box) 0 offset) pi2 offset))
  124.       (gxl-sel-mapcar ss '(lambda (X) (transEntity x orign pos _Type)))
  125.       )
  126.     )
  127.   (reerr)
  128.   (princ)
  129.   )

更新附件:

不带坐标系:



本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

x
发表于 2012-3-29 15:55:18 | 显示全部楼层
CTC 发表于 2012-3-29 12:35
又是朗哥出手,出手都非同凡响呀。程序都非常完美,透视图转角可转为30.-30度,相当于主视,左视,请朗哥 ...

我的程序记得好像是可以转化线和尺寸以及文字的,时间长不记得了。尺寸和文字方向不合适可以用修改命令修改。水平有限程序写的罗嗦,工作中用的少我不想再研究这个了,俯视图就不编了
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2026-1-21 04:32 , Processed in 0.258668 second(s), 36 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表