jjatho 发表于 2022-7-5 17:24:40

试图追踪一只虫子

我写了一个快速脚本来自动创建一个我们在工作中一直使用的表。代码如下:
 
(defun C:liftdata()

(setvar "CLAYER" "Annotations")

(setq location (list -5.9609375 7.05078125))

(command "-table" "2" 21 "W" 1.46484375 "S" "sidebar" location)

(setq EN (entlast))

(setq table (vlax-ename->vla-object EN))

(setq column 0)
(setq row 0)

(vla-setCellValue table column row "Liebherr LR 1600")
(vla-setCellAlignment table column row 2)

(setq column 1)
(setq row 0)

(vla-setCellValue table column row "Main Boom")
(vla-setCellAlignment table column row 1)

(setq column 1)
(setq row 1)

(vla-setCellAlignment table column row 3)

(setq column 2)
(setq row 0)

(vla-setCellValue table column row "Main Boom Angle")
(vla-setCellAlignment table column row 1)

(setq column 2)
(setq row 1)

(vla-setCellValue table column row "%%D")
(vla-setCellAlignment table column row 3)

(setq column 3)
(setq row 0)

(vla-setCellValue table column row "Luffing Jib")
(vla-setCellAlignment table column row 1)

(setq column 3)
(setq row 1)

(vla-setCellAlignment table column row 3)

(setq column 4)
(setq row 0)

(vla-setCellValue table column row "Fixed Jib")
(vla-setCellAlignment table column row 1)

(setq column 4)
(setq row 1)

(vla-setCellAlignment table column row 3)

(setq column 5)
(setq row 0)

(vla-setCellValue table column row "Fixed Jib Angle")
(vla-setCellAlignment table column row 1)

(setq column 5)
(setq row 1)

(vla-setCellValue table column row "%%D")
(vla-setCellAlignment table column row 3)

(setq column 6)
(setq row 0)

(vla-setCellValue table column row "Carbody CTWT")
(vla-setCellAlignment table column row 1)

(setq column 6)
(setq row 1)

(vla-setCellAlignment table column row 3)

(setq column 7)
(setq row 0)

(vla-setCellValue table column row "Superstructure CTWT")
(vla-setCellAlignment table column row 1)

(setq column 7)
(setq row 1)

(vla-setCellAlignment table column row 3)

(setq column
(setq row 0)

(vla-setCellValue table column row "Ballast Tray Radius")
(vla-setCellAlignment table column row 1)

(setq column
(setq row 1)

(vla-setCellAlignment table column row 3)

(setq column 9)
(setq row 0)

(vla-setCellValue table column row "Ballast Tray CTWT")
(vla-setCellAlignment table column row 1)

(setq column 9)
(setq row 1)

(vla-setCellAlignment table column row 3)

(setq column 10)
(setq row 0)

(vla-setCellValue table column row "Ballast Wagon Radius")
(vla-setCellAlignment table column row 1)

(setq column 10)
(setq row 1)

(vla-setCellAlignment table column row 3)

(setq column 11)
(setq row 0)

(vla-setCellValue table column row "Ballast Wagon CTWT")
(vla-setCellAlignment table column row 1)

(setq column 11)
(setq row 1)

(vla-setCellAlignment table column row 3)

(setq column 12)
(setq row 0)

(vla-setCellValue table column row "Minimum Radius")
(vla-setCellAlignment table column row 1)

(setq column 12)
(setq row 1)

(vla-setCellAlignment table column row 3)

(setq column 13)
(setq row 0)

(vla-setCellValue table column row "Load Weight")
(vla-setCellAlignment table column row 1)

(setq column 13)
(setq row 1)

(vla-setCellAlignment table column row 3)

(setq column 14)
(setq row 0)

(vla-setCellValue table column row "Rigging Weight")
(vla-setCellAlignment table column row 1)

(setq column 14)
(setq row 1)

(vla-setCellAlignment table column row 3)

(setq column 15)
(setq row 0)

(vla-setCellValue table column row "Block Weight (XxX Sheave)")
(vla-setCellAlignment table column row 1)

(setq column 15)
(setq row 1)

(vla-setCellAlignment table column row 3)

(setq column 16)
(setq row 0)

(vla-setCellValue table column row "Aux Boom Sheave")
(vla-setCellAlignment table column row 1)

(setq column 16)
(setq row 1)

(vla-setCellAlignment table column row 3)

(setq column 17)
(setq row 0)

(vla-setCellValue table column row "Aux Hook Block")
(vla-setCellAlignment table column row 1)

(setq column 17)
(setq row 1)

(vla-setCellAlignment table column row 3)

(setq column 18)
(setq row 0)

(vla-setCellValue table column row "Total Lifted Load")
(vla-setCellAlignment table column row 1)

(setq column
(setq row 1)

(vla-setCellAlignment table column row 3)

(setq column 19)
(setq row 0)

(vla-setCellValue table column row "Lift Radius")
(vla-setCellAlignment table column row 1)

(setq column 19)
(setq row 1)

(vla-setCellAlignment table column row 3)

(setq column 20)
(setq row 0)

(vla-setCellValue table column row "Capacity @ Radius")
(vla-setCellAlignment table column row 1)

(setq column 20)
(setq row 1)

(vla-setCellAlignment table column row 3)

(setq column 21)
(setq row 0)

(vla-setCellValue table column row "% Of Load Chart Capacity")
(vla-setCellAlignment table column row 1)

(setq column 21)
(setq row 1)

(vla-setCellAlignment table column row 3)

(setq column 22)
(setq row 0)

(vla-setCellValue table column row "Line Pull (Reeving)")
(vla-setCellAlignment table column row 1)

(setq column 22)
(setq row 1)

(vla-setCellAlignment table column row 3)

(setq column 23)
(setq row 0)

(vla-setCellValue table column row "% Of Line Pull")
(vla-setCellAlignment table column row 1)

(setq column 23)
(setq row 1)

(vla-setCellAlignment table column row 3)

(setq column 24)
(setq row 0)

(vla-setCellValue table column row "Rigging Allowance To Reach 90% of Load Chart")
(vla-setCellAlignment table column row 1)

(setq column 24)
(setq row 1)

(vla-setCellAlignment table column row 3)

(setq column 25)
(setq row 0)

(vla-setCellValue table column row "Rigging Allowance To Reach 95% of Load Chart")
(vla-setCellAlignment table column row 1)

(setq column 25)
(setq row 1)

(vla-setCellAlignment table column row 3)

(setvar "CLAYER" "0")

) ;End defun DIRECTORY
 
显示的最后一行是包含“Line pull(reeving)”的行,我的命令行中有一个错误,上面写着“command:Automation error.Invalid input”。我觉得我把每件事都复习了十几遍,都没能完全领会我的错误。

Hippe013 发表于 2022-7-5 18:16:31

您的行数似乎无效。当我增加行数时,代码会一直运行。
 
当做
 
hippe013
 
(command "-table" "2" 21 "W" 1.46484375 "S" "sidebar" location)

BIGAL 发表于 2022-7-5 18:37:04

只要我节省一点打字时间
 
; put defun at top
(defun tabentry (table column row tabtext align)
(vla-setCellValue table column row tabtext)
(vla-setCellAlignment table column row align)
)

;repeat this line
(tabentry table 9 1 "Ballast Tray CTWT" 1)
(tabentry table 8 0 "Ballast Tray Radius" 1)
页: [1]
查看完整版本: 试图追踪一只虫子