Author Topic: Get paper size and plot scale  (Read 4823 times)

0 Members and 1 Guest are viewing this topic.

Craig

  • Guest
Get paper size and plot scale
« 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:

Jeff_M

  • King Gator
  • Posts: 4096
  • C3D user & customizer
Get paper size and plot scale
« Reply #1 on: May 12, 2005, 02:44:28 PM »
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.
Code: [Select]

(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)

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Get paper size and plot scale
« Reply #2 on: May 12, 2005, 02:50:03 PM »
Here is some more on the subject.
http://forums.augi.com/showthread.php?t=19159
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Craig

  • Guest
Get paper size and plot scale
« Reply #3 on: May 12, 2005, 03:29:40 PM »
Quote from: Jeff_M
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.
Code: [Select]

(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...

Craig

  • Guest
Get paper size and plot scale
« Reply #4 on: May 12, 2005, 03:30:53 PM »
Here's the entire list
Code: [Select]
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

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Get paper size and plot scale
« Reply #5 on: May 12, 2005, 03:35:26 PM »
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?
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

Craig

  • Guest
Get paper size and plot scale
« Reply #6 on: May 12, 2005, 03:53:24 PM »
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

Craig

  • Guest
Get paper size and plot scale
« Reply #7 on: May 12, 2005, 03:56:13 PM »
Forgot to add, thanks for the code Jeff. I see how it works now and I can convert the results to inches

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Get paper size and plot scale
« Reply #8 on: May 12, 2005, 03:56:28 PM »
Quote from: Craig
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.

:)
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

Jeff_M

  • King Gator
  • Posts: 4096
  • C3D user & customizer
Get paper size and plot scale
« Reply #9 on: May 12, 2005, 05:39:24 PM »
Quote from: Craig
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.