乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
查看: 90|回复: 6

[编程交流] 标记相交距离

[复制链接]

20

主题

62

帖子

42

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
100
发表于 2022-7-5 22:32:01 | 显示全部楼层 |阅读模式
大家好。我有两条长度相同的多段线。一条多段线包含任意距离的交点。我需要用相同的相交距离标记另一条多段线。。
回复

使用道具 举报

5

主题

1334

帖子

1410

银币

限制会员

铜币
-20
发表于 2022-7-5 22:51:17 | 显示全部楼层
 
“一条多段线包含一些交点”的确切含义是什么?你认为ab顶点。。。请澄清。。。
回复

使用道具 举报

20

主题

62

帖子

42

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
100
发表于 2022-7-5 22:56:18 | 显示全部楼层
请看附件
样品图纸
回复

使用道具 举报

5

主题

956

帖子

963

银币

初来乍到

Rank: 1

铜币
35
发表于 2022-7-5 23:06:53 | 显示全部楼层
http://www.lee-mac.com/intersectionfunctions.html
HTH公司
回复

使用道具 举报

5

主题

1334

帖子

1410

银币

限制会员

铜币
-20
发表于 2022-7-5 23:21:34 | 显示全部楼层
试试这个:
 
  1. (defun c:mark_intersections_of_1st_curve_on_2nd ( / unique g3 c1 c2 ss i ent p pl d dl pn pnl )
  2. (vl-load-com)
  3. (defun unique ( l ) (if l (cons (car l) (unique (vl-remove (car l) (cdr l))))))
  4. (defun g3 ( l ) (if l (cons (list (car l) (cadr l) (caddr l)) (g3 (cdddr l)))))
  5. (setq c1 (car (entsel "\nPick first curve that has intersections")))
  6. (while (vl-catch-all-error-p (vl-catch-all-apply 'vlax-curve-getstartparam (list c1)))
  7.    (prompt "\nPicked entity don't belong to curves... Try again...")
  8.    (setq c1 (car (entsel "\nPick first curve that has intersections")))
  9. )
  10. (setq ss (ssget "_X"))
  11. (setq c2 (car (entsel "\nPick second curve that should be marked with intersections of first curve")))
  12. (while (vl-catch-all-error-p (vl-catch-all-apply 'vlax-curve-getstartparam (list c2)))
  13.    (prompt "\nPicked entity don't belong to curves... Try again...")
  14.    (setq c2 (car (entsel "\nPick second curve that should be marked with intersections of first curve")))
  15. )
  16. (setq i -1)
  17. (while (setq ent (ssname ss (setq i (1+ i))))
  18.    (if (vl-catch-all-error-p (vl-catch-all-apply 'vlax-curve-getstartparam (list ent)))
  19.      (ssdel ent ss)
  20.    )
  21. )
  22. (ssdel c1 ss)
  23. (ssdel c2 ss)
  24. (setq i -1)
  25. (while (setq ent (ssname ss (setq i (1+ i))))
  26.    (if (setq p (vlax-invoke (vlax-ename->vla-object c1) 'intersectwith (vlax-ename->vla-object ent) acextendnone))
  27.      (foreach p (g3 p)
  28.        (setq pl (cons p pl))
  29.      )
  30.    )
  31. )
  32. (setq pl (unique pl))
  33. (foreach p pl
  34.    (setq d (vlax-curve-getdistatpoint c1 p))
  35.    (setq dl (cons d dl))
  36. )
  37. (foreach d dl
  38.    (setq pn (vlax-curve-getpointatdist c2 d))
  39.    (setq pnl (cons pn pnl))
  40. )
  41. (foreach pn pnl
  42.    (entmake (list '(0 . "POINT") (cons 10 pn)))
  43. )
  44. (if (not (member (vlax-curve-getstartpoint c2) pnl))
  45.    (entmake (list '(0 . "POINT") (cons 10 (vlax-curve-getstartpoint c2))))
  46. )
  47. (if (not (member (vlax-curve-getendpoint c2) pnl))
  48.    (entmake (list '(0 . "POINT") (cons 10 (vlax-curve-getendpoint c2))))
  49. )
  50. (princ)
  51. )
  52. (defun c:mi1st2nd nil (c:mark_intersections_of_1st_curve_on_2nd))

 
HTH,M.R。
回复

使用道具 举报

20

主题

62

帖子

42

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
100
发表于 2022-7-5 23:25:43 | 显示全部楼层
感谢您的程序,但我收到了以下错误:------
错误:功能错误:
vlax曲线getStartParam
 
我正在使用Autocad 2010。。。
回复

使用道具 举报

5

主题

1334

帖子

1410

银币

限制会员

铜币
-20
发表于 2022-7-5 23:39:22 | 显示全部楼层
上面写着你用的是2012年。。。你在2012年测试过代码吗。。。在我的A2008上网本上,它运行良好。。。目前我正在度假,我无法复制你的错误。。。注意,我包括了支持vlisp扩展的线路(vl load com),其中还有(vlax curve getstartparam)。。。当测试上面发布的代码时,是否有人有相同的错误?如果是,请回复。。。我只是不知道问题出在哪里。。。
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-3-11 06:09 , Processed in 1.848998 second(s), 66 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表