Ohnoto 发表于 2022-7-6 08:49:14

错误的参数类型:fixnump:

大家好,好久不见
 
我对这段粗体代码的第一部分有问题。我在plot LISP中添加了用于打印多个副本的选项。然而,我不断得到一个错误“错误的参数类型:fixnump:”。
 
我希望复制量默认设置为1,如果用户按enter键而不键入数字,则只打印1份。
 
(defun Laser5500 (/ myPLOLayoutList mylayout)
(setq totcopy 1)
(setq totalcopy
   (cond
   (
       (eq ""
         (setq totalcopy
         (getint
             (strcat "\nHow many copies to be printed <1>: "
             )
         )
         )
       )
       totcopy
   )
   ( totalcopy )
   )
)
   (EXPLO_db1_Main)
   (setvar "cmdecho" 0)
   (setq imagef (getvar "imageframe"))
   (setvar "imageframe" 2)
   (command "wipeout" "frames" "off")
   (setq mylayout (length myPLOLayoutList))
(repeat totalcopy
   (if myPLOLayoutList                        
       (progn                           
       (setq                            ; Begin setq for myLayout
         myLayout (getvar "CTAB"))            ; End setq for myLayout
       (foreach myLayout (reverse myPLOLayoutList)
         (command "-plot"                  ; Command: -plot
         "Y"                         ; Detailed plot configuration?
         mylayout                  ; Layout Name
         "NP2-HPCLJ5500.pc3"                ; Output Device Name
         "11x17"                        ; Paper Size
         "Inches"                  ; Paper Units
         "Landscape"                  ; Drawing Orientation
         "No"                        ; Plot Upside Down?
         "Extents"                  ; Plot Area
         "1=1"                        ; Plot Scale (Plotted Inches=Drawing Units) or
         "Center"                  ; Plot Offset (x,y) or <Center>
         "Yes"                        ; Plot Styles?
         "monochrome.ctb"                ; Plot Style Table Name or [?] (enter . for none)
         "Yes"                        ; Plot Lineweights
         "No"                        ; Scale Lineweights
         "No"                        ; Plot Paper Space First?
         "No"                        ; Hide Paperspace Objects?
         "No"                        ; Plot to a File
         "No"                        ; Save Changes to Page Setup
         "Yes")                        ; Proceed With Plot
      )))
   )
   (setvar "imageframe" imagef)
   (setvar "cmdecho" 1)
       (princ "\n ---------------------------------------------")
      (princ (strcat "\n ------ Express Plotting - Version " PLOVerNum " ------"))
   (princ "\n ---------------------------------------------")
   (princ)
)

Lee Mac 发表于 2022-7-6 09:21:14

首先,要理解您收到的错误消息,请参阅此处,看看您是否可以告诉我代码的哪一部分崩溃了。
 
现在,为了理解您收到该错误消息的原因,请注意,如果用户按Enter键,getint将返回nil,而不是空字符串。看看本教程,特别是最后一个示例。

Ohnoto 发表于 2022-7-6 10:18:39

谢谢李。你的教程很有帮助。很明显,我错过了ITOA和其他一些不合适的东西。
页: [1]
查看完整版本: 错误的参数类型:fixnump: