Jump to content
rcb007

Adding Dialog Prompt to command line question

Recommended Posts

rcb007
Posted (edited)

I need to figure out how to add a dialog popup box into the below routine. It is there to ask what layout tab you would want to use and then how many copies. I have alerts up to notify the user to place the commands at the command line. Just not sure if that is the best approach.

 

(defun c:Layouts_Duplicate ( / *error* oCMDECHO ctab name namer namei nname n i x )
  



  (Alert "Which Layout Tab to Duplicate?\n\nFor (Current Tab Press Enter):")
  (setq ctab (getvar "ctab"))
  (setq name (getstring (strcat "\nLayout to duplicate <" ctab "> (Current Tab Press Enter): "))) ;;;;;;; <<<<<--- Prompt for a Dialog for the user to set the value?
  (if (= name "") (setq name ctab))
  (setq n (1+ (strlen name))
        namei "")
  




  (while (and (> n 1)
              (wcmatch (setq x (substr name (setq n (1- n)) 1)) "#"))
    (setq namei (strcat x namei)))
  
  (setq namer (substr name 1 (- (strlen name) (strlen namei)))
        namei (atoi namei))
  
  (initget 6)





  (Alert "How many additional Layout Tabs needed?\n\n(Matchline Viewports)") 
  (setq n (getint "\nHow many additional layout tabs needed: ")  ;;;;;;; <<<<<--- Prompt for a Dialog for the user to set the value?
        i (+ 1 namei n))
  




  (repeat n
    (setq nname (strcat namer (itoa (setq i (1- i)))))
    (if (member nname (layoutlist))
      (princ (strcat "\nLayout '" nname " ' already exists."))
      (command "_.LAYOUT" "_Copy" name (strcat namer "a")
               "_.LAYOUT" "_Rename" (strcat namer "a") nname)))

  (foreach name	(layoutlist)
    (setvar 'ctab name)
    (setq n (cdr (assoc -1 (dictsearch (namedobjdict) "acad_layout"))))
    (command "-layer"
	     "Freeze"
	     "Matchline*"
	     "Thaw"
	     (strcat "*Area" (itoa (cdr (assoc 71 (dictsearch n name)))))
	     ""
    )
    (command "_mspace")
    (command "zoom" "extents")
    (command "ZOOM" "Scale" "1/10xp")
    (command "_pspace")
  )

(command "-xref" "reload" "*")
  (setvar 'CMDECHO oCMDECHO)
  (princ))

(c:Layouts_Duplicate)

thank you for any direction.

Edited by rcb007

Share this post


Link to post
Share on other sites
plackowski

You can use the DCL tools. I just started working with them myself recently, but the gist is that you write a DCL file (you can write and then run this from inside your existing LISP) which generates the dialog box. Take a look here for more info: https://www.afralisp.net/dialog-control-language/

Share this post


Link to post
Share on other sites
BIGAL

If you want a pop up list then have a look at Lee-mac.com he has a good one can populate the list with the layout names. 

 

So would replace at this point, note can make current layout the current highlited layout 

(Alert "Which Layout Tab to Duplicate?\n\nFor (Current Tab Press Enter):")

Share this post


Link to post
Share on other sites
tombu

Le Mac's http://www.lee-mac.com/tabsort.html lets you pick the Layout tab in a dialog box to copy, move, sort, rename, add prefix/suffix, or set current. There's even a help file.

A program designed with the intention to aid in the organisation of layout tabs in a drawing, the program enables the user to organise each layout tab using intuitively engineered buttons to move selected tabs up/down or to the top/bottom of the tab order.

The program also offers the ability to rename a layout tab by double-clicking on its entry in the list displayed, and furthermore add a prefix and/or suffix to selected/every layout tab.

A facility is also provided to add & delete layout tabs, and also sort the tabs into alphabetical, numerical, or architectural order; or reverse the order currently displayed.

A Find & Replace functionality is also offered to allow the user to quickly replace a text string in multiple layout tabs.

The user may also copy selected layout tabs, or set the selected entry as the current drawing layout.

A Help Dialog may be shown upon pressing H at the Main Dialog interface.

Share this post


Link to post
Share on other sites
rcb007

Thanks guys for the feedback. I will look into this.

Share this post


Link to post
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
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

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