Could someone please help with the names of the function to establish the plotting parameters using the (vlax-get-property <name> <parameter> ) method. For example the plotting device name is obtainable by (vlax-get-property <objectname> 'Configname).
What "words"/parameters do I use to find the plot orientation and paper size?
Thanks
George
@Anonymous wrote:
Could someone please help with the names of the function to establish the plotting parameters using the (vlax-get-property <name> <parameter> ) method. For example the plotting device name is obtainable by (vlax-get-property <objectname> 'Configname).
What "words"/parameters do I use to find the plot orientation and paper size?
Thanks
George
Paper size
(vla-GetPaperSize (vla-get-activelayout (vla-get-activedocument (vlax-get-acad-object))) 'h 'w)
h = height
w- width
@Anonymous wrote:
What about orientation that shows in the plot dialog box. Is there no option to use vlax-put-property to assign to landscape and A3 ?
You would need to alter the plot settings using the ActiveX properties of the relevant Layout object or Plot Configuration object.
To understand what properties & methods are at your disposal for a given VLA-Object, you can either use the vlax-dump-object function (as demonstrated by this utility), or refer to the ActiveX documentation.
The following ActiveX properties of a VLA Layout Object are relevant to plotting:
CanonicalMediaName CenterPlot ConfigName PaperUnits PlotHidden PlotOrigin PlotRotation PlotType PlotViewportBorders PlotViewportsFirst PlotWithLineweights PlotWithPlotStyles ScaleLineweights ShowPlotStyles StyleSheet ViewToPlot
Canonical media names aren't always so straightforward. I'd recommend manually setting the page size first, then getting the property value and copying it to your code.
Thank you for your help, but I cannot get the vla-getPaperSize to do anything. I have run the following code
(vl-load-com)
(setq AcadObject (vlax-get-acad-object))
(setq AcadDocument (vlax-get-property AcadObject 'ActiveDocument))
(setq ActiveLayt (vlax-get-property AcadDocument 'ActiveLayout))
(setq ActivePlt (vlax-get-property ActiveLayt 'Configname))
This code produces output and shows me the active plotter so it seems to work in principle.
When I try (vla-GetPaperSize ActiveLayt 'h 'w) it just returns nil - is my syntax correct? I cannot find information in the Help system regarding this function.
Is there a paramenter name whhich show landscape or portrait or do I have to use the height and width and do (if h > w then mode=protrait) logic?
What I am REALLY trying to do is set the plotting orientation to Landscape (these words used in the plot dialog box) because I have a large number of layouts in many drawings where probably a new printer driver defaults to portrait mode. I am trying to automate the change. I am totally new to VBA but I have been able to master (with help) changing the printer name. Thanks once again.
Where do I find Help on the (vla-GetPaper..... series of functions?
Hi,
This code gets paper size for all layouts:
(defun c:Demo ( / ps p) (vl-load-com) (foreach x (layoutlist) (cond ((not lay) (setq lay (vla-get-activelayout(vla-get-activedocument (vlax-get-acad-object))))) ) (setq ps (vla-getpapersize lay 'w 'h)) (setq p (cons (strcat x ": " (rtos w 2 1) "x" (rtos h 2 1)) p)) );foreach (foreach lays (reverse p) (print lays)(princ) );foreach )
Abbas
-------Methods------------------- CopyFrom Delete GetCanonicalMediaNames GetCustomScale GetExtensionDictionary GetLocaleMediaName GetPaperMargins GetPaperSize GetPlotDeviceNames GetPlotStyleTableNames GetWindowToPlot GetXData RefreshPlotDeviceInfo SetCustomScale SetWindowToPlot SetXData ------Properties-------------------- Application CanonicalMediaName CenterPlot ConfigName Document Handle HasExtensionDictionary ModelType Name ObjectID ObjectID32 ObjectName OwnerID OwnerID32 PaperUnits PlotHidden PlotOrigin PlotRotation PlotType PlotViewportBorders PlotViewportsFirst PlotWithLineweights PlotWithPlotStyles ScaleLineweights ShowPlotStyles StandardScale StyleSheet UseStandardScale ViewToPlot ------Events-------------------- Modified
To set the paper size, use the "CanonicalMediaName" property.
Thanks,
Abbas
george.drayton wrote:When I try (vla-GetPaperSize ActiveLayt 'h 'w) it just returns nil - is my syntax correct?
Yes, although the first output parameter is the width and the second is the height, so you might want to reverse the symbols. The method will indeed return nil, with the results assigned to the symbols supplied as the output parameters.
Here is a quick console demonstration:
_$ (vla-getpapersize (vla-get-activelayout (vla-get-activedocument (vlax-get-acad-object))) 'w 'h) nil _$ w 210.058 _$ h 296.884
george.drayton wrote:
I cannot find information in the Help system regarding this function.
There is no formal ActiveX reference for Visual LISP, but the ActiveX & VBA Reference can be found in the acadauto.chm compiled help file, and there is an online version available here (though, note that this is a Russian site and isn't published by Autodesk). The specific documentation for the getpapersize method can be found here.
george.drayton wrote:Is there a paramenter name which show landscape or portrait or do I have to use the height and width and do (if h > w then mode=protrait) logic?
Not as far as I know - you will need to test which of the width & height values is greatest and proceed accordingly.
george.drayton wrote:What I am REALLY trying to do is set the plotting orientation to Landscape
For this you will need to alter the ActiveX plotrotation property of the plot configuration or layout.
@Lee_Mac wrote:
george.drayton wrote:
When I try (vla-GetPaperSize ActiveLayt 'h 'w) it just returns nil - is my syntax correct?
Yes, although the first output parameter is the width and the second is the height, so you might want to reverse the symbols....
Ahhh, that would be my bad LM, [message 2]