Author Topic: Cannot Get LiSP to Set Scale and MM  (Read 1497 times)

0 Members and 1 Guest are viewing this topic.

MGorecki

  • Guest
Cannot Get LiSP to Set Scale and MM
« on: September 06, 2018, 12:32:16 PM »
I have a LiSP program that is just supposed to create a multi-Sheet PDF from the drawing layouts.  It sort-of works in that it creates the PDF file, but it only prints the bottom left corners of the sheets due to scaling.

Here is the code:
Code: [Select]
(vl-load-com)
 (setq dwgName (substr (setq str (getvar "dwgname")) 1 (- (strlen str) 4)))
 (setq fileName (getfiled "Save As" dwgName "pdf" 1))
 (command "UNDO" "m")
 (setq acadObj (vlax-get-acad-object))
 (setq acadDoc (vla-get-ActiveDocument acadObj))
 ; Get layouts collection from document object
 (setq Layouts (vla-get-Layouts acadDoc))
 (vlax-for layout Layouts
  (vlax-put-property layout 'ConfigName "DWG to PDF.pc3")
  (setq PaperSize "ISO_full_bleed_A3_(420.00_x_297.00_MM)")
  (vla-put-CanonicalMediaName layout PaperSize)
  (vla-put-PaperUnits layout 1) ;set units to mm
  (vla-put-StandardScale layout 0) ;set the scale to 1:1
  (vla-put-UseStandardScale layout 1)
  (vla-put-plotrotation layout 0)
  (command "regenall")
  (vla-RefreshPlotDeviceInfo layout)
 )
 (command "_.-export" "PDF" "All" fileName)
 (command "UNDO" "b")
 (command "regenall")
 (setq alertMsg (strcat fileName ".pdf\nHas been created"))
 (alert alertMsg)
 (princ)

I have tried changing PaperUnits, StandardScale, and UseStandardScale, but nothing gets me to the result I need in the attached picture (Scale 1:1 and units set to mm).

Thanks in advance for any help you can give me.
Mark

MGorecki

  • Guest
Re: Cannot Get LiSP to Set Scale and MM
« Reply #1 on: September 06, 2018, 12:49:35 PM »
Ok, never mind.  I finally got it to work by removing the line:
(vla-RefreshPlotDeviceInfo layout)

It was in one of the examples and I just never questioned it.