Jump to content

Error in dialog file 


sachindkini

Recommended Posts

(defun DCL_HH ()
  (VL-FILE-DELETE (STRCAT (GETVAR "TEMPPREFIX") "TMP_H.DCL"))
  (setq FA1 (OPEN (STRCAT (GETVAR "TEMPPREFIX") "TMP_H.DCL") "a"))

  (foreach STREAM
	   '("hhimg:dialog{\\n"
	     "label= \"parametric fill : Email : Sachin\" ;\\n"
	     "spacer_1;\\n"
	     ":row{"
	     ":boxed_radio_column{"
	     "label=\"fill style\";\\n"
	     ":radio_button{"
	     "label= \"I-shaped paving\"; key=\"EH1\";}\\n"
	     ":radio_button{"
	     "label= \"Herringbone paving\"; key=\"EH2\";}\\n"
	     ":radio_button{"
	     "label= \"Chamfered rectangle\"; key=\"EH3\";}\\n"
	     ":radio_button{"
	     "label= \"braided texture\"; key=\"EH4\";}\\n"
	     ":radio_button{"
	     "label= \"binary rectangle\"; key=\"EH5\";}}\\n"
	     ":image_button{"
	     "key= \"HHIMG\"; color = -2; width = 30;  aspect_ratio = 1; allow_accrpt = true;}}\\n"
	     "spacer_1;\\n"
	     ":row{"
	     ":edit_box{"
	     "label= \"Parameter A\";key= \"CSA\";}\\n"
	     ":edit_box{"
	     "label= \"Parameter B\";key= \"CSB\";}}\\n"
	     "spacer_1;\\n"
	     ":row{"
	     ":button{"
	     "label=\"Select a closed polyline\" ; key=\"YYL\" ; width=10; fixed_width=true; }\\n"
	     ":button{"
	     "label=\"Pick fill interior points\" ; key=\"YYT\" ; width=10; fixed_width=true; }}\\n"
	     ":button{"
	     "label=\"Cancel\"  ;key=\"cancel\";is_cancel=true;}}\\n"
	    )
    (PRINC STREAM FA1)
  )
  (CLOSE FA1)
  (setq DCL_T (LOAD_DIALOG (STRCAT (GETVAR "TEMPPREFIX") "TMP_H.DCL")))
  (NEW_DIALOG "hhimg" DCL_T)
  (TC1)

DEAR SIR, 

Error Above Dcl Code

 

Error in dialog file 

 

 

err2.png

Link to comment
Share on other sites

This is what I use in line 1 of a dialog:

 

'(
  "pass : dialog { key = \"DialogueKey\";  label = \"Dialogue Label\"; "

 

Note I don't have any \\n in mine 

 

Finishing I use:

 

  (write-line STREAM des)
) ;;end foreach

(setq DCL_T (LOAD_DIALOG (STRCAT (GETVAR "TEMPPREFIX") "TMP_H.DCL")))
(NEW_DIALOG "hhimg" DCL_T)

 

Noting that I use (write-line to create the temporary file, you are using princ

 

Try that and see

 

Copy and pasted from other stuff and not checked if I have copied everything (weekend... CAD is off here....)

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

@rlx made this useful lisp to convert stand alone dcl files into lisp. so things have the proper " " and slashes.

-Edit

🐉

Edited by mhupp
  • Like 1
  • Agree 1
  • Thanks 2
Link to comment
Share on other sites

@mhupp : one of many routines I wrote for fun or just because I was bored (and then only used it once or twice) haha... glad it's still useful. But I wished Autodesk added a dialog editor similar to the VBA form editor. But no problem because in most cases I use last app I made , delete everything except ok-cancel and type in the rest on the fly in new routine (after I made a drawing with design) because like most processes start with a good (block) diagram : how do I want it to look and / or work and then start coding, not the other way around.

 

(defun TC1 ( / dcl-fn dcl-fp dcl-id s drv)
  (if (setq dcl-fp (open (setq dcl-fn (strcat (getvar "TEMPPREFIX") "TMP_H.DCL")) "w"))
    (foreach s
      '("hhimg : dialog {label=\"parametric fill : Email : Sachin\";"
        "spacer_1;"
	":boxed_radio_column {label=\"fill style\";"
          ":radio_button{label=\"I-shaped paving\"; key=\"EH1\";}"
          ":radio_button{label=\"Herringbone paving\"; key=\"EH2\";}"
          ":radio_button{label=\"Chamfered rectangle\"; key=\"EH3\";}"
          ":radio_button{label=\"braided texture\"; key=\"EH4\";}"
          ":radio_button{label=\"binary rectangle\"; key=\"EH5\";}"
        "}"
        ":image_button {key=\"HHIMG\";color=-2;width=30;aspect_ratio=1;allow_accept=true;}"
        "spacer_1;"
        ":row {:edit_box {label=\"Parameter A\";key=\"CSA\";}"
              ":edit_box {label=\"Parameter B\";key=\"CSB\";}}"
        "spacer_1;"
        ":row {:button {label=\"Select a closed polyline\";key=\"YYL\";width=10;fixed_width=true;}"
	      ":button {label=\"Pick fill interior points\";key=\"YYT\";width=10;fixed_width=true;}}"
        "ok_cancel;"
        "}"
      )
      (write-line s dcl-fp)
    )
  )
  (if dcl-fp (progn (close dcl-fp)(gc)))
  (if (and (setq dcl-id (load_dialog dcl-fn)) (new_dialog "hhimg" dcl-id))
    (progn
      (action_tile "cancel" "(done_dialog 0)")
      (action_tile "accept" "(done_dialog 1)")
      (setq drv (start_dialog))
      (if dcl-fn (vl-file-delete dcl-fn))
      (cond
        ((= drv  0)(princ "\nCancelled"))
        ((= drv  1)(princ "\nok"))
      )
    )
  )
  (princ)
)

(TC1)

 

🐉

Edited by rlx
  • Like 2
  • Thanks 1
Link to comment
Share on other sites

I had a look at your routine and it looks like its missing some code or hasn't been finished yet. For example when I look at the action_tile for buttons to select a poly line or pick a point they both do (done_dialog 1) which in itself doesn't have to be a bad thing but routine just stops after that. I like the effort though that has been put in vector_image to create the slides. Should be using that myself more often but I admit , I'm a lazy dragon (well I try to be)  , so bite me...

Link to comment
Share on other sites

This is a radio button dcl generator can be used in any code it needs like 3 lines of code to work, its a library routine gets loaded as required so no hard coding dcl's. Also Multi Getvals & Multi Toggles, Radio buttons 2 col and 3 col.

 

Look at the help in the start of the code for examples.

 

These two steps should be outside of dcl.You can not pick an object without closing dcl so why have them in there.

 

":row {:button {label=\"Select a closed polyline\";key=\"YYL\";width=10;fixed_width=true;}"
	      ":button {label=\"Pick fill interior points\";key=\"YYT\";width=10;fixed_width=true;}}"

 

  • Thanks 1
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...