samifox 发表于 2022-7-5 23:51:03

朝着per中的一条线投影

你好
 
我的问题是这样的:
 
在我的脚本中的一些点中,lisp生成一条线,然后我要求用户在特定位置设置一个点,该点必须以垂直角度向该线投影,然后在相交点上执行打断。
 
我不知道该怎么做,也不知道这是否可能
 
见附件
 
提前感谢
谢伊

MSasu 发表于 2022-7-6 00:02:51

请检查vlax curve getClosestPointTo函数;从一点到一条直线的最短距离是其在所述直线(垂线)上的投影。

pBe 发表于 2022-7-6 00:15:05

(defun c:demo ()
(command "_.line" "\\" "\\" "")
(setq lin (entlast))
(command "_point" "\\")
(setq p (vlax-curve-getClosestPointTo lin (getvar 'lastpoint)))
(command "_break"
   lin
   "_non"
   (setq p (vlax-curve-getClosestPointTo lin (getvar 'lastpoint)))
   "_non"
   p
)
)
 
编辑:哎呀。Msasu打败了我,试试演示代码

samifox 发表于 2022-7-6 00:22:47

非常感谢。
什么是“\\”?(现在不能执行)

samifox 发表于 2022-7-6 00:27:25

我认为“最后一点”有一个问题

samifox 发表于 2022-7-6 00:41:46

im使用cad 2010
 
它的“最后一点”是有效的
 
再次感谢
谢伊

Tharwat 发表于 2022-7-6 00:50:21

将其替换为暂停,然后重试。

samifox 发表于 2022-7-6 00:56:36

 
我懂了
thanx公司
页: [1]
查看完整版本: 朝着per中的一条线投影