Discovered Publish does not use cached xrefs. Chat gpt summary of what methods do and do not use them...

Discovered Publish does not use cached xrefs. Chat gpt summary of what methods do and do not use them...

JamesMaeding
Advisor Advisor
630 Views
9 Replies
Message 1 of 10

Discovered Publish does not use cached xrefs. Chat gpt summary of what methods do and do not use them...

JamesMaeding
Advisor
Advisor

I had a user complain publish was taking forever on a planset.

It was indeed, maybe a minute per sheet.

Hand opening a sheet took seconds, and plot command a few more.

Why the heck was publish slow?

I realized it was the xref loading, as I had opened one of the sheets to get the xrefs cached.

Opens on other sheets were fast.

Publish does not do this though, it ignores the .ac$ cached xrefs no matter what.

full convo here:

chatgpt merrygoround 

Summary at end was:

Which “open” paths use the .ac$ cache?

Yes = uses .ac$ if valid (a “warm open”)
No = ignores .ac$ and cold-loads from the real xref path

  • Command line / UI

    • OPEN (typed/clicked): Yes

    • OPEN via SendCommand: Yes

    • SCRIPT file that calls OPEN: Yes

    • Sheet Set Manager → Open sheet DWG: Yes

    • RECOVER, AUDIT, -INSERT as block, etc.: Generally No (special pipelines; expect full reads)

  • .NET / ObjectARX / APIs

    • DocumentCollection.Open(path, …): No (new AcDbDatabase; cold)

    • Database.ReadDwgFile(path, …) (side DB): No (cold)

    • HostApplicationServices.WorkingDatabase = new Database(...); ReadDwgFile(...): No

    • Editor.Command("_.OPEN", path) (i.e., programmatic command): Yes (same as SendCommand)

  • Publish / Batch

    • Publish (Background ON): No (separate context/headless; cold)

    • Publish (Foreground OFF): No (still fresh doc per sheet; cold)

    • Sheet Set Manager → Publish: No (same as above)

    • Custom batch that uses OPEN (via script/SendCommand) then plots: Yes (warm per DWG), while the DWG remains open

    • Custom batch that uses DocumentCollection.Open then plots: No (cold per DWG)

Other caches (don’t conflate these)

  • In-RAM per-document cache: exists only while a DWG is open. Helps when plotting multiple layouts of the same DWG. Lost on close. No cross-document sharing.

  • OS file cache: Windows may keep file contents in memory after first read; any method can benefit indirectly, but it’s not AutoCAD’s .ac$ logic.

Practical picks (by goal)

  • Fastest “open many DWGs, plot their layouts” without Publish

    • Use a Session command that drives: OPEN (via SendCommand or Editor.Command) → plot all layouts via Plot API → CLOSE → next file.

    • You get warm open (uses .ac$) and warm within-doc (layouts share the in-RAM state).

  • Robust code-only open (no UI commands), don’t care about warm

    • DocumentCollection.Open or ReadDwgFile (side DB). Expect cold loads.

  • One DWG, many layouts

    • Any method is fine; the speed win comes from staying in the same DB instance (no re-opens).

I thought this was pretty cool.

I never realized most api methods ignore the xref cache.


internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties

0 Likes
631 Views
9 Replies
Replies (9)
Message 2 of 10

BlackBox_
Advisor
Advisor

As interesting as that is, the only option that satisfies all three of those "Practical picks (by goal)" was never even mentioned... Core Console. 

 

While XREF complexity and drawing configuration (single drawing w/multiple-layouts vs multiple drawings w/single-layout) are factors in any plot operation, fact is that Core Console can produce the same PDF plan set in less time than any other plot method.

 


@BlackBox_ wrote:

<snip>

 

What takes PUBLISH (written in ARX not .NET) 30+ minutes to produce PDFs, only takes +/- 3 minutes using Core Console with this Windows Shell menu (and a lot less code! Haha): 

 

** The size and configuration of a plan set determine the relative time each takes (few multi-layout drawings vs many single-layout drawings, the latter actually takes less time to process).

 

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\*\shell\RightClickDwgToPdf]
@="2026 DWG to PDF"
"AppliesTo"=".dwg"
; "Icon"="C:\\Program Files\\Autodesk\\AutoCAD 2026\\accoreconsole.exe"
"HasLUAShield"=""
"Position"="Bottom"

[HKEY_CLASSES_ROOT\*\shell\RightClickDwgToPdf\command]
@="\"C:\\Program Files\\Autodesk\\AutoCAD 2026\\accoreconsole.exe\" /i \"%1\" /ld \"C:\\Program Files\\Autodesk\\AutoCAD 2026\\AecBase.dbx\" /p \"<YourProfileHere>\" /product \"C3D\" /language \"en-US\" /s \"C:\\<YourFilePathHere>\\RightClickDwgToPdf.scr\""

 

Here's the dependent Script: 

;; reload layer state, set other sysvars
(setvar 'automaticpub 1)
(command ".QSAVE")

 

Cheers


 


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

Sincpac C3D ~ Autodesk Exchange Apps

Message 3 of 10

JamesMaeding
Advisor
Advisor

Oh, I'll try that. When we publish, we use "plotter named in page setup" so I might enhance the script to plot how I want but your point is coreconsole is essentially multithreaded (one per core...), and non-graphical so faster to load up.

Is that correct, or is there more to that wonderful idea?

 

(BTW, that is classic chatgpt and likely any AI. You never know how complete the answer is, or if correct til you check it. It just looks good, hence the "Great Parlor Trick" nickname I give it.)

 

The crazy thing is I even wrote a batcher tool (My purgeids free tool) to use coreconsole for certain tasks, but for different reasons I don't even remember.

I prefer side database for modifying drawings, but I don't think you can plot that way.

It just never occurred to me it would be faster than publish.

thanks!


internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties

0 Likes
Message 4 of 10

BlackBox_
Advisor
Advisor

@JamesMaeding No worries, my friend. 🍺

 

Yeah, so you can do nearly anything you want with Core Console, as you can load ARX/.NET assemblies as needed for different 'tools'.

 

So, you can set a named page setup current, then Autopublish... or restore a layer state (say you have multiple drawings for given sheet type in your plan set, you open one sheet, edit the layers state, save, close... then the shell menu automagically applies it and/or plots them)... or load the necessary ARX assembly, so you can iterate (layoutlist) in LISP as part of your Script... really up to one's capability. 

 

If you or anyone else can find a faster way of plotting DWG to PDF, please let me know! Haha

 

HTH, Cheers


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

Sincpac C3D ~ Autodesk Exchange Apps

Message 5 of 10

JamesMaeding
Advisor
Advisor

Thanks. Its interesting as you could set up a plotting farm. We have spare autocad licenses so I could create a few sign-ins and have 3 machines chewing on plotting if I could figure out how to automate remote program running. One way I tried was maintaining a central todo text file, and machines would watch for items added, then remove the items when they started the task.

BTW, now I need to see if bricscad has the same publish habits as acad has.

 

 


internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties

Message 6 of 10

Sea-Haven
Mentor
Mentor

Just a question are you publishing one dwg or a set of dwg's  ?

 

I tend to use plot lisps so they can be called from coreconsole and run automatically, i have a plot range of layouts that could be modified to say read a text file and plot certain layouts in a dwg.

 

Remote plotting I think you can set up a start up script that run  on just that CAD startup, You could maybe get it to run a script on your master pc. The old fashioned Autoexcecute.bat comes to mind that would have a start Autocad and run a script/lisp etc. You can set up the pc's to look at each other if they are networked.

 

SeaHaven_0-1755575881599.png

 

Message 7 of 10

BlackBox_
Advisor
Advisor

Sounds like you're wanting the setup I had back when I was at Stantec (10+ years ago), where a file watcher on a server watched an 'input' folder on said server's share, then they used Ghostscript to cull the DWGs dropped there, which spit out PDFs to an 'output' folder. 

 

It worked fine, but required users to select the right DWGs, copy them over the network, then switch from the 'input' folder to the 'output' folder and copy the PDFs back over the network. It just wasn't very efficient in the 'economy of movement' category, which is one of the reasons I started exploring the built-in Autopublish mechanism initially, as it would spit out PDF on drawing Save* for me, right there in the same folder.

 

After several years, that eventually led me to attempt to replace Civil 3D team's standalone Batch Save Utility (BSU), with something that was Profile aware when invoked... that didn't require Acad.exe to be closed, which is ridiculous... that became so useful, that it branched into the Windows Shell menu shared above. 

 

This is the best I've come across in my limited experience, but am always looking for a way to improve upon it, should someone else share a better way. 

 

Instead of a Windows Shell menu for user selected DWGs in File Explorer, perhaps a firm is has a rigid DSD policy for various plan sets, then consider an option that provides a Shell menu for DSD files where a .NET assembly is loaded into Core Console, programmatically parses the DSD, and then leverages Core Console to batch process the DSD's sheets in parallel. 

 

This ability to batch process in parallel will still be beneficial for firms that use multi-layout drawings, but they will see even better performance when they adopt multiple single-layout drawings instead. 

 

Can't wait to see what you come up with!

 

Cheers


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

Sincpac C3D ~ Autodesk Exchange Apps

0 Likes
Message 8 of 10

JamesMaeding
Advisor
Advisor

@Sea-Haven 

It would definitely be set of drawings.

I would likely implement batch plotting with coreconsole by adding to my purgeids program, called file batcher now. Its free too so anyone could try.

Its got the guts to make list of files and run something on them.

Its c# coded and I recall launching coreconsole from .net progs before so I think that will do it.

I would have acad open on farmed machines, watching for network todo list and grab items as they appear.

I did this same thing for my dwg xref cataloging program. I can tell where files are xreffed in a project and used multiple machines to procesws thousands of drawings fast.

thx


internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties

0 Likes
Message 9 of 10

JamesMaeding
Advisor
Advisor

@BlackBox_ 

So I explored coreconsole use this last week.

I have .net code that does parallel processing with various taks, but thought to start blank and ask chatgpt to help me make a batcher program that fired off tasks to mutiple cores and managed the progress display.

I wanted to see if my previous methods (parallelforeach I think) were good ways.

Turns out i was close but not doing things the best I could.

So we developed an interface to load files, run parallel processes, and also a .net plugin to import a named page setup from a template drawing since the lisp I had planned on using had com in it so no good in core console.

It all worked. I just batch plotted a 24 sheets set to pdf in under 30 seconds.

I have 16 cores but even limiting to 8 is only 1 minute to plot.

This was all because you said "accoreconsole is the fastest way to plot."

I owe you. My users are going to flip out. That's fun to watch 🙂

I plan to post the tool, it does not use my engineering or helper libraries so is not exposing company IP.

cool shot of task manager when running:

JamesMaeding_0-1756421710632.png

 


internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties

Message 10 of 10

BlackBox_
Advisor
Advisor

@JamesMaeding wrote:

@BlackBox_ 

So I explored coreconsole use this last week.

I have .net code that does parallel processing with various taks, but thought to start blank and ask chatgpt to help me make a batcher program that fired off tasks to mutiple cores and managed the progress display.

I wanted to see if my previous methods (parallelforeach I think) were good ways.

Turns out i was close but not doing things the best I could.

So we developed an interface to load files, run parallel processes, and also a .net plugin to import a named page setup from a template drawing since the lisp I had planned on using had com in it so no good in core console.

It all worked. I just batch plotted a 24 sheets set to pdf in under 30 seconds.

I have 16 cores but even limiting to 8 is only 1 minute to plot.

This was all because you said "accoreconsole is the fastest way to plot."

I owe you. My users are going to flip out. That's fun to watch 🙂

I plan to post the tool, it does not use my engineering or helper libraries so is not exposing company IP.

cool shot of task manager when running:

JamesMaeding_0-1756421710632.png

 


That's awesome, @JamesMaeding ! 🍺

 

Thanks for trying it, I'm thrilled you've now got something that works better, and I'm excited to see what you share soon. 

 

Yes, when it comes to Core Console, either stick with Commands, AutoLISP, load the necessary ARX, etc or go with .NET which works in Core or full session - reading your post reminded me of this old thread for setting the active page setup

 

I've also got a 24 core CPU which makes quick work of this - thankfully, despite starting at a new firm, I've convinced them we need to start using single-layout DWGs to benefit from this even more (they've historically used single DWGs with multiple layouts + Publish... then I showed them I not only produced the same plan set in PDF, but then still had time to complete a proposed Surface for another project, before a peer had even finished with Publish). 

 

Core Console for the win! (and please mark as solution LoL) 


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

Sincpac C3D ~ Autodesk Exchange Apps

0 Likes