Search code examples
autocadautolisp

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


I would like to run the ATTOUT routine on all the blocks of a .dwg file, using the Core Console for automating an application..

I'm using the default "attout.lsp" in the Express folder of my AutoCAD 2016 installation, since i want to use it on ALL BLOCKS and dont need to select a specific block.

i tried :

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

where test-attout.scr is :

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

the results are below:

`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:`

I'm a noobie in AutoCAD and any advice is very much appreciated..

Thanks to all!!


Solution

  • I'll answer my own question:

    1. Create a my_script.scr file
    (load "C:\\Program Files\\...\\my_routine.lsp")> 
    att-out
    
    1. Create an AutoLisp routine file 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. Call the script with acad.exe

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

    Autocad Core Console is in it's early development stage now and therefore the easiest way to automate a chain of operations is by using AutoLisp.