乐筑天下

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

[编程交流] 如何在p上迭代点

[复制链接]

95

主题

477

帖子

383

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
475
发表于 2022-7-5 18:52:42 | 显示全部楼层
hanhphuc你是对的,可能有两个答案:2d和3d max。
回复

使用道具 举报

106

主题

1万

帖子

101

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1299
发表于 2022-7-5 18:56:39 | 显示全部楼层
这就是我的代码所在。您可以看到,我只对pt2使用了vlax曲线getClosestPointto。然而,这实际上并不总是给出垂直点,因为它考虑了包括z值在内的距离。
[code](defun c:maxheight(/*error*maxdist ss1 ss2 pt3 pt4)(defun*error*(msg)(if(not(member msg)(“Function cancelled”“quit/exit abort”))(princ(strcat”\error:“msg”))(princ))(if(and(和(setq ss1(LM:ssget“\n选择第一条三维多段线/要素线:”(“+:E:S”((0。“多段线,AECC\u要素线”))))(setq ss2(LM:ssget)“\n选择第二条三维多段线/要素线:”(“+:E:S”((0。“Polyline,AECC\u Feature\u Line”))))(progn(maxheight:mainprogram)(maxheight:ans)))(princ));;;这是代码的答案部分(defun maxheight:ans()(initget“Yes No”)(setq*maxheightans*(cond((getkword(strcat“\n在最大高度位置绘制一行[Yes/No]:”))(*maxheightans*))(if(=*maxheightans*“Yes”)(progn(命令“.u line”pt3 pt4”“)(命令“.u zoom”“\u W”pt3 pt4))(警报(strcat)“\n实体之间的最大垂直距离为:”(rtos maxdist 2 2)))(princ(strcat“\n实体之间的最大垂直距离为:”(rtos maxdist 2 2)));;;主代码部分(defun maxheight:mainprogram(/ent1 ent2 len delta pt1 pt2 z1 z2 maxdist1)(setq ent1(vlax ename->vla object(ssname ss1 0))ent2(vlax ename->vla object(ssname ss2 0))delta 0.0maxdist 0.0)(如果(
回复

使用道具 举报

5

主题

956

帖子

963

银币

初来乍到

Rank: 1

铜币
35
发表于 2022-7-5 18:58:20 | 显示全部楼层
回复

使用道具 举报

106

主题

1万

帖子

101

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1299
发表于 2022-7-5 19:02:18 | 显示全部楼层
hanhphuc you are right maybe two answers 2d & 3d max.
回复

使用道具 举报

95

主题

477

帖子

383

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
475
发表于 2022-7-5 19:05:56 | 显示全部楼层
So this is where my code is at now. You can see that I just use the vlax-curve-getClosestPointto for pt2. However, this doesn't actually always give the perpendicular point because it takes into the account the distance including the z value.
[code](defun c:maxheight (/ *error* maxdist ss1 ss2 pt3 pt4) (defun *error* (msg)   (if (not  (member msg '("Function cancelled" "quit / exit abort")))     (princ (strcat "\nError: " msg))   )   (princ) ) (if (and (setq ss1   (LM:ssget "\nSelect 1st 3D Polyline/Feature Line: "      '("_+.:E:S" ((0 . "POLYLINE,AECC_FEATURE_LINE")))   )   )   (setq ss2   (LM:ssget "\nSelect 2nd 3D Polyline/Feature Line: "      '("_+.:E:S" ((0 . "POLYLINE,AECC_FEATURE_LINE")))   )   )     )   (progn     (maxheight:mainprogram)     (maxheight:ans)     ) ) (princ));;;This is the answer portion of the code(defun maxheight:ans () (initget "Yes No") (setq *maxheightans* (cond   (    (getkword      (strcat "\nDraw a line at max height location [Yes/No] : "      )    )   )   (*maxheightans*) ) ) (if (= *maxheightans* "Yes")   (progn     (command "._line" pt3 pt4 "")     (command "._zoom" "_W" pt3 pt4)   ) ) (alert(strcat  "\nThe maximum vertical distance between the entities is: "  (rtos maxdist 2 2))     ) (princ(strcat  "\nThe maximum vertical distance between the entities is: "  (rtos maxdist 2 2))     ));;;Main code portion(defun maxheight:mainprogram (/ ent1 ent2 len delta pt1 pt2 z1 z2 maxdist1) (setq ent1 (vlax-ename->vla-object (ssname ss1 0))ent2 (vlax-ename->vla-object (ssname ss2 0))delta 0.0maxdist 0.0 ) (if (
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-13 01:01 , Processed in 0.672679 second(s), 60 queries .

© 2020-2025 乐筑天下

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