Lee Mac 发表于 2022-7-6 11:47:07

这是Alan对空用户输入进行测试的方法,它的作用是当AND语句到达返回nil的表达式时,它将停止计算表达式。但我不喜欢整个程序中的这种结构。

ready2goriding 发表于 2022-7-6 11:52:47

 
 
我明白了,谢谢。我想那不是我的问题!英雄联盟

fixo 发表于 2022-7-6 11:55:17

我不明白你到底需要什么
只是一个快速代码:

(defun c:ofc (/ ang cp1 cp2 en1 en2 ent1 ent2 obj1 obj2 tp1 tp2 up1 up2)

(setq ent1 (entsel "\nSelect first line : ")
ent2 (entsel "\nSelect second line : ")
en1 (car ent1)
en2 (car ent2)
obj1 (vlax-ename->vla-object en1)
obj2 (vlax-ename->vla-object en2)
cp1 (vlax-curve-getclosestpointto obj1
      (vlax-curve-getpointatparam obj1
(/ (- (vlax-curve-getendparam obj1)(vlax-curve-getstartparam obj1)) 2)))
cp2 (vlax-curve-getclosestpointto obj2 cp1)
ang (angle cp1 (vlax-curve-getstartpoint obj1))
up1 (polar cp1 ang 2);<-- 2 is offset distance
up2 (polar cp1 (+ pi ang) 2)
tp1 (polar cp2 ang 2)
tp2 (polar cp2 (+ pi ang) 2)
)
(command "._line" "_non" up1 "_non" tp1 ""
   "._line" "_non" up2 "_non" tp2 ""
)
(princ)
)
(vl-load-com)
(princ "\n   ***Start command with OFC to excute   ***")
(prin1)

但在这种情况下,您只添加了一张附加支票。无论哪种方式都需要。

ready2goriding 发表于 2022-7-6 11:56:39

我以为那会结束零分?

alanjt 发表于 2022-7-6 12:00:58

我不确定您在说什么-princ不在AND语句中,当在没有字符串或文件描述符的情况下调用时,将返回空符号(“”)。

ready2goriding 发表于 2022-7-6 12:04:08

我很抱歉。混淆了“干净地退出”和“nill”。
我真傻。。。到目前为止,我在这个学习曲线上真的很傻。

Lee Mac 发表于 2022-7-6 12:06:53

 
 
有没有可能发布一个类似的“move”命令示例,或者将我指向包含该命令的例程?我在这个命令上一点运气都没有,似乎找不到任何例子。。。我讨厌成为新手——尽管如此!
谢谢,道格

ready2goriding 发表于 2022-7-6 12:11:04

这是一个使用Move的非常简单的代码——显然,这段代码是多余的,与Move命令相比没有优势,但它只是一个示例。
 
(if (and the 3 prompts) (offset))

ready2goriding 发表于 2022-7-6 12:13:03

Lee Mac 发表于 2022-7-6 12:16:09

A very simple code using Move - obviously this code is redundant, with no advantage over the move command, but it serves as an example.
 

(defun c:test ( / ss p1 p2 )(if (and (setq ss (ssget "_:L"))          (setq p1 (getpoint "\nSpecify Base Point: "))          (setq p2 (getpoint "\nSpecify Next Point: " p1)))      (command "_.move" ss "" p1 p2))(princ))
页: 1 [2]
查看完整版本: Lisp中的偏移、修剪命令