Author Topic: page setup routine  (Read 6748 times)

0 Members and 1 Guest are viewing this topic.

MvdP

  • Guest
page setup routine
« on: September 05, 2005, 10:52:16 AM »
I have written a pagesetup routine.
In here in can choose scale and papersize and its makes layers, dimstyles and text styles and inserts a stamp if wanted.
But....... this only works in modelspace.
So now i am in the proces of trying to improve this routine by adding  a toggle in my dcl (This part is already working)that when activated it will show 4 popuplists (not activated greyed-out)in which i can choose all availabele plotters,its papersizes,all availabele plotstyles and scale.I know this can be done with visual  lisp but it much more difficult than lisp.So can somebody help me in the right direction how to make the 4  listings and show me how to assign the selected items to the new layout.

I know i am asking a lot but in advance thanks for your collaboration.

MvdP

Some pieces of code i found on the net...


; Return a list of all Plotter configurations
(defun PlotDeviceNamesList ()
  (vla-RefreshPlotDeviceInfo (ActLay))
  (vlax-safearray->list
    (vlax-variant-value
      (vla-GetPlotDeviceNames
   (ActLay)
      )
    )
  )
)


; Return a list of all Plot style tables
(defun PlotStyleTableNamesList ()
  (vla-RefreshPlotDeviceInfo (ActLay))
  (vlax-safearray->list
    (vlax-variant-value
      (vla-GetPlotStyleTableNames
   (ActLay)
      )
    )
  )
)





« Last Edit: September 05, 2005, 11:08:57 AM by MvdP »

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: page setup routine
« Reply #1 on: September 05, 2005, 12:47:00 PM »
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.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: page setup routine
« Reply #2 on: September 05, 2005, 12:51:09 PM »
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.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: page setup routine
« Reply #3 on: September 05, 2005, 12:54:09 PM »
Here ia another that may be of interest.
http://www.theswamp.org/forum/index.php?topic=1916.0
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.

MvdP

  • Guest
Re: page setup routine
« Reply #4 on: September 05, 2005, 02:00:28 PM »
That is indeed "some" reading.....and doing it right now.
Thanks CAB

MvdP

  • Guest
Re: page setup routine
« Reply #5 on: September 06, 2005, 08:50:24 AM »
This is some of what i got sofar,but i can't get it to work what am i missing here.?
When i type (princ device-list) on the command line a can see all the plotters but they aint show up in my dropdownlist.


;;===============================================
(defun plotall_device_list (/ curdwg pslayout)
  (vl-load-com)
  (setq
    curdwg (vla-get-ActiveDocument (vlax-get-Acad-Object))
    pslayout (vla-get-Layout (vla-get-PaperSpace curdwg))
  )
  ; Call RefreshPlotDeviceInfo before GetPlotDeviceNames
  (vla-RefreshPlotDeviceInfo pslayout)
  (vlax-safearray->list (vlax-variant-value (vla-GetPlotDeviceNames pslayout)))
) ; End plotall_device_list

;;===============================================
  (defun init_vars ()
    (if (not PLOTALL-DEVICE) (setq PLOTALL-DEVICE "None"))
         (setq  device-list (plotall_device_list))
          (if (and PLOTALL-DEVICE (member PLOTALL-DEVICE device-list))
      (setq
        device#
         (- (length device-list) (length (member PLOTALL-DEVICE device-list)))
      )
      (setq device# 0)
    )
  ) ; End init_vars

;;===============================================



the lisp starts with
  (init_vars)
  (plotall_device_list)
 

(action_tile "tilemode" "(mode_tile \"list_plotter\" (- 1 (atoi $value)))
(mode_tile \"list_plotstyle\" (- 1 (atoi $value)))
(mode_tile \"list_papierformaat\" (- 1 (atoi $value)))
(mode_tile \"list_plotschaal\" (- 1 (atoi $value)))")
   
(action_tile "list_plottter" "(setq plt (nth (atoi $value) device-list))"  )
(action_tile "list_plotstyle" "(setq pls (nth (atoi $value) plotstyle-list))"  ) 
(action_tile "list_papierformaat" "(setq pf (nth (atoi $value) papierformaat-list))"  )
(action_tile "list_plotschaal" "(setq posch (nth (atoi $value) plotschaal-list))" )




V-Man

  • Bull Frog
  • Posts: 343
  • I exist therefore I am! Finally Retired!
Re: page setup routine
« Reply #6 on: September 06, 2005, 08:56:56 AM »

Code: [Select]
   (start_list "list_plottter" )
   (mapcar 'add_list device-list)
   (end_list)
AutoCAD 9 - 2023, AutoCADMap 2008 - 2010, Revit 2012 - 2022, Autocad Civil 3D 2023

MvdP

  • Guest
Re: page setup routine
« Reply #7 on: September 06, 2005, 09:19:18 AM »

Code: [Select]
   (start_list "list_plottter" )
   (mapcar 'add_list device-list)
   (end_list)

That didn't do the trick..

It did the trick typo

Thanks
« Last Edit: September 06, 2005, 09:50:18 AM by MvdP »

V-Man

  • Bull Frog
  • Posts: 343
  • I exist therefore I am! Finally Retired!
Re: page setup routine
« Reply #8 on: September 06, 2005, 12:11:31 PM »

Please post all code so that I can help.
AutoCAD 9 - 2023, AutoCADMap 2008 - 2010, Revit 2012 - 2022, Autocad Civil 3D 2023

MvdP

  • Guest
Re: page setup routine
« Reply #9 on: September 06, 2005, 12:16:25 PM »
What makes more sense.
To make 3 more init_vars and defuns (for plotstyle,papersize and scale) or add it to this one
;;===============================================
(defun plotall_device_list (/ curdwg pslayout)
  (vl-load-com)
  (setq
    curdwg (vla-get-ActiveDocument (vlax-get-Acad-Object))
    pslayout (vla-get-Layout (vla-get-PaperSpace curdwg))
  )
  ; Call RefreshPlotDeviceInfo before GetPlotDeviceNames
  (vla-RefreshPlotDeviceInfo pslayout)
  (vlax-safearray->list (vlax-variant-value (vla-GetPlotDeviceNames pslayout)))
) ; End plotall_device_list

;;===============================================
  (defun init_vars ()
    (if (not PLOTALL-DEVICE) (setq PLOTALL-DEVICE "None"))
         (setq  device-list (plotall_device_list))
          (if (and PLOTALL-DEVICE (member PLOTALL-DEVICE device-list))
      (setq
        device#
         (- (length device-list) (length (member PLOTALL-DEVICE device-list)))
      )
      (setq device# 0)
    )
  ) ; End init_vars

;;===============================================

If possible of course.

MvdP

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: page setup routine
« Reply #10 on: September 06, 2005, 02:05:02 PM »
Food for thought..

Code: [Select]
(defun init_vars ()
  (or PLOTALL-DEVICE (setq PLOTALL-DEVICE "None"))
  (setq device-list (plotall_device_list))
  (or (setq device# (vl-position  PLOTALL-DEVICE device-list))
      (setq device# 0)
  )
  device#
)
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.

MvdP

  • Guest
Re: page setup routine
« Reply #11 on: September 07, 2005, 01:46:07 AM »
Food for thought..

Code: [Select]
(defun init_vars ()
  (or PLOTALL-DEVICE (setq PLOTALL-DEVICE "None"))
  (setq device-list (plotall_device_list))
  (or (setq device# (vl-position  PLOTALL-DEVICE device-list))
      (setq device# 0)
  )
  device#
)


CAB
I don't understand.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: page setup routine
« Reply #12 on: September 07, 2005, 08:22:05 AM »
I was just showing you another way to write the subroutine.
Here it is with comments.

Code: [Select]
(defun init_vars ()
  ;;  'or' elvaluates expressions until one returns a non nil value
  ;;  so if PLOTALL-DEVICE is nil, it is set to "None"
  (or PLOTALL-DEVICE (setq PLOTALL-DEVICE "None"))

  ;;  same as yours, get the list
  (setq device-list (plotall_device_list))

  ;;  'or' again, sets device# to the position number OR to zero
  ;;  zero in this case being "None"
  (or (setq device# (vl-position  PLOTALL-DEVICE device-list))
      (setq device# 0)
  )

  ;;  return the device number
  device#
)
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.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: page setup routine
« Reply #13 on: September 07, 2005, 08:30:12 AM »
Why don't you take dvarino up on his offer to help you with the code.
Just attach the lisp & dcl file to your post & he can at least test it for you
on another machine. Another pair of eyes is always helpful.
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.

MvdP

  • Guest
Re: page setup routine
« Reply #14 on: September 07, 2005, 09:10:20 AM »
When i select a device in my popup-list the paper sizes arent updated so i guess i am doing something wrong.!!

So here is the huge code.
Not al that is necessary is attached in this post (stamp, fonts and external layer routines)
Remember it is my first attempt and any help is appreciated.

MvdP

Something a forgot to ask is it possible to make a default device and plotstyle.?
« Last Edit: September 07, 2005, 09:12:18 AM by MvdP »