Jump to content

Some Simple Autolisp Questions.


SteveK

Recommended Posts

  • Replies 59
  • Created
  • Last Reply

Top Posters In This Topic

  • Lee Mac

    22

  • SteveK

    20

  • CAB

    8

  • MSasu

    6

Top Posters In This Topic

CAB, about your layout select program. I want to run it from another lisp to get the tab list. After I run it is there a way to retrieve the tablst variable? Or is setting tablst as a global variable the only way?

Thanks.

Link to comment
Share on other sites

Steve,

Use this version & it will return the list or nil if none selected.

(defun GetTabList (/ dclfile dcl# layouts ptr tablist)
 (setq dclfile "LayoutSelect.dcl")
 (cond
   ((< (setq dcl# (load_dialog dclfile)) 0) ; Error 
    (prompt (strcat "\nCannot load " dclfile "."))
   )
   ((not (new_dialog "layoutselect" dcl#)) ; Error 
    (prompt (strcat "\nProblem with " dclfile "."))
   )
   (t ; No DCL problems: fire it up 
    (setq layouts (vl-sort (layoutlist) '<))
    (start_list "layouts")
    (foreach one layouts
      (add_list one)
    )
    (end_list)
   (action_tile "layouts" "(setq ptr $value)")
   (action_tile "ok" "(done_dialog 5)")
   (action_tile "cancel" "(done_dialog 1)")
    (setq action (start_dialog))
    (unload_dialog dcl#)
    (if (and ptr (= action 5)) ;  get the list of selections to list of numbers
      (setq ptr     (read (strcat "(" ptr ")"))
            tablist (mapcar '(lambda (x) (nth x layouts)) ptr))
    )
   ) ; end cond T
 ) ; end cond
 tablist
)

Link to comment
Share on other sites

Yes, it is a function defined in the ai_utils.lsp in the ACAD Support folder :)

 

Try it at the command line :)

 

Lee,

I couldn't find that file anywhere - any Idea?

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...