Author Topic: AutoCAD 'ScreenUpdate' = false ?  (Read 5251 times)

0 Members and 1 Guest are viewing this topic.

Bert

  • Guest
AutoCAD 'ScreenUpdate' = false ?
« on: November 20, 2013, 03:13:11 AM »
Hello guys,

I was wondering;

Is it possible to run AutoCAD in the background ? I'd do this to increase performance, AutoCAD would not have to update/regen to screen for me.

In a nutshell: After a drawing has been made by the designer (manual process) there is the option to create what I call a productionsheet.
Its a document, printed on A3 or A4 format, that holds (amongst others) a Bill of material, barcodes, an overview of the product that needs making, references to CNC-prgorams to use etc ..
This document then goes to the workfloor.

These productionsheets are created based on a DWT, and saved (archived) as a dwg/dxf after printing them.

I know Excel allows the programmer to turn of a system var 'ScreenUpdating' wich allows you to disable all visualisation on screen, and thus do the work in the 'background'.
This increases performance considerably.

There is no need for the user to see the creation of these productionsheets, and i'm looking into how I could speed up this process.

Any help/tips/suggestions are welcome !
Cheers,
Bert

WILL HATCH

  • Bull Frog
  • Posts: 450
Re: AutoCAD 'ScreenUpdate' = false ?
« Reply #1 on: November 20, 2013, 12:48:52 PM »
yes, you can do this work in a side database and avoid involving the editor.  Other than that you can play with core console (not highly recommended).  I'd avoid the VBA approach as (personal preference) any speed you gain from working silently in the background you lose to interop.

Bert

  • Guest
Re: AutoCAD 'ScreenUpdate' = false ?
« Reply #2 on: November 21, 2013, 02:14:29 AM »
yes, you can do this work in a side database and avoid involving the editor.

Thanks Will !

I've written a snippet to check if I got it right, to see if this is what you ment :
Code - vb.net: [Select]
  1.     Private Sub productionSheetsInSideDb(_templateFileName As String, _destinationFileName As String)
  2.  
  3.         Dim acSideDb As New Database(False, True)
  4.         ' Read the DWG (DWT?) into a side database
  5.         acSideDb.ReadDwgFile(_templateFileName, System.IO.FileShare.Read, True, "")
  6.  
  7.         Using acTrans As Transaction = acSideDb.TransactionManager.StartTransaction()
  8.             ' Get the Block table for the side database
  9.             Dim acBlockTbl As BlockTable = acTrans.GetObject(acSideDb.BlockTableId, OpenMode.ForRead)
  10.             ' ModelSpace
  11.             Dim acmodelBlockTbl As BlockTableRecord = DirectCast(acTrans.GetObject(acBlockTbl(BlockTableRecord.ModelSpace), OpenMode.ForWrite), BlockTableRecord)
  12.  
  13.             '... more code here
  14.  
  15.         End Using
  16.  
  17.         acSideDb.SaveAs(_destinationFileName, DwgVersion.Current)
  18.  
  19.     End Sub

I'm worried about "acSideDb.ReadDwgFile", as I actually want to start from a DWT-template, and when I'm done save my document in an archive under another name ?
(worst case is that i just save my DWT to DWG and use the DWG  as a 'template' ?)
« Last Edit: November 21, 2013, 02:21:35 AM by Bert »

MexicanCustard

  • Swamp Rat
  • Posts: 705
Re: AutoCAD 'ScreenUpdate' = false ?
« Reply #3 on: November 21, 2013, 07:47:16 AM »
In your code _temlateFileName can be a ".dwt" file.  Then just use a ".dwg" extension in your _destinationFileName.
Revit 2019, AMEP 2019 64bit Win 10

Bert

  • Guest
Re: AutoCAD 'ScreenUpdate' = false ?
« Reply #4 on: November 21, 2013, 09:53:24 AM »
cool cool ..

Now just one thing left would be plotting the destination dwg without opening it ? (opening to plot would defeat the purpose..)
I've seen code examples for plotting to a file, but I need to plot via pc3 -> to device ?

WILL HATCH

  • Bull Frog
  • Posts: 450
Re: AutoCAD 'ScreenUpdate' = false ?
« Reply #5 on: November 21, 2013, 11:30:44 AM »
I've never done any plotting before, check out http://through-the-interface.typepad.com/through_the_interface/2007/09/driving-a-basic.html

It seems you may need to do this with a document open which could be undesirable.  If that is the case I'd suggest looking into core console for the plot http://through-the-interface.typepad.com/through_the_interface/2012/02/the-autocad-2013-core-console.html

Bert

  • Guest
Re: AutoCAD 'ScreenUpdate' = false ?
« Reply #6 on: November 22, 2013, 02:22:36 AM »
The Core-console sounds mighty fine, but I don't have that available as we are currently (still) running AutoCAD2009.

I've read the first article before, just adapted it to plot to device instead of a file. Have indeed not yet got around to plot a document without it beeing open/active ..
« Last Edit: November 22, 2013, 03:05:17 AM by Bert »