Jump to content

Print selected views from model space


tazzzz

Recommended Posts

Hello,

I have a LISP that used to work perfect until I switched to Acad2017.

I installed the new Dos_lib for Acad2017 and I still get the same error: "error: no function definition:Dos_Multilist.

Is there a way to achieve the same result without using Dos_lib or fixing this code to work with Acad2017?

This is the code(created by Stefan BMR):

(defun c:plotview ( / acobj acdoc views view_list)
 (setq acobj (vlax-get-acad-object)
       acdoc (vla-get-activedocument acobj)
       views (vla-get-views acdoc)
       )
 (vlax-for view views
   (setq view_list (cons (vla-get-name view) view_list))
   )
 (foreach view (dos_multilist "PLOT SELECTED VIEWS" "Select views to plot" view_list)
   (command
     "_plot"
     "_y"
     "Model"
     "DWG To PDF.pc3"
     "ANSI A (11.00 x 8.50 Inches)"
     "Inches"
     "Landscape"
     "No"
     "View"
     view
     "Fit"
     "Center"
     "Yes"
     "ICP.ctb"
     "Yes"
     "A"
     (strcat (getvar 'dwgprefix) (vl-filename-base (getvar 'dwgname)) " - " view ".pdf")
     "No"
     "Yes"
     )
   )
 (princ)
 )

Thank you

Link to comment
Share on other sites

  • Replies 39
  • Created
  • Last Reply

Top Posters In This Topic

  • rlx

    14

  • BrianTFC

    9

  • BIGAL

    6

  • tazzzz

    5

Top Posters In This Topic

Posted Images

Dos_Mulitlist still works in Acad2017.

 

Two things that you will want to check. Is doslib loaded? Are you using the correct arx?

 

For 2017 on a 64 bit machine it should be DOSLib21x64.arx

 

I am currently using DosLib21x64 on Acad 2017 and it is working just fine.

 

regards,

 

Hippe013

Link to comment
Share on other sites

Dos_lib is loaded and I use DOSLib21x64.arx on a 64 bit machine.

Perhaps it's an issue with the lisp?

Any ideas how to make this work are appreciated.

Thank you

Link to comment
Share on other sites

Do you have a lisp(you can share)capable of doing the same thing ?:

-showing views in model space

-let you select the views that you want to plot

Link to comment
Share on other sites

I did write a plot lisp that also can plot views but it's relatively old and I'm not sure if all options work. Never quite finished it and probably could write some parts of the code much better by now , just not enough hours in a day...

 

 

Anywayz , maybe it's usefull , at least the view part I hope. Once dialog has started (I hope) , go to advanced options and select view in the plot range section.

 

 

gr. Rlx

RLPlot.dcl

RLPlot.LSP

rlplot1.jpg

rlplot2.jpg

Edited by rlx
Link to comment
Share on other sites

Nice one RLX need extra to "Plot all tabs" "Plot range"

 

Tazzz http://www.lee-mac.com/listbox.html this should replace the DOSLIB function.

 

 

 

Thanx Bigal... I really should finish it (one day) but looking on the bright side , company I'm working at moment has decided there's no more room for an engineerings department so end of this year I just might have all the time I need :-)

 

 

gr.R.

Link to comment
Share on other sites

BIGAL, rlx thank you for your postings.

Since I am still learning LISP , at this point I find it difficult to call Lee's function (and to replace dos_multilist).

These are both programs and the small change I did:

;; created by Stefan BMR
(defun c:plotview ( / acobj acdoc views view_list [color="red"]LISTBOX[/color])
 (setq acobj (vlax-get-acad-object)
       acdoc (vla-get-activedocument acobj)
       views (vla-get-views acdoc)
       )
 (vlax-for view views
   (setq view_list (cons (vla-get-name view) view_list))
   )
 (foreach view ([color="red"]LISTBOX[/color] "PLOT SELECTED VIEWS" "Select views to plot" view_list)
   (command
     "_plot"
     "_y"
     "Model"
     "DWG To PDF.pc3"
     "ARCH C (24.00 x 18.00 Inches)"
     "Inches"
     "Landscape"
     "No"
     "View"
     view
     "Fit"
     "Center"
     "Yes"
     "ICP.ctb"
     "Yes"
     "A"
     (strcat (getvar 'dwgprefix) (vl-filename-base (getvar 'dwgname)) " - " view ".pdf")
     "No"
     "Yes"
     )
   )
 (princ)
 )


;;Created by Lee Mac
;; bit - [int] 1=allow multiple; 2=return indexes
;; Returns: [lst] List of selected items/indexes, else nil

(defun LM:listbox ( msg lst bit / dch des tmp rtn )
   (cond
       (   (not
               (and
                   (setq tmp (vl-filename-mktemp nil nil ".dcl"))
                   (setq des (open tmp "w"))
                   (write-line
                       (strcat "listbox:dialog{label=\"" msg "\";spacer;:list_box{key=\"list\";multiple_select="
                           (if (= 1 (logand 1 bit)) "true" "false") ";width=50;height=15;}spacer;ok_cancel;}"
                       )
                       des
                   )
                   (not (close des))
                   (< 0 (setq dch (load_dialog tmp)))
                   (new_dialog "listbox" dch)
               )
           )
           (prompt "\nError Loading List Box Dialog.")
       )
       (   t     
           (start_list "list")
           (foreach itm lst (add_list itm))
           (end_list)
           (setq rtn (set_tile "list" "0"))
           (action_tile "list" "(setq rtn $value)")
           (setq rtn
               (if (= 1 (start_dialog))
                   (if (= 2 (logand 2 bit))
                       (read (strcat "(" rtn ")"))
                       (mapcar '(lambda ( x ) (nth x lst)) (read (strcat "(" rtn ")")))
                   )
               )
           )
       )
   )
   (if (< 0 dch)
       (unload_dialog dch)
   )
   (if (and tmp (setq tmp (findfile tmp)))
       (vl-file-delete tmp)
   )
   rtn
)

Hope someone will help me with this task

Thank you

Link to comment
Share on other sites

try this :

 


;; created by Stefan BMR
(defun c:plotview ( / acobj acdoc views view_list LISTBOX)
 (vl-load-com)
 (setq acobj (vlax-get-acad-object)
       acdoc (vla-get-activedocument acobj)
       views (vla-get-views acdoc)
       )
 (vlax-for view views
   (setq view_list (cons (vla-get-name view) view_list))
   )
 (foreach view (LM:listbox "Select views to plot" view_list 1)
   (command
     "_plot"
     "_y"
     "Model"
     "DWG To PDF.pc3"
     "ARCH C (24.00 x 18.00 Inches)"
     "Inches"
     "Landscape"
     "No"
     "View"
     view
     "Fit"
     "Center"
     "Yes"
     "ICP.ctb"
     "Yes"
     "A"
     (strcat (getvar 'dwgprefix) (vl-filename-base (getvar 'dwgname)) " - " view ".pdf")
     "No"
     "Yes"
     )
   )
 (princ)
 )


;;Created by Lee Mac
;; bit - [int] 1=allow multiple; 2=return indexes
;; Returns: [lst] List of selected items/indexes, else nil

(defun LM:listbox ( msg lst bit / dch des tmp rtn )
   (cond
       (   (not
               (and
                   (setq tmp (vl-filename-mktemp nil nil ".dcl"))
                   (setq des (open tmp "w"))
                   (write-line
                       (strcat "listbox:dialog{label=\"" msg "\";spacer;:list_box{key=\"list\";multiple_select="
                           (if (= 1 (logand 1 bit)) "true" "false") ";width=50;height=15;}spacer;ok_cancel;}"
                       )
                       des
                   )
                   (not (close des))
                   (< 0 (setq dch (load_dialog tmp)))
                   (new_dialog "listbox" dch)
               )
           )
           (prompt "\nError Loading List Box Dialog.")
       )
       (   t     
           (start_list "list")
           (foreach itm lst (add_list itm))
           (end_list)
           (setq rtn (set_tile "list" "0"))
           (action_tile "list" "(setq rtn $value)")
           (setq rtn
               (if (= 1 (start_dialog))
                   (if (= 2 (logand 2 bit))
                       (read (strcat "(" rtn ")"))
                       (mapcar '(lambda ( x ) (nth x lst)) (read (strcat "(" rtn ")")))
                   )
               )
           )
       )
   )
   (if (< 0 dch)
       (unload_dialog dch)
   )
   (if (and tmp (setq tmp (findfile tmp)))
       (vl-file-delete tmp)
   )
   rtn
)

 

gr. Rlx

Link to comment
Share on other sites

One little suggestion no need to live inside the view code.

 

(if (not LM:listbox)(load "listboxV1-2")) 
(foreach view (LM:listbox "Select views to plot" view_list 1)

Link to comment
Share on other sites

  • 1 year later...

Rlx,

 

Is there a way to modify this routine to where the user can pick the location of where the files are being saved instead of the source folder?

 

Thanks,

Brian

Link to comment
Share on other sites

Rlx,

 

Is there a way to modify this routine to where the user can pick the location of where the files are being saved instead of the source folder?

 

Thanks,

Brian

 

untested

;; created by Stefan BMR
(defun c:plotview ( / acobj acdoc views view_list listbox folder)
 (vl-load-com)
 (setq acobj (vlax-get-acad-object) acdoc (vla-get-activedocument acobj)  views (vla-get-views acdoc))
 (vlax-for view views (setq view_list (cons (vla-get-name view) view_list)))
 (if (not (setq folder (getfolder "Select folder to save views")))
   (setq folder (getvar 'dwgprefix))(setq folder (strcat folder "\\")))
   
 (foreach view (LM:listbox "Select views to plot" view_list 1)
   (command "_plot" "_y"  "Model" "DWG To PDF.pc3" "ARCH C (24.00 x 18.00 Inches)" "Inches" "Landscape" "No" "View" view
            "Fit" "Center" "Yes" "ICP.ctb" "Yes" "A"
            (strcat folder (vl-filename-base (getvar 'dwgname)) " - " view ".pdf")
            "No" "Yes"))(princ))


;;Created by Lee Mac
;; bit - [int] 1=allow multiple; 2=return indexes
;; Returns: [lst] List of selected items/indexes, else nil

(defun LM:listbox ( msg lst bit / dch des tmp rtn )
 (cond
   ((not (and (setq tmp (vl-filename-mktemp nil nil ".dcl"))(setq des (open tmp "w"))
              (write-line (strcat "listbox:dialog{label=\"" msg "\";spacer;:list_box{key=\"list\";multiple_select="
                                  (if (= 1 (logand 1 bit)) "true" "false") ";width=50;height=15;}spacer;ok_cancel;}" ) des)
              (not (close des))(< 0 (setq dch (load_dialog tmp)))(new_dialog "listbox" dch)))
           (prompt "\nError Loading List Box Dialog."))
   (t (start_list "list") (foreach itm lst (add_list itm)) (end_list)(setq rtn (set_tile "list" "0"))
    (action_tile "list" "(setq rtn $value)")
    (setq rtn (if (= 1 (start_dialog)) (if (= 2 (logand 2 bit))(read (strcat "(" rtn ")"))
                                         (mapcar '(lambda ( x ) (nth x lst)) (read (strcat "(" rtn ")"))))))))
 (if (< 0 dch)(unload_dialog dch))(if (and tmp (setq tmp (findfile tmp))) (vl-file-delete tmp))  rtn )

(defun getfolder  (msg / fl sh)
 (if (and (setq sh (vlax-create-object "Shell.Application"))(setq fl (vlax-invoke sh 'browseforfolder 0 msg 0 "")))
   (setq fl (vlax-get-property (vlax-get-property fl 'self) 'path))(setq fl nil))(release_me (list sh)) fl)

(defun release_me  (lst)
 (mapcar '(lambda (x)(if (and (= 'vla-object (type x))(not (vlax-object-released-p x)))(vlax-release-object x))(set (quote x) nil)) lst))

gr. Rlx

Link to comment
Share on other sites

Our pdf's are hard coded to go one level below the dwg location so everyone knows where to look this is check for directory if not exist make it.

 

; check that pdf directory exists
(setq dwgpre (strcat (getvar "dwgprefix") "\pdf"))
(if (= (vl-file-directory-p dwgpre) nil)
(vl-mkdir dwgpre)
)

Link to comment
Share on other sites

Rlx,

 

Is there a way to combine the PDF's in this lisp into one document without using a third party program like Publish does?

 

Thanks,

Brian

Link to comment
Share on other sites

Rlx,

 

Is there a way to combine the PDF's in this lisp into one document without using a third party program like Publish does?

 

Thanks,

Brian

 

now I come to think about it , good question , could use this myself. Haven't checked this out yet but will try monday :

 

http://www.cadtutor.net/forum/showthread.php?97827-Plot-to-PDF-and-Combine-into-one-file

 

http://www.cadtutor.net/forum/showthread.php?96713-PDF-Combine-Software

 

although Roy_043 talks about ghostscript and I'm not sure I can use that because on my work IT has a competition who can block the most options.

 

gr. Rlx

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...