Jump to content
ericjlarson-metopera

Dynamically Generated .DCL file issues

Recommended Posts

ericjlarson-metopera

Hi Everyone,

 

I've been lurking here for over a year now and have found lots of useful information (thanks!), but I've finally done something that doesn't seem to have been solved before, and that there may be no easy answer to.

 

We use a complicated system of layer states, views, and freezing and unfreezing layers to set up different print states to create a package of drawings. It is sort of a wacky use of AutoCAD, but this is due to the necessity of showing an opera as it progresses through time (Act 1, Act 2, etc.). We have hundreds of operas in our repertory and this won't be changing anytime soon.

 

Anyway, as it stands now, there is a .txt file that lives in the same directory as the file containing the scenery that is manually created so that print scripts can work. I am attempting to turn that .txt file into something that lives in a dialog box for ease of use and cleanliness. The data will be stored in a mulitline attribute in a block.

 

I've spent a fair amount of time creating a dialog box that changes size dynamically, allows for reordering of printouts and having multiple scenery layers appear on the same printout. My only real issue (which is of course a big one) is that if you add too many rows, the dialog box becomes too big to fit on the screen. What I would love to be able to do is to make the whole box (except the buttons at the bottom) scroll up and down so that the height of the dialog box is fixed to the smallest screen we use here (~800 pixels). I've spent a little time with OpenDCL but find it a bit byzantine, and I don't know any .NET or VBA so either of those solutions will involve me learning some new programming languages--not necessarily a deal breaker but not ideal either.

 

I'm attaching a .dwg with the attributed block and the .lsp file for anyone who wants to take a look. The command c:met_plot_2015 will create and open the dialog box, which you can then manipulate.

 

I appreciate anyone who read to the end of this post, and any help you can provide.

 

Thanks,

Eric

 

P.S. The printing function doesn't actually work yet; that's next on the list once I solve this.

 

specialblock.dwg

 

BETTERPRINTING 5.LSP

Share this post


Link to post
Share on other sites
BIGAL

Did not look at code but you can have a list box and it can have as many lines as you like, scroll up and down. It would work with reading a text file to say put a short version for what you want to pick.

 

; very much thanks to Alan J T for original code

 ;; List Select Dialog (Temp DCL list box selection, based on provided list)
 ;; title - list box title
 ;; label - label for list box
 ;; height - height of box
 ;; width - width of box
 ;; multi - selection method ["true": multiple, "false": single]
 ;; lst - list of strings to place in list box
 ;; Alan J. Thompson, 09.23.08 / 05.17.10 (rewrite)
(defun AT:ListSelect (title label height width multi lst / fn fo d item f)
 (setq fo (open (setq fn (vl-filename-mktemp "" "" ".dcl")) "w"))
 (foreach x (list (strcat "list_select : dialog { label = \"" title "\"; spacer;")
                  (strcat ": list_box { label = \"" label "\";" "key = \"lst\";")
                  (strcat "allow_accept = true; height = " (vl-princ-to-string height) ";")
                  (strcat "width = " (vl-princ-to-string width) ";")
                  (strcat "multiple_select = " multi "; } spacer; ok_cancel; }")
            )
   (write-line x fo)
 )
 (close fo)
 (new_dialog "list_select" (setq d (load_dialog fn)))
 (start_list "lst")
 (mapcar (function add_list) lst)
 (end_list)
 (setq item (set_tile "lst" "0"))
 (action_tile "lst" "(setq item $value)")
 (setq f (start_dialog))
 (unload_dialog d)
 (vl-file-delete fn)
 (if (= f 1)
   ((lambda (s / i s l)
      (while (setq i (vl-string-search " " s))
        (setq l (cons (nth (atoi (substr s 1 i)) lst) l))
        (setq s (substr s (+ 2 i)))
      )
      (reverse (cons (nth (atoi s) lst) l))
    )
     item
   )
 )
)

; basicly make a list LST of the lines to be displayed then call it

(setq surface (car (AT:ListSelect
                                   "Set new surface style"
                                   "Select style"
                                   10
                                   10
                                   "false"
                                   (vl-sort (mapcar (function car) lst) '<)
                                 ) )
    )   ; end setq

 

Listselect.jpg

Share this post


Link to post
Share on other sites
ericjlarson-metopera

Thanks for the response, but if you actually look at the code, what I am doing is significantly more complicated. For each line (each line is a different sheet for the print), there is the option to select one or more layers, and whether you want a ground plan or a section. You can also change the order in which the sheets are listed.

Share this post


Link to post
Share on other sites
BIGAL

Again I have not run code I think a couple of screen images would have helped us to comment, are you using sub dialouge boxes ie pick properties "Section" then pop sheet number close pick something else.

Share this post


Link to post
Share on other sites
ericjlarson-metopera

Here are some screen shots. Each boxed row is a different print sheet; you can add additional layers to each print with the plus button, or add an additional print sheet with the plus button at the bottom. The arrows reorder the list and the delete buttons work as you'd expect. The only issue is that if you add too many rows the dialog box gets too big. I'd rather not have to split things across multiple dialog boxes because being able to see everything at once is very helpful.

 

 

screenshot 1.jpg

screenshot3.jpg

screenshot 2.jpg

Share this post


Link to post
Share on other sites
Lee Mac

Nice buttons Eric :thumbsup:

Share this post


Link to post
Share on other sites
ericjlarson-metopera

I definitely have you to thank for those (and some other stuff in there...)

Share this post


Link to post
Share on other sites
LibertyOne

What about adding a vertical slider to contain the list of print sheets? Or maybe showing the information a bit differently? Perhaps in a tree list or table. I think the functionality would still work.

Share this post


Link to post
Share on other sites
ericjlarson-metopera

A vertical slider is exactly what I'm looking for, but I don't know how to implement it. Can you give me some more information?

Share this post


Link to post
Share on other sites
LibertyOne

I'm not really that good with DCL, but I've looked in on it thoroughly. The only problem I have is testing a few things out. Some of my questions are:

Can you use a slider to move all those tiles up and down together?

I would test moving some sets of radio row tiles first just to see if that works.

Can you set a slider on a frame to move contents within that frame?

That would be interesting to know.

Share this post


Link to post
Share on other sites
ericjlarson-metopera

I have yet to find a way to use a slider to change the contents of a dialog box, but that is EXACTLY what I want to do. If anyone here knows how to do that, it would be great to hear. Thanks!

Share this post


Link to post
Share on other sites
LibertyOne

I don't want to go out on a limb and say it's not possible because I've seen some pretty slick programming here in the forum, but I'm 99% sure it's not possible. Maybe you can regroup your info into a list or some other form that allows it to be displayed but also be edited. I think you have tried to make the tiles act as data instead of them displaying your data.

 

Could you explain a bit more about the interaction between the prints and the layers that are listed below the prints?

This would help to think about an alternative way of displaying everything.

Share this post


Link to post
Share on other sites
ericjlarson-metopera

The layers essentially are the prints. There are a whole host of layers that are on for every print (Architecture, Annotation, Hang Schedule, etc.). Each print turns on the scenery for a different layer (or multiple scenes depending on the nature of the print). So in the example below, you get a plan for 11scene, a section for 11scene, a plan for 12 scene, and you get scene 21 and 31 on the same printout so that gets two layer names. The dropdown menus fill themselves with all of the layers named "*-Scenery_Layout".

 

Capture.JPG

 

Does that make sense?

Share this post


Link to post
Share on other sites
LibertyOne

I've reread your first post as well to get a good concept of what you are trying to achive. What I've understood is that you would like to create a dialog to help ease the creation of print sheets. The list should be visible on the dialog for those creating the list. I would say the dialog should create an association list of information and be shown on the dialog. This association list could be listed like this (pseudo code):

 

(SETQ PRINT-LIST

[indent]     '(
[/indent]

[indent][indent]         (PRINT-SCENE (ADDITIONAL-SCENE) INT-PRINT-STATUS)
[/indent]
[/indent]
[indent][indent]         (PRINT-SCENE (ADDITIONAL-SCENE ADDITIONAL-SCENE) INT-PRINT-STATUS)
[/indent]
[/indent]
[indent][indent]         (PRINT-SCENE () INT-PRINT-STATUS)
[/indent]
[/indent]
[indent][indent]         (PRINT-SCENE () INT-PRINT-STATUS)
[/indent]
[/indent]
[indent]     )
[/indent]
)

PRINT-LIST is the name of your print list. (Which you can name something else to fit)

PRINT-SCENE is the atom representing the main print sheet.

ADDITIONAL-SCENE is a list of additional layers to the scene. This list could be empty (NIL) or contain as many additional layers as needed.

INT-PRINT-STATUS is the atom from the type of print. Either Plan or Section. Data entered here is either 0 or 1 and can't be NIL.

 

As far as the dialog box is concerned, I would show a text box showing the currect state of the print list. Adding, deleting or rearranging sheets can be done with buttons on the dialog like you have now. The association list should be the one piece of information which is to be used for displaying and printing of the sheets. User interaction with the dialog should rewrite the list accordingly. With this list you can extract the information quite easily.

Share this post


Link to post
Share on other sites
ericjlarson-metopera

I think this idea could work, and I've already got the code set up to write association lists for each print.

 

In this situation, do you have any thoughts about how to modify the contents of the list? Should that be a second dialog box that opens via another button?

Share this post


Link to post
Share on other sites
LibertyOne

I think you could get away with all the functionality on one dialog. The actual print list displayed at the bottom and buttons for adding, deleting and rearranging at the top.

Share this post


Link to post
Share on other sites
LibertyOne

Something maybe like this:

TestDialog.jpg

Share this post


Link to post
Share on other sites
ericjlarson-metopera

Yeah, I think I could make that work. Thanks so much for your help!

Share this post


Link to post
Share on other sites
LibertyOne

Glad to help. When making dialogs you always have to think of the person using it and if it makes sense. Plus you don't want to program yourself into a dead end. I feel using an association list for the data gives you a lot of possibilities to reuse the information. You can write little tools to populate a list or to extract info and reformat into a text to create a report. Endless possibilities...

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×