Author Topic: Updating Layout object, with plot settings  (Read 8691 times)

0 Members and 1 Guest are viewing this topic.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Updating Layout object, with plot settings
« Reply #15 on: April 04, 2006, 11:08:28 AM »
Thanks for the help Chuck.  If there is any idea you want me to try, or to run with, just let me know.  I appreciate all the help.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

Chuck Gabriel

  • Guest
Re: Updating Layout object, with plot settings
« Reply #16 on: April 04, 2006, 12:28:00 PM »
In retrospect, I'm not sure the problem I had last night is the same problem you are having, but here goes anyway.

The problem (as I saw it) was that my lineweights didn't look right (they were all the same).  I was able to get color vs. monochrome as long as I selected a plotter that supported color.

Here is the test rig I used (modified from your and Jeff's posts):

Code: [Select]
(defun c:Test (/    AcadObj     FilesObj    ActLo
       PlotterList Plotter     PaperList   PaperSize
       ctbList    ctbFile     FitToggle   *error*
       ActDoc
      )

  (defun *error* (msg)
    (prompt (strcat "\n Error --> " msg))
    (vl-bt)
  )
;;;------------------------------------------------------------------
  (defun SelectFromList (msg alist / index choice)
    (setq index 0)
    (foreach item alist
      (terpri)
      (princ index)
      (princ (strcat "\t" item))
      (setq index (1+ index))
    )
    (princ (strcat "\n" "\n" msg))
    (initget (logior 1 4))
    (setq choice (getint))
    (nth choice alist)
  )
;;;------------------------------------------------------------------
  (setq FitToggle 1
AcadObj   (vlax-get-Acad-Object)
ActDoc   (vla-get-ActiveDocument (vlax-get-Acad-Object))
ActLo   (vla-get-ActiveLayout ActDoc)
  )
  (vla-RefreshPlotDeviceInfo ActLo)
  (setq PlotterList (vlax-invoke ActLo 'GetPlotDeviceNames)
Plotter     (SelectFromList
      "Choose the number of the plotter you wish to use: "
      PlotterList
    )
  )
  (vla-put-ConfigName ActLo Plotter)

  (setq PaperList (vlax-invoke ActLo 'GetCanonicalMediaNames)
PaperSize (SelectFromList
    "Choose the number of the paper size you wish to use: "
    PaperList
  )
  )
  (vla-put-CanonicalMediaName ActLo PaperSize)

  (setq ctbList (vlax-invoke ActLo 'GetPlotStyleTableNames)
ctbFile (SelectFromList
  "Choose the number of the style sheet you wish to use: "
  ctbList
)
  )
  (vla-put-StyleSheet ActLo ctbFile)

  (vla-put-PlotType ActLo acExtents)
  (vla-put-PlotRotation ActLo ac90degrees)
  (if (zerop FitToggle)
    (progn
      (vla-put-StandardScale ActLo acVpCustomScale)
      (vla-SetCustomScale ActLo (/ 1.0 (rtos (last lst))))
    )
    (vla-put-StandardScale ActLo acVpScaleToFit)
  )
  (vla-put-PlotHidden ActLo :vlax-false)
  (vla-put-ScaleLineweights ActLo :vlax-false)
  (vla-put-ShowPlotStyles ActLo :vlax-true)
  (vla-put-PlotWithLineweights ActLo :vlax-true)
  (vla-Regen ActDoc acActiveViewport)
  (vla-DisplayPlotPreview (vla-get-plot ActDoc) acFullPreview)
  (princ)
)

Note that I only called RefreshPlotDeviceInfo once.  According to the docs, that's all you need.

What it took to get my lineweights to print properly was to set ScaleLineweights to false.

I hope that helps, but if that isn't the problem you are having, maybe it will help someone else.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Updating Layout object, with plot settings
« Reply #17 on: April 04, 2006, 12:38:17 PM »
This got me closer, but it is still showing the preview with the wrong ctb file.  It shows the right one in the dialog box, but it won't print/preview with that one.  It will print/preview with the one assigned to the drawing prior to the command being called.

Thanks for trying.  This is so frustrating.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Updating Layout object, with plot settings
« Reply #18 on: April 05, 2006, 12:02:54 PM »
Since I/we couldn't get this to work on MY system, I just went the command route, and it seems to work.  Thanks for all the effort, and letting me know that I was coding right, it's just my setup here doesn't like it for some reason.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.