乐筑天下

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

[编程交流] AutoLISP - Adding linetype & l

[复制链接]

1

主题

7

帖子

6

银币

初来乍到

Rank: 1

铜币
5
发表于 2022-7-5 22:37:46 | 显示全部楼层 |阅读模式
Hi Guys,
 
I'm creating a layer setting pull down menu, in order to migrate my cad to revit I would like to define the linewight. So far I managed to create a command with a dashed line:
 
(defun c:layA-SEC-LIH-005()
               (command "layer" "m" "A-SEC-LIH-005""C" "magenta" "" "l""DASHED2" "" "")


and another one with the lineweight  

 
(defun c:layA-SEC-LIH-005()
               (command "layer" "m" "A-SEC-LIH-005""C" "magenta" "" "_LW" 0.10"" "")


but I haven't been able to create one that combines the 2 of them.. any help?

Cheers

Roberto
回复

使用道具 举报

23

主题

132

帖子

112

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
114
发表于 2022-7-5 22:44:17 | 显示全部楼层
not sure why u couldn't get it to work, but after entering the linetype, instead of exiting the command continue by giving the lineweight.
(defun c:layA-SEC-LIH-005 ()
 
               (command "_-layer" "_m" "A-SEC-LIH-005" "_C" "magenta" "" "_l" "DASHED2" "_LW" "0.10" ""  "" "")
)
回复

使用道具 举报

1

主题

7

帖子

6

银币

初来乍到

Rank: 1

铜币
5
发表于 2022-7-5 22:46:49 | 显示全部楼层
Hi feargt,
 
Still doesn't work, I get a prompt asking to "Enter and option" [? Make Set New Rename ON OFF Color LType LWeight Transparency MAterial Plot Freeze Thaw LOck Unlock state Description rEconcile]:
 
Doesn't work for you if you use the pull down menu?
回复

使用道具 举报

23

主题

132

帖子

112

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
114
发表于 2022-7-5 22:52:21 | 显示全部楼层
copy this direct on to the command line
(command "_-layer" "_m" "A-SEC-LIH-005" "_C" "magenta" "" "_l" "DASHED2" "_LW" "0.10" ""  "" "")
and see does it work. it works for me.
if it does not work, press f2 and copy the text out so I can see where it stops working for you
回复

使用道具 举报

1

主题

7

帖子

6

银币

初来乍到

Rank: 1

铜币
5
发表于 2022-7-5 22:55:34 | 显示全部楼层
as requested.. btw.. thanks for helping
 
 
Command: (command "_-layer" "_m" "A-SEC-LIH-005" "_C" "magenta" "" "_l" "DASHED2" "_LW" "0.10" "" "" "")
_-layer
Current layer:  "0"
Enter an option [?/Make/Set/New/Rename/ON/OFF/Color/Ltype/LWeight/TRansparency/MATerial/Plot/Freeze/Thaw/LOck/Unlock/stAte/Description/rEconcile]: _m
Enter name for new layer (becomes the current layer) : A-SEC-LIH-005 Enter an option [?/Make/Set/New/Rename/ON/OFF/Color/Ltype/LWeight/TRansparency/MATerial/Plot/Freeze/Thaw/LOck/Unlock/stAte/Description/rEconcile]: _C
New color [Truecolor/COlorbook] : magenta
Enter name list of layer(s) for color 6 (magenta) : Enter an option [?/Make/Set/New/Rename/ON/OFF/Color/Ltype/LWeight/TRansparency/MATerial/Plot/Freeze/Thaw/LOck/Unlock/stAte/Description/rEconcile]: _l
Enter loaded linetype name or [?] : DASHED2
Enter name list of layer(s) for linetype "DASHED2" : _LW
No matching layer names found.
Enter an option [?/Make/Set/New/Rename/ON/OFF/Color/Ltype/LWeight/TRansparency/MATerial/Plot/Freeze/Thaw/LOck/Unlock/stAte/Description/rEconcile]: 0.10
Invalid option keyword.
回复

使用道具 举报

35

主题

2471

帖子

2447

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
174
发表于 2022-7-5 23:02:08 | 显示全部楼层
Please pay attention that you missed to indicate the layer that will set the linetype for:
  1. ..."_L" "DASHED2" [color=red]"[font=Verdana][size=2]A-SEC-LIH-005"[/size][/font][/color]...
or
  1. ..."_L" "DASHED2" [color=red]"[font=Verdana][size=2]"[/size][/font][/color]...
回复

使用道具 举报

1

主题

7

帖子

6

银币

初来乍到

Rank: 1

铜币
5
发表于 2022-7-5 23:03:39 | 显示全部楼层
I will try tomorrow on another computer.. still doesn't work for me.. g nite
 
Command: (command "_-layer" "_m" "A-SEC-HIDDEN" "_C" "magenta" "" "_LT" "DASHED2" "_LW" "0.10" "" "" "")
_-layer
Current layer:  "0"
Enter an option [?/Make/Set/New/Rename/ON/OFF/Color/Ltype/LWeight/TRansparency/MATerial/Plot/Freeze/Thaw/LOck/Unlock/stAte/Description/rEconcile]: _m
Enter name for new layer (becomes the current layer) : A-SEC-HIDDEN Enter an option [?/Make/Set/New/Rename/ON/OFF/Color/Ltype/LWeight/TRansparency/MATerial/Plot/Freeze/Thaw/LOck/Unlock/stAte/Description/rEconcile]: _C
New color [Truecolor/COlorbook] : magenta
Enter name list of layer(s) for color 6 (magenta) : Enter an option [?/Make/Set/New/Rename/ON/OFF/Color/Ltype/LWeight/TRansparency/MATerial/Plot/Freeze/Thaw/LOck/Unlock/stAte/Description/rEconcile]: _LT
Enter loaded linetype name or [?] : DASHED2
Enter name list of layer(s) for linetype "DASHED2" : _LW
No matching layer names found.
Enter an option [?/Make/Set/New/Rename/ON/OFF/Color/Ltype/LWeight/TRansparency/MATerial/Plot/Freeze/Thaw/LOck/Unlock/stAte/Description/rEconcile]: 0.10
Invalid option keyword.
; error: Function cancelled
Enter an option [?/Make/Set/New/Rename/ON/OFF/Color/Ltype/LWeight/TRansparency/MATerial/Plot/Freeze/Thaw/LOck/Unlock/stAte/Description/rEconcile]: *Cancel*
回复

使用道具 举报

23

主题

132

帖子

112

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
114
发表于 2022-7-5 23:12:04 | 显示全部楼层
Thanks MSasu for picking that up:
(command "_-layer" "_m" "A-SEC-LIH-005" "_C" "magenta" "" "_l" "DASHED2" "" "_LW" "0.10" ""  "" "")
回复

使用道具 举报

106

主题

1万

帖子

101

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1299
发表于 2022-7-5 23:16:01 | 显示全部楼层
You may want to create a global lisp defun that just passes the variables using either entmake, command or VL eg (newlay "A- SEC-LIH-005" 5 "dashed2" 0.1) then you can use in any lisp you make.
 
  1. (defun newlay (lay col lt thick / )(command "_-layer" "_m" lay "_C" col "" "_l" lt "" "_LW" thick "" "" ""))
回复

使用道具 举报

4

主题

194

帖子

192

银币

初来乍到

Rank: 1

铜币
25
发表于 2022-7-5 23:16:33 | 显示全部楼层
 
BIGAL, there seems to be some issues showing up in ACAD 2015 in using the "command" function in LISP.  It seems AutoCad is slowly moving away from allowing this.  The better way is to use the "vl-cmdf" function, this will require the (vl-load-com) at the beginning of the LISP.
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-11 06:08 , Processed in 0.510790 second(s), 83 queries .

© 2020-2025 乐筑天下

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