明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 7755|回复: 119

[源码] 斜坡线绘制

    [复制链接]
发表于 2015-5-16 09:58 | 显示全部楼层 |阅读模式
看见有人求画斜坡线的, 非此专业,不懂,但记得曾经收集过此类程序
因为分享出来,仅此而已,不懂勿问,不喜勿喷。


  1. (defun C:SLOPE-LINE (/ Talud_boven  Talud_onder afstand afstand_totaal count p1 p2 kleur)

  2.   (defun IS-ON-PL? (ENAME PKT /)
  3.     (vl-catch-all-apply
  4.       'vlax-curve-getdistatpoint
  5.       (list
  6.         ENAME
  7.         PKT
  8.         ) ;_ end of list
  9.       ) ;_ end of vlax-curve-getDistAtPoint
  10.     PKT
  11.     ) ;_ end defun

  12. (vl-load-com)


  13.   (if (and (setq Talud_boven (car (entsel "\nSelect Top slope: ")))
  14.            (setq Talud_onder (car (entsel "\nSelect Bottom slope: ")))
  15.            (setq afstand (getint "\nLine slope distance:"))
  16.            (setq kleur (acad_colordlg 8))
  17.            ) ;_ end of and
  18.    
  19.     (progn
  20.       (setq afstand_totaal 0)
  21.       (setq count 0)
  22.       (setq p1 (vlax-curve-getStartPoint
  23.                  (vlax-ename->vla-object Talud_boven)
  24.                  ) ;_ end of vlax-curve-getStartPoint
  25.             ) ;_ end of setq
  26.       (while p1
  27.         (if (equal (/ count 2.0) (fix (/ count 2.0)) 0.001)
  28.           (setq p2
  29.                  (vlax-curve-getClosestPointTo
  30.                    (vlax-ename->vla-object Talud_onder)
  31.                    p1
  32.                    ) ;_ end of vlax-curve-getClosestPointTo
  33.                 ) ;_ end of setq
  34.           (setq
  35.             p2 (MAPCAR '(LAMBDA (x) (/ x 2))
  36.                        (MAPCAR '+
  37.                                p1
  38.                                (vlax-curve-getClosestPointTo
  39.                                  (vlax-ename->vla-object Talud_onder)
  40.                                  p1
  41.                                  ) ;_ end of vlax-curve-getClosestPointTo
  42.                                ) ;_ end of MAPCAR
  43.                        ) ;_ end of MAPCAR
  44.             ) ;_ end of setq
  45.           ) ;_ end of if
  46.         (entmake
  47.           (list '(0 . "LINE")
  48.                 (cons 10 p1)
  49.                 (cons 11 p2)
  50.                 ;'(62 . 1) ; standaard kleur
  51.                 (cons 62 kleur) ; kleur dia dialog instellen

  52.           ) ;_ end of list
  53.         ) ;_ end of entmake
  54.         (if
  55.           (setq p1 (IS-ON-PL?
  56.                      (vlax-ename->vla-object Talud_boven)
  57.                      (vlax-curve-getpointatdist
  58.                        (vlax-ename->vla-object Talud_boven)
  59.                        (setq afstand_totaal (+ afstand_totaal afstand))
  60.                        ) ;_ end of vlax-curve-getpointatdist
  61.                      ) ;_ end of IS-ON-PL?
  62.                 ) ;_ end of setq
  63.            p1
  64.            ) ;_ end of if
  65.         (setq count (1+ count))
  66.         ) ;_ end of while
  67.       ) ;_ end of progn
  68.     ) ;_ end of if
  69.   ) ;_ end of defun



本帖子中包含更多资源

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

x

评分

参与人数 4明经币 +3 金钱 +40 收起 理由
stoneball + 1 很给力!
zf9568 + 1 + 20 很给力!
lawrence + 20 很给力!
zcmfk + 1 很给力!

查看全部评分

"觉得好,就打赏"
还没有人打赏,支持一下

本帖被以下淘专辑推荐:

发表于 2019-7-26 14:49 | 显示全部楼层
学习学习!多谢楼主!!
发表于 2015-5-16 10:24 | 显示全部楼层
看似很神奇
发表于 2015-5-16 10:29 | 显示全部楼层
感谢 lucas_3333 分享程序!
 楼主| 发表于 2015-5-16 10:40 | 显示全部楼层
本帖最后由 lucas_3333 于 2015-5-16 10:41 编辑
yoyoho 发表于 2015-5-16 10:29
感谢 lucas_3333 分享程序!

只要有源码的地方就有你的身影,不论是哪行哪业
你是专业收集源码的吗?
为何不分享一些出来? 箱子沉了,背着累!
发表于 2015-5-16 10:48 | 显示全部楼层
好东西哦,回复学习学习
发表于 2015-5-16 12:09 | 显示全部楼层
这个是示坡线
发表于 2015-5-16 13:56 | 显示全部楼层
斜坡线绘制....
发表于 2015-5-16 14:25 | 显示全部楼层
好像见过,感谢 lucas_3333 分享
发表于 2015-5-16 16:15 | 显示全部楼层

谢谢分享程序。
发表于 2015-5-16 17:55 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-4-18 13:38 , Processed in 0.185687 second(s), 35 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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