如何从 AutoCad Core Console 2016 运行 AutoLisp 例程 (ATTOUT)

How to run an AutoLisp routine (ATTOUT) from AutoCad Core Console 2016

我想 运行 .dwg 文件的所有块上的 ATTOUT 例程,使用 Core Console 来自动化应用程序..

我在我的 AutoCAD 2016 安装的 Express 文件夹中使用默认 "attout.lsp",因为我想在所有块上使用它并且不需要 select 特定块。

我试过了:

accoreconsole.exe /i C:/<pathing_to_my_dwg_file>/sample1.dwg /s test-attout.scr

其中 test-attout.scr 是:

(load "attout.lsp" "/omg it"s not working)

结果如下:

`Redirect stdout (file: C:\Users\lboey\AppData\Local\Temp\accc64962).
AutoCAD Core Engine Console - Copyright Autodesk, Inc 2009-2013.
Regenerating layout.

Regenerating model.
..
**** System Variable Changed ****
1 of the monitored system variables has changed from the preferred value. Use SY
1 of the monitored system variables has changed from the preferred value. Use SY
SVARMONITOR command to view changes.


Command:
Command:

Command:
Command: (load "attout" "omg it's not loading")_quit


Command:`

我是 AutoCAD 新手,非常感谢任何建议..

感谢大家!!

此命令 (ATTOUT) 将显示一个对话框,这就是它在控制台上不起作用的原因。此外,任何使用 COM 的 LISP 也将无法工作 (vl-load-com)

我会回答我自己的问题:

  1. 创建 my_script.scr 文件
(load "C:\Program Files\...\my_routine.lsp")> 
att-out
  1. 创建 AutoLisp 例程文件my_routine.lsp

(defun c:att-out () (load "attout") (setq out (strcat (getvar> "dwgprefix") (acet-filename-path-remove (acet-filename-ext-remove> (getvar "dwgname"))) .txt" )) (setq ss (ssget "X" '((0 . "INSERT") (66 . 1)))) (bns_attout out ss) )

  1. 用acad.exe
  2. 调用脚本

acad.exe C:\Program Files...\a_simple_dwg.dwg /b my_script.scr

A​​utocad Core Console 现在处于早期开发阶段,因此自动化操作链的最简单方法是使用 AutoLisp。

my_routine.lsp 适用于 Autocad 2011,稍作调整

(defun c:att-out () (load "attout") (setq out (strcat (getvar "dwgprefix") (acet-filename-path-remove (acet-filename-ext-remove (getvar "dwgname"))) ".txt" )) (setq ss (ssget "X" '((0 . "INSERT") (66 . 1)))) (bns_attout out ss))

谢谢@user3336544