Per default powerJobs uses TrueView to generate PDF of AutoCAD drawings and can be configured via setup drawings and manipulation of a temporary DSD file that is created for every file export. DWGTrueView is limited, if more capabilities are required it is possible to use e.g. the AutoCAD core console.
AutoCAD is delivered with the AutoCAD core console where users can manipulate drawings via scripting. This was introduced in AutoCAD 2013 and is available in all AutoCAD products. The core console can be used with powerJobs to export files.
To use to console you have to pass the path to the console, create a script file for saving the DXF and execute that the console . In this example we are exporting an AutoCAD drawing to DXF.
Define a workingdirectory where the file should be downloaded and where the DXF file should be exported.
Please remember to modify the path in the $accoreconsole variable to match with your AutoCAD version:
In the next section a script file is created that is later executed with the AutoCAD core console.
The Start-Process cmdlet starts the AutoCAD core console and passes following parameters:
- The path to the AutoCAD core console
- In /i the path to the parent file is passed
- In /s the path to the newly created script file is passed and is then executed in the AutoCAD core console.
After the AutoCAD core console is executed there is a check if the DXF file exists in the specified location.
At the end of the script the script file is removed from the workingdirectory
#Get the parent file $workingDirectory = "C:\Temp\$($file._Name)" $localDXFfileLocation = "$workingDirectory\$($file._Name).dxf" $downloadedFiles = Save-VaultFile -File $file._FullPath -DownloadDirectory $workingDirectory $file = $downloadedFiles | select -First 1 # Change the path to match with your AutoCAD version $accoreconsole = "C:\Program Files\Autodesk\AutoCAD <Version>\accoreconsole.exe" $scriptfile = "$workingDirectory\PublishDXF.scr" # create script file for accoreconsole '_.save "' + $localDXFfileLocation + '" ' | Out-File $scriptfile #Start the AutoCAD core console with the arguments $p = Start-Process -FilePath $accoreconsole -ArgumentList @("/i `"$($file.LocalPath)`"", "/s `"$scriptfile`"") -Wait $exportResult = [System.IO.File]::Exists($localDXFfileLocation) #Remove the script file Remove-Item -Path $scriptfile
AutoCad core console (Autodesk University)