Author Topic: AcCoreConsole + Plot  (Read 6066 times)

0 Members and 1 Guest are viewing this topic.

BlackBox

  • King Gator
  • Posts: 3770
AcCoreConsole + Plot
« on: April 01, 2016, 11:11:55 AM »
Having trouble configuring AcCoreConsole for a batch plot process.

With CAD open, dragging in the Script works just fine... At the Windows Command Line (CMD), pasting the Batch file contents works just fine... But double clicking the actual .BAT file from File Explorer does not work? :? *confused*


Here's the Script:
Code - Text: [Select]
  1. (setq dwgname (getvar 'dwgname))
  2. (setq file (substr dwgname 1 (- (strlen file) 4)))
  3. (setq file (strcat (getvar 'dwgprefix) file ".pdf"))
  4. (setq filedia (getvar 'filedia))
  5. (setvar 'filedia 0)
  6. ;;Command:
  7. -PLOT
  8. ;;Detailed plot configuration? [Yes/No] <No>:
  9. _N
  10. ;;Enter a layout name or [?] <Layout>:
  11. Layout
  12. ;;Enter a page setup name <_DwgToPdf_24x36>:
  13. _DwgToPdf_24x36
  14. ;;Enter an output device name or [?] <DWG To PDF.pc3>:
  15. DWG To PDF.pc3
  16. ;;Enter file name <>:
  17. !file
  18. ;;Save changes to page setup [Yes/No]? <N>
  19. _N
  20. ;;Proceed with plot [Yes/No] <Y>:
  21. _Y
  22. ;;Command:
  23. (setvar 'filedia filedia)
  24.  


Here's the Batch file - this is for single drawing only; I have another for whole directory, but neither work from .BAT, only from CMD:
Code: [Select]
“C:\Program Files\Autodesk\AutoCAD 2016\accoreconsole.exe” /i “C:\CAD\plot.dwg” /s “C:\CAD\plot.scr” /l en-US


TIA
« Last Edit: July 16, 2021, 10:12:07 AM by BlackBox »
"How we think determines what we do, and what we do determines what we get."

BlackBox

  • King Gator
  • Posts: 3770
Re: AcCoreConsole + Plot
« Reply #1 on: April 01, 2016, 11:27:42 AM »
Quotes... That's what gummed up the works?! :roll:



I copied the original .BAT File contents from a blog article, and pasted it into Notepad++... Replacing each of the " in the file did the trick. :-D
"How we think determines what we do, and what we do determines what we get."

BlackBox

  • King Gator
  • Posts: 3770
Re: AcCoreConsole + Plot
« Reply #2 on: April 01, 2016, 11:34:09 AM »
Okay, now that that's been resolved... How does, or should I say can, one run AcCoreConsole in parallel without .NET API..? :?


Cheers
"How we think determines what we do, and what we do determines what we get."

BlackBox

  • King Gator
  • Posts: 3770
Re: AcCoreConsole + Plot
« Reply #3 on: April 01, 2016, 11:40:44 AM »
Interestingly, adding the START function before each of multiple copies of the call to AcCoreConsole.exe from above (just changing the drawing name), actually loads the drawings into my active session, rather than launching multiple instances of CMD.

Creating separate, one-line .BAT files with each drawing name in them does launch multiple instances of CMD, obviously, but I'd rather not have to do that... Just been a long time since I've had to use DOS.  :-D
"How we think determines what we do, and what we do determines what we get."

BlackBox

  • King Gator
  • Posts: 3770
Re: AcCoreConsole + Plot
« Reply #4 on: April 02, 2016, 04:05:46 PM »
Not sure if I'm done with this just yet, but found it useful, and thought I'd share... Just be mindful to check the version year, etc.


Using the Script above, and this alternate 'plot_from_shell.bat' file:
Code: [Select]
“C:\Program Files\Autodesk\AutoCAD 2016\accoreconsole.exe” /i %1 /s “C:\CAD\plot.scr” /l en-US

... In concert with this Shell context menu:
Code - Microsoft Registry: [Select]
  1. Windows Registry Editor Version 5.00
  2.  
  3. [HKEY_CLASSES_ROOT\*\shell\RightClickDwgToPdf]
  4. @="DWG To PDF"
  5. "AppliesTo"=".dwg"
  6. "Icon"="C:\\Program Files\\Autodesk\\AutoCAD 2016\\accoreconsole.exe"
  7. ;;"Extended"=""
  8. ;;"HasLUAShield"=""
  9. ;;"Position"="Top"
  10.  
  11. [HKEY_CLASSES_ROOT\*\shell\RightClickDwgToPdf\command]
  12. @="\"C:\\CAD\\plot_from_shell.bat\" \"%1\""
  13.  


... You can now 'Right Click + Plot' any  DWG to PDF  in-place, straight from File Explorer, using AcCoreConsole.exe in parallel. :-)


Cheers
"How we think determines what we do, and what we do determines what we get."

cadplayer

  • Bull Frog
  • Posts: 390
  • Autocad Civil3d, OpenDCL.Runtime, LISP, .NET (C#)
Re: AcCoreConsole + Plot
« Reply #5 on: December 14, 2016, 09:35:28 AM »
Late but better as to late, thank you for sharing ...

BlackBox

  • King Gator
  • Posts: 3770
Re: AcCoreConsole + Plot
« Reply #6 on: December 14, 2016, 10:27:33 AM »
Late but better as to late, thank you for sharing ...

You're welcome, cadplayer. :-)


Cheers
"How we think determines what we do, and what we do determines what we get."

JohnK

  • Administrator
  • Seagull
  • Posts: 10637
Re: AcCoreConsole + Plot
« Reply #7 on: December 14, 2016, 12:19:06 PM »
Hey BB, also late but if it helps, you can grab one of the bat files or vbscript files I use(d) in my converting of Postscript/XPS files to PDF (I've used the same scripts for years and they do batch processing, via drag-and-drop--drop, of the files you want stuff done to). You'd have to do only minimal changing to the script to get them to call accoreconsole. </thought>

https://www.theswamp.org/index.php?topic=50646.msg557943#msg557943
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

MSTG007

  • Gator
  • Posts: 2601
  • I can't remeber what I already asked! I need help!
Re: AcCoreConsole + Plot
« Reply #8 on: December 14, 2016, 12:51:42 PM »
that's REALLY cool.
Civil3D 2020

BlackBox

  • King Gator
  • Posts: 3770
Re: AcCoreConsole + Plot
« Reply #9 on: December 14, 2016, 03:46:50 PM »
Thanks, guys. :beer:
"How we think determines what we do, and what we do determines what we get."

cadplayer

  • Bull Frog
  • Posts: 390
  • Autocad Civil3d, OpenDCL.Runtime, LISP, .NET (C#)
Re: AcCoreConsole + Plot
« Reply #10 on: December 15, 2016, 01:12:22 AM »
As I say, it is amazing. I found a little mistake in scr-file
Change this row
Code: [Select]
(setq file (substr dwgname 1 (- (strlen file) 4)))
with this
Code: [Select]
(setq file (substr (getvar 'dwgname) 1 (- (strlen file) 4)))
But no worry, it works in both cases. With correct row you get same pdf-file-name as dwg-file-name

I studied a long time ago how I can use accoreconsole. I was thinking it must have a way to plot Drawing without start Autocad. Here is now a very good example.
The registry import complete plot command  perfectly. Now is printing my favorite work... :)

A little question can you shutdown accoreconsole (dos-dialog) after running ?