Batch Plot AutoCAD Settings

Hi All,

Thanks to all the amazing work by @Konrad_K_Sobon & @erfajo amongst others, I have a nice graph for batch plotting.

The graph creates a dated folder, it prints a view set of pdfs into the folder and it exports dwgs to a sub folder, everything named as per our office standards.

I have 2 minor issues… The first is that the dwg export doesn’t use the defined version of Dwg, it instead uses 2018, which means that everyone else who is on crappy old autocad (i know i know they should update) needs me to resave to a version they can use.

The other really really minor thing is that the adobe pdf writer fails to find the new folder that’s just been created and goes to the default location.

This has been made in 1.3 with Revit 2018.2

Any assistance would be greatly appreciated…

Mark

Batch Plot.dyn (138.3 KB)

Hi Mark,

Nice work !

It’s possible to add the Autocad version in the node Export DWG but it’s also contained in the DWG Export Setup :

For your issue with the Adobe PDF, it’s probably your Adobe PDF configuration to review.
My Adobe settings are in french so I will illustrate with a picture of Konrad Sobon. (Thanks to Konrad)
The line Adobe PDF Output Folder takes precedence over the filepaths.
Preferences%20Adobe%20PDF

Hi Alban,

Thanks a lot, unfortunately my export settings are telling the file to be 2007 DWG, but these are being ignored…

The second point is valid, but I guess I am hoping to have this path set by the graph (as it creates the new folder) perhaps this isn’t possible…

Cheers,

Mark

So for the Autocad version, you can add after the line :
options.GetPredefinedOptions(doc,Predef[0])
the line :
options.FileVersion=ACADVersion.R2007

R2007 |AutoCAD 2007 file format.
R2010 |AutoCAD 2010 file format.
R2013 |AutoCAD 2013 file format.
R2018 |AutoCAD 2018 file format.

Version

For the second point, I’ve no other solution than to change the Adobe PDF Preferences.

1 Like

That’s Awesome Alban, thanks!

Aplogies for trying to take up more of your time…

I would like the user to be able to input a string which I add some other strings to and form the ACADVersion.R2007… However (forgive my python failings) I don’t know how to find out what would convert the input string to an ACADVersion… Would you be able to help amend my terrible attempt? I have put in ‘ver’ as a placeholder…

image

Thanks!

Mark

R2007 isn’t a string but an enumeration.

Get Autocad Version :

import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
# Import DocumentManager and TransactionManager
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
# Import RevitAPI
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *
from Autodesk.Revit.DB import Structure
import System

#Assign your output to the OUT variable
OUT = System.Enum.GetValues(Autodesk.Revit.DB.ACADVersion)

Export DWG :
# Copyright© 2016, Konrad K Sobon
# @arch_laboratory, http://archi-lab.net

# Import Element wrapper extension methods
import clr
clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.Elements)

# Import DocumentManager and TransactionManager
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
doc = DocumentManager.Instance.CurrentDBDocument

# Import RevitAPI
clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *

import System
from System.Collections.Generic import *

import sys
pyt_path = r'C:\Program Files (x86)\IronPython 2.7\Lib'
sys.path.append(pyt_path)

#The inputs to this node will be stored as a list in the IN variable.
dataEnteringNode = IN

def ProcessList(_func, _list):
    return map( lambda x: ProcessList(_func, x) if type(x)==list else _func(x), _list )

def ProcessParallelLists(_func, *lists):
	return map( lambda *xs: ProcessParallelLists(_func, *xs) if all(type(x) is list for x in xs) else _func(*xs), *lists )

def Unwrap(item):
	return UnwrapElement(item)

folderPath = IN[0]

if isinstance(IN[1], list):
	views = ProcessList(Unwrap, IN[1])
else:
	views = list(Unwrap(IN[1]))

if isinstance(IN[2], list):
	names = IN[2]
else:
	names = list(IN[2])

RunIt = IN[3]

Predef = IN[4]

Version = IN[5]

def ExportDwg(name, view, folder = folderPath):
	options = DWGExportOptions()
	options.GetPredefinedOptions(doc,Predef[0])
	options.FileVersion=Version
	views = List[ElementId]()
	views.Add(view.Id)
	result = doc.Export(folder, name, views, options)
	return result

if RunIt:
	try:
		errorReport = None
		# run export
		ProcessParallelLists(ExportDwg, names, views)
		
	except:
		# if error accurs anywhere in the process catch it
		import traceback
		errorReport = traceback.format_exc()
else:
	errorReport = 'Please set the RunIt to True!'

#Assign your output to the OUT variable
if errorReport == None:
	OUT = 'Success'
else:
	OUT = errorReport
2 Likes

Thanks that’s Awesome!

Updated version…

I’ve added an option to automatically save locally before running, sometimes the graph causes Revit to crash…

Batch Plot - pdf dwg.dyn (150.0 KB)