mwade93 发表于 2022-7-5 16:51:46

有条件帮助

我在这里获得了另一个使用条件的命令的帮助,但我似乎在使用这段代码时遇到了困难。它所做的是读取在此代码之外选择的sheetsize命令的值。并非所有布局都适用于每种纸张尺寸。因此,如果所选布局不是为该纸张大小创建的,则该代码应该取消。然而,它不能正常工作。如果我选择了正确的纸张尺寸,它将毫无问题地插入布局。如果该值为零,则它也有效。我假设它与最后两个条件的条件行有关,但我不知道出了什么问题。谢谢你的帮助。
 
((/ SHEETSIZE)
   (if (and SHEETSIZE)
       (progn
         (command "layout" "template" SheetSize "QF002DES" "imageframe" "1" "imageframe" "0")
       )
       (cond
         ((not SHEETSIZE) (alert "Sheet size was not selected.Please select sheet size and restart the command."))
         ((= "2016 TM 30x42 Template" SHEETSIZE) (alert "This layout is not available for the selected size."))
         ((= "2016 TM 11x17 Template" SHEETSIZE) (alert "This layout is not available for the selected size."))
       )
   )
)

Tharwat 发表于 2022-7-5 17:16:07

你好
 
我不确定我是否明白你的意思,但希望这会有所帮助。
 

(if SheetSize
   (if (wcmatch SheetSize "2016 TM 30x42 Template,2016 TM 11x17 Template")
   (alert "This layout is not available for the selected size.")
   (command "layout" "template" SheetSize "QF002DES" "imageframe" "1" "imageframe" "0")
   )
(alert "Sheet size was not selected.Please select sheet size and restart the command.")
)

mwade93 发表于 2022-7-5 17:32:32

非常感谢。它似乎在工作。另一个需要注意的功能。

Tharwat 发表于 2022-7-5 17:55:08

很乐意帮忙。
页: [1]
查看完整版本: 有条件帮助