VBA
Discuss AutoCAD ActiveX and VBA (Visual Basic for Applications) questions here.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Plotter setup - please help!

4 REPLIES 4
Reply
Message 1 of 5
Anonymous
178 Views, 4 Replies

Plotter setup - please help!

I set up a new drawing from a VBA routine. By default in both model space
and paper space the plotter is set to "none" and paper size is set to
8.5x11.0. After the setup I can set up a plotter using the following script:

-PLOT no Model JDL 42x30 E2 Full
AE JDL 3500E-II.pc3
no yes no
LAYOUT set Layout1
-PLOT no Layout1 JDL 42x30 E2 Full (Paper Space)
AE JDL 3500E-II.pc3
no yes no

;Command: -PLOT Detailed plot configuration? [Yes/No] : no
;Enter a layout name or [?] : Model
;Enter a page setup name <>: JDL 42x30 E2 Full
;Enter an output device name or [?] : AE JDL
3500E-II.pc3
;Write the plot to a file [Yes/No] : no Save changes to model tab
[Yes/No]?
; yes Proceed with plot [Yes/No] : no
;
;Command: LAYOUT
;Enter layout option [Copy/Delete/New/Template/Rename/SAveas/Set/?] :
set
;Enter layout to make current : Layout1
;Regenerating layout.
;
;Command: -PLOT Detailed plot configuration? [Yes/No] : no
;Enter a layout name or [?] : Layout1
;Enter a page setup name <>: JDL 42x30 E2 Full (Paper Space)
;Enter an output device name or [?] : AE JDL
3500E-II.pc3
;Write the plot to a file [Yes/No] : no Save changes to layout [Yes/No]?

;yes Proceed with plot [Yes/No] : no

I'd like to do this during the drawing setup through VBA - I do not need to
add anything to PlotConfigurations collection, but I'd like to be able to
retrieve the information from there and make it current first for model
space, then for paper space.
I've looked through Joe Sutphin's and Jerry Winters' books, read printing
threads here and understand that it is possible, but so far all my attempts
fail.
Could you please point me in the right direction. Thank you,

--
Regards,
Yury Shafir
4 REPLIES 4
Message 2 of 5
Anonymous
in reply to: Anonymous

Sorry, forgot the important part:
Windows NT 4.0
AutoCAD 2002
Thank you,

--
Regards,
Yury Shafir
"Yury Shafir" wrote in message
news:62D2BDBBDFC6E0E19311FF21B036E447@in.WebX.maYIadrTaRb...
> I set up a new drawing from a VBA routine. By default in both model space
> and paper space the plotter is set to "none" and paper size is set to
> 8.5x11.0. After the setup I can set up a plotter using the following
script:
>
> -PLOT no Model JDL 42x30 E2 Full
> AE JDL 3500E-II.pc3
> no yes no
> LAYOUT set Layout1
> -PLOT no Layout1 JDL 42x30 E2 Full (Paper Space)
> AE JDL 3500E-II.pc3
> no yes no
>
> ;Command: -PLOT Detailed plot configuration? [Yes/No] : no
> ;Enter a layout name or [?] : Model
> ;Enter a page setup name <>: JDL 42x30 E2 Full
> ;Enter an output device name or [?] : AE JDL
> 3500E-II.pc3
> ;Write the plot to a file [Yes/No] : no Save changes to model tab
> [Yes/No]?
> ; yes Proceed with plot [Yes/No] : no
> ;
> ;Command: LAYOUT
> ;Enter layout option [Copy/Delete/New/Template/Rename/SAveas/Set/?] :
> set
> ;Enter layout to make current : Layout1
> ;Regenerating layout.
> ;
> ;Command: -PLOT Detailed plot configuration? [Yes/No] : no
> ;Enter a layout name or [?] : Layout1
> ;Enter a page setup name <>: JDL 42x30 E2 Full (Paper Space)
> ;Enter an output device name or [?] : AE JDL
> 3500E-II.pc3
> ;Write the plot to a file [Yes/No] : no Save changes to layout
[Yes/No]?
>
> ;yes Proceed with plot [Yes/No] : no
>
> I'd like to do this during the drawing setup through VBA - I do not need
to
> add anything to PlotConfigurations collection, but I'd like to be able to
> retrieve the information from there and make it current first for model
> space, then for paper space.
> I've looked through Joe Sutphin's and Jerry Winters' books, read printing
> threads here and understand that it is possible, but so far all my
attempts
> fail.
> Could you please point me in the right direction. Thank you,
>
> --
> Regards,
> Yury Shafir
>
>
Message 3 of 5
MichaelLang
in reply to: Anonymous

I created the following to print autocad files. My only problem is that it won't work on a layout that has not been initialized. When this code switches to an un-initialized layout the page setup dialog appears.

Unfortunatly, all the plot properties of the layout don't appear any different from an initialized layout. So you can't tell via properties if the layout is initialized.

Does anyone know a way to tell if a layout is not initialized? I'll just skip those in the case that the user picks "ALL" layouts.

=========================================================

Public Function PlotDWG(strFile As String, _
PlotID As String,Optional intCopies As Integer=1, _ Optional strSize As String = "Letter", _
Optional intScale As Integer = 100, _
Optional intRotation As Integer = 0, _
Optional strDevice As String = "Default", _
Optional strPages As String = "ALL", _
Optional strDescription As String = "",
Optional strOwner As String = "") As String
'NOTE: return value is the resulting Status ("OK", "NoFile", etc...)
Dim objAutoCAD As AutoCAD.AcadApplication
Dim objDocument As AutoCAD.AcadDocument
Dim objPlotConfig As AutoCAD.AcadPlotConfiguration
Dim arrLayouts As Variant
On Error GoTo GenError
GetAutoCADRef objAutoCAD
objAutoCAD.Visible = True
'open strFile in autocad
Set objDocument = objAutoCAD.Documents.Open(strFile, True)
'TODO: copy appropriate PSS file to PSS file location
objDocument.Plot.NumberOfCopies = intCopies

Select Case strPages
Case "All"
For i = 0 To objDocument.Layouts.Count - 1
'TODO: if layout is not configured, it
' brings up a dialog
MsgBox objDocument.Layouts.Item(i).ConfigName
SetAcadLayoutPlotProps objDocument.Layouts. _
Item(i), strSize, intScale, intRotation, _
strDevice
objDocument.ActiveLayout = _
objDocument.Layouts.Item(i)
objDocument.Plot.PlotToDevice
Next
Case Else
If strPages = "*Current*" Or _
strPages = "Current" Then
strPages = objDocument.ActiveLayout.Name
End If
For i = 0 To objDocument.Layouts.Count - 1
SetAcadLayoutPlotProps objDocument.Layouts. _
Item(i), strSize, intScale, intRotation, _
strDevice
If objDocument.Layouts.Item(i).Name=strPages Then
objDocument.ActiveLayout = _
objDocument.Layouts.Item(i)
End If
Next
objDocument.Plot.PlotToDevice
End Select
'close drawing
If Not objDocument.Saved Then
objDocument.SaveAs gAppPath & "junk.dwg"
End If
objDocument.Close
PlotDWG = "OK"
Exit Function
GenError:
Debug.Print CStr(Err.Number) & ":" & Err.Description
Err.Clear
CloseAutoCADRef objAutoCAD
PlotDWG = PlotAnyFile(strFile, PlotID, intCopies, _
strSize, intScale, intRotation, strDevice, _
strPages, strDescription, strOwner)
End Function

=========================================================
Message 4 of 5
MichaelLang
in reply to: Anonymous

well that code doesn't appear well. Let me include the source file.

Attached:
PlotFunc.bas - VB6 code module.
Message 5 of 5
Anonymous
in reply to: Anonymous

Thank you, Michael!

 
Regards,
Yury Shafir

 


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
well
that code doesn't appear well. Let me include the source file.

Attached:
  PlotFunc.bas - VB6 code module.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost