Jump to content

Dynamically Generated .DCL file issues


ericjlarson-metopera

Recommended Posts

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

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