Improvement

Discussion in 'AutoCAD' started by John, May 5, 2004.

  1. John

    John Guest

    Hi all,



    My first Autolisp routine posted previous.. I improved it and I have
    learned more about code.



    The routine required two conditions to run smoothly.



    1.. Only work on paper space.
    2.. Use command "PSETUPIN " to installed standard plot sizes before use
    this routine.


    I think, I resolve first conditions by adding these codes:



    (setq edt (getvar "tilemode"))

    (if (= edt 1)

    (progn

    (alert "To plot, Please type layout name at command line")

    (command "layout" "s" Pause)

    )

    )



    Now, I looking a way to resolve second condition something like these



    (setq ded (tblsearch "pagesetupname" "1050C (24X36)"))

    (if (= ded nil)

    (command "PSETUPIN" PLOT 1050C STANDARD.dwt " "*"))

    )



    Is any body know how to look for page set up names in the drawing



    (tblsearch table-name symbol [setnext])





    Thanks



    John
     
    John, May 5, 2004
    #1
  2. John

    Steve Doman Guest

    John try this:

    (defun GetPageSetups (/ rslt)
    ;; Function returns a list of pagesetup names
    ;; available in side the drawing
    ;; Returns nil if no pagesetups are present
    ;; (getpagesetups) -> ("Setup1" "Setup2" "Setup3")
    (vlax-for x (vla-get-plotconfigurations
    (vla-get-activedocument
    (vlax-get-acad-object)))
    (setq rslt (cons (vla-get-name x) rslt))
    )
    (reverse rslt)
    )

    Steve Doman
     
    Steve Doman, May 6, 2004
    #2
  3. John

    Steve Doman Guest

    Hit the send key too soon...

    Use the function I posted like this:

    (vl-load-com) ; add this if Vlisp extensions haven't been loaded

    (if (not (member "1050C (24X36)" (getpagesetups)))
    (command "psetupin" etc. etc. )
    )

    HTH,
    Steve
     
    Steve Doman, May 6, 2004
    #3
  4. John

    John Guest

    Steve,

    You are wonderful!!!!!!!!!! Thank you for your help.

    John
     
    John, May 6, 2004
    #4
  5. John

    Steve Doman Guest

    John,

    I had been meaning to write that function for a long time and keeped
    forgetting about it. Your post reminded me so I wipped it out. So
    thank you too!

    Regards,
    Steve
     
    Steve Doman, May 6, 2004
    #5
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.