MSasu 发表于 2022-7-5 23:57:08

CHPROP命令必须在每条绘制线之后调用;你把那句话放错了(两处)。还有一个右括号漏掉了。不要忘记定位所有变量以避免干扰。
(defun c:TEST1 ( / a1 klim per s1 s2 scl )
(if (not (tblsearch "LAYER" "DASHDOT"))
(command "_layer" "_m" "DASHDOT" "_c" "1" "" "")
)
(setq scl (getvar "useri1"))
(setq klim (* 0.0017 scl))
(comamnd "_CHPROP""" "_S" klim "")
(SETQ PER "DASHDOT" )
(command"_linetype" "_s" per "" )
(command "_CHPROP" (entlast) "" "_S" klim "")
(print "draw DASHDOT line ")
(print "")
(setq s1 (getpoint "give the first point :"))
(print "")
(WHILE (setq s2 (getpoint s1 " give the second point :"))
(print "")
(command "_line" "non" s1 "non" s2 "")
(command "_CHPROP" (entlast) "" "_S" klim "")
(setq s1 s2)
)
)
请注意代码的格式,因为这样会更容易阅读。

prodromosm 发表于 2022-7-6 00:01:09

谢谢MSasu。干得好

MSasu 发表于 2022-7-6 00:03:25

不客气!
请告诉我,你为什么用这句话?
(print "")
让下一个提示器出现在新的线路上?然后可能需要考虑使用新行字符:
(setq s1 (getpoint "\ngive the first point :"))

prodromosm 发表于 2022-7-6 00:09:02

我有一个问题。当我使用这个lisp时,创建一个名为DASHDOT的图层,并用线型DASHDOT绘制一条线,但bylayer线型是连续的。我希望图层的线型是DASHDOT。我该怎么做?
 

(defun c:TEST1 ( / a1 klim per s1 s2 scl )
(if (not (tblsearch "LAYER" "DASHDOT"))
(command "_layer" "_m" "DASHDOT" "_c" "1" "" "")
)
(setq scl (getvar "useri1"))
(setq klim (* 0.0017 scl))
(SETQ PER "DASHDOT" )
(command"_linetype" "_s" per "" )
(print "draw DASHDOT line ")
(print "")
(setq s1 (getpoint "give the first point :"))
(print "")
(WHILE (setq s2 (getpoint s1 " give the second point :"))
(print "")
(command "_line" "non" s1 "non" s2 "")
(command "_CHPROP" (entlast) "" "_S" klim "")
(setq s1 s2)
)
)

 
谢谢

hmsilva 发表于 2022-7-6 00:10:57


(command "_.layer" "_m" "DASHDOT" "_c" "1" "" "LT" "DASHDOT" "" "")

 
HTH公司
亨里克

prodromosm 发表于 2022-7-6 00:14:29

谢谢你hmsilva

hmsilva 发表于 2022-7-6 00:17:10

不客气prodromosm

ROBP 发表于 2022-7-6 00:22:24

 
当cad中已经包含一个简单的虚线点时,为什么要使用lisp呢
*点划线,点划线__
A.5,-.25,0,-.25
*虚线点2,虚线点(.5x)_。_。_。_。_。_。_。_。_。_。_。_。_。
A.25,-.125,0,-.125
*虚线点x2,虚线点(2x)______________________
A、 1.0,-。5,0,-.5.
 
与往常一样,默认情况下ltscale=1。
 
在图纸空间中,除非变大(重新生成后),否则应该可以,然后返回以将比例设置为较小应该可以。
 
我真的不明白为什么lisp会这么麻烦,而不是使用规则1保持简单,并使用cad中已经存在的默认值。
 
我想人们喜欢把事情复杂化。接下来我们将看到的是运行lisp打开cad并访问论坛帖子
页: 1 [2]
查看完整版本: 有关线型和的litle帮助