TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: Craig on May 12, 2005, 02:26:11 PM
-
Can anyone give me direction in getting the page size and plot scale using vl commands. Lets say when I'm in the plot dialogue it shows the sheet size and the 1:1 scale, those are the items I want to extract out.
Anyone?
trying to grasp this vlsip stuff :oops:
-
Here's a start for you. The help doesn't mention this, but it appears that the GetPaperSize method returns values in mm regardless of the units setting.
(setq acadApp (vlax-get-acad-object)
ThisDwg (vla-get-activedocument acadApp)
CurLayout (vla-get-activelayout ThisDwg))
(vla-refreshplotdeviceinfo CurLayout)
(vla-getcustomscale CurLayout 'scaleN 'scaleD)
(vla-getpapersize CurLayout 'paperW 'paperH)
-
Here is some more on the subject.
http://forums.augi.com/showthread.php?t=19159
-
Here's a start for you. The help doesn't mention this, but it appears that the GetPaperSize method returns values in mm regardless of the units setting.
(setq acadApp (vlax-get-acad-object)
ThisDwg (vla-get-activedocument acadApp)
CurLayout (vla-get-activelayout ThisDwg))
(vla-refreshplotdeviceinfo CurLayout)
(vla-getcustomscale CurLayout 'scaleN 'scaleD)
(vla-getpapersize CurLayout 'paperW 'paperH)
Why are the vla functions returning nil? When I do a (vlax-dump-object CurLayout T) I see those 3 entries as listed below.
GetCustomScale (2)
GetPaperSize (2)
RefreshPlotDeviceInfo ()
Do understand I am new to VLISP so these may seem stupid questions but since this is a bit different from autolisp...
-
Here's the entire list
Command: (setq a (vlax-dump-object CurLayout T))
; IAcadLayout: The plot settings and visual properties of a model space or
paper space block
; Property values:
; Application (RO) = #<VLA-OBJECT IAcadApplication 00b9b5e4>
; Block (RO) = #<VLA-OBJECT IAcadPaperSpace2 0f4ecc64>
; CanonicalMediaName = "User286"
; CenterPlot = -1
; ConfigName = "\\\\MEDC1\\HP1050C"
; Document (RO) = #<VLA-OBJECT IAcadDocument 1b1bef90>
; Handle (RO) = "1FE"
; HasExtensionDictionary (RO) = -1
; ModelType (RO) = 0
; Name = "Layout1"
; ObjectID (RO) = 1963920176
; ObjectName (RO) = "AcDbLayout"
; OwnerID (RO) = 1963883728
; PaperUnits = 0
; PlotHidden = 0
; PlotOrigin = (-5.03975 -13.3464)
; PlotRotation = 1
; PlotType = 1
; PlotViewportBorders = 0
; PlotViewportsFirst = -1
; PlotWithLineweights = -1
; PlotWithPlotStyles = -1
; ScaleLineweights = 0
; ShowPlotStyles = 0
; StandardScale = 0
; StyleSheet = "1-mec-monochrome.ctb"
; TabOrder = 1
; UseStandardScale = 0
; ViewToPlot = ""
; Methods supported:
; CopyFrom (1)
; Delete ()
; GetCanonicalMediaNames ()
; GetCustomScale (2)
; GetExtensionDictionary ()
; GetLocaleMediaName (1)
; GetPaperMargins (2)
; GetPaperSize (2)
; GetPlotDeviceNames ()
; GetPlotStyleTableNames ()
; GetWindowToPlot (2)
; GetXData (3)
; RefreshPlotDeviceInfo ()
; SetCustomScale (2)
; SetWindowToPlot (2)
; SetXData (2)
T
-
vla-getcustomscale and vla-getpapersize write their 'results' to the quoted arguments passed, that is, they receive the values.
Type this on the command line after executing Jeff's code:
!scalen [enter]
!scaled [enter]
!paperw [enter]
!paperh [enter]
What do you see?
-
Preciate that Michael. Instead of the (setq paperh.......now I've learned one more thing
Maybe I should put a disclaimer on any vlisp question :lol:
Thanks
-
Forgot to add, thanks for the code Jeff. I see how it works now and I can convert the results to inches
-
Maybe I should put a disclaimer on any vlisp question
Why? We're all learning here, that's what makes it fun, worthwhile. The day I stop learning is the day I take my last breath.
:)
-
Forgot to add, thanks for the code Jeff. I see how it works now and I can convert the results to inches
Your welcome! And to help you decipher the things that (vlax-dump..) gives you:
; GetPlotStyleTableNames () Requires no arguments
; GetPaperSize (2) Requires 2 arguments
; GetXData (3) Requires 3 arguments
But just knowing how MANY arguments a method requires is not enough. You need to check the descriptor in the help to see if it a supplied value or a returned value. If it is a returned value you must supply an empty variable for it to fill, else you must pass it a value. So in the GetXdata method you would pass it the first value, but would need to supply 2 empty variables for the last 2.