Accessing Command Line from Cod Script

artcaddept
Participant

Accessing Command Line from Cod Script

artcaddept
Participant
Participant

Is anyone aware of a way to access the command line from within a cod script? Any way to send AutoCAD native or custom commands from within the cod would be helpful.

0 Likes
Reply
556 Views
2 Replies
Replies (2)

MOatman
Advocate
Advocate

@artcaddept wrote:

Is anyone aware of a way to access the command line from within a cod script? Any way to send AutoCAD native or custom commands from within the cod would be helpful.


You can write a Lisp command that writes and executes a script file.  The generated script file can use information stored in variables define by the Lisp command.  Not exactly command line access.

 

(defun c:Bundle ()
(setq bundle (getstring "\nEnter Bundle Name: "))
(setq scr (strcat (getvar "Logfilepath") "tmp.cod")
ss (mapfilter "#5025 = #56 | #5025 = #109" 0 0 1)
fil (open scr "w"))
(write-line (strcat "item.customdata[\"Bundle\"].value=" (vl-princ-to-string bundle) "") fil)
(close fil)
(executescript scr ss)
(princ)
(COMMAND-S ".redraw")
)

 

 

0 Likes

artcaddept
Participant
Participant

Thanks for the reply. That is correct. Unfortunately, I am pigeonholed into having to access the command line from within a cod script.
For context, I am trying to create spool drawings that run a lisp file upon creation. Fabrication's "BSPOOL" command dialogue somewhat allows this, however, it will only specifically allow cod files. Not SCR or LSP files. I thought I could potentially get around that on the back side by specifying the LSP through the spool.ini file. However it still only looks for cods when they are being created.
I am currently running the LSP after they are finished creating through autoscript but would prefer if this could be done as each spool was made versus retroactively. Any ideas are greatly appreciated

0 Likes