Author Topic: DCL - Keep Open Until User Closes  (Read 10333 times)

0 Members and 1 Guest are viewing this topic.

MSTG007

  • Gator
  • Posts: 2598
  • I can't remeber what I already asked! I need help!
DCL - Keep Open Until User Closes
« on: June 21, 2017, 08:14:32 AM »
What do you call it when you want your DCL Box to be open while the user performs other commands. Then the user can select another button on the DCL and finally Close the DCL. (I hope that makes sense).

Code: [Select]
(defun C:Convert2Render()
  (setq dcl_id (load_dialog "Convert2Render.dcl"))
  (if (not (new_dialog "Convert2Render" dcl_id) ) (exit))
  (action_tile "cancel" "(setq ddiag 1)(done_dialog)")
  (action_tile "accept" "(setq ddiag 2)(done_dialog)")
  (action_tile "accept1" "(setq ddiag 3)(done_dialog)")
  (action_tile "accept2" "(setq ddiag 4)(done_dialog)")

 
  (start_dialog)
  (unload_dialog dcl_id)
  (if (= ddiag 1)
    (princ "\n \n ...test Cancelled. \n ")
  )
  (if (= ddiag 2)
    (c:Part1)
  )
  (if (= ddiag 3)
    (c:Part2)
  )
  (if (= ddiag 4)
    (c:Part3)
  )
)



(defun c:Part1()
(layerstate-delete "Civil Layers Linetypes")
(layerstate-importfromdb "Civil Layers Linetypes" "//INDYSANP/Libraries/Autodesk/Civil 3D/2016/Template/Department Layers/Civil Dept Layers.dwg")
(layerstate-restore "Civil Layers Linetypes")
(command ".layer" "Set" "0" "")
(command ".layer" "Lock" "C_*" "")
(command ".layer" "UnLock" "C_PVMT_STRIPING_PARKING,C_PVMT_STRIPING_ROAD,C_PVMT_STRIPING_ADA" "")
(command "_pedit" "multiple" "all" "" "width" "0.50" "")
(command ".layer" "color" "Truecolor" "255,255,255" "C_PVMT_STRIPING_PARKING,C_PVMT_STRIPING_ROAD" "")
(command ".layer" "color" "Truecolor" "153,230,255" "C_PVMT_STRIPING_ADA" "")
(command ".layer" "UnLock" "C_*" "")
(command ".layer" "freeze" "*" "")
(command ".layer" "thaw" "C_BLDG,C_CONC*_CURB,C_CONC*_DUMPSTER,C_CONC*_WALK,C_PVMT_ASPHALT,C_PVMT_CONC*,C_STM_PAVED_DITCH,C_STM_POND,C_SVY_BOUNDARY_LINE" "")
(command ".select" "all" "")
(command ".layer" "thaw" "defpoints" "set" "defpoints" "")
(command "_copytolayer" "previous" "" "defpoints" "")
(command ".layer" "freeze" "*" "")
(command ".layer" "thaw" "0" "")
(C:Convert2Render)
(princ))



(defun c:Part2()
(command "_AeccCreateParcelFromObjects")
(princ))


(defun c:Part3()

(command "._draworder" (ssget "_x" '((0 . "aecc_parcel"))) "" "_b")
(C:Convert2Render)
(princ))


(C:Convert2Render)





Code: [Select]
Convert2Render : dialog {
label = "Convert to Render";

 : boxed_column {
 label = "Convert to Render";
    : button {
      key = "accept";
      label = "Part 1";
      is_default = true;
    }
 { height = 0.3; }
    : button {
      key = "accept1";
      label = "Part 1";
      is_default = true;     
    }
 { height = 0.3; }
    : button {
      key = "accept2";
      label = "Part 2";
      is_default = true;     
    }
 { height = 0.3; }
    : button {
      key = "accept3";
      label = "Part 3";
      is_default = true;     
    }
}

 { height = 1; }
    : button {
      key = "cancel";
      label = "Cancel";
      is_default = false;
      is_cancel = true;
    }
}
Civil3D 2020

Bobby C. Jones

  • Swamp Rat
  • Posts: 516
  • Cry havoc and let loose the dogs of war.
Re: DCL - Keep Open Until User Closes
« Reply #1 on: June 21, 2017, 09:28:46 AM »
You have just described a modeless dialog, vs. a modal dialog which blocks access to the parent app until it's closed.
Bobby C. Jones

Lee Mac

  • Seagull
  • Posts: 12904
  • London, England
Re: DCL - Keep Open Until User Closes
« Reply #2 on: June 24, 2017, 04:31:00 PM »
Further to Bobby's response: Standard DCL cannot display modeless dialogs, only modal dialogs - you will need to use a third-party application such as OpenDCL for a modeless GUI.

Grrr1337

  • Swamp Rat
  • Posts: 812
Re: DCL - Keep Open Until User Closes
« Reply #3 on: June 24, 2017, 04:46:44 PM »
I think that the closest method to achieve it with standard DCL is:

1.Run dialog, using function call [ start of the routine ]
2.Change settings/variables inside the dialog
3.Close the dialog (but store the settings in a global list) [ end of the routine ]
4.Do your outside the dialog stuff, but re-invoke/run the dialog using the function call
5.The dialog has additional buttons that run some "stuff" and its optional to press so the program could process something.

You still will have to close and re-run the dialog, but as you can see in the above comments theres not much options left.
I hope that my thiking makes sence.
(apply ''((a b c)(a b c))
  '(
    (( f L ) (apply 'strcat (f L)))
    (( L ) (if L (cons (chr (car L)) (f (cdr L)))))
    (72 101 108 108 111 32 87 111 114 108 100)
  )
)
vevo.bg

MSTG007

  • Gator
  • Posts: 2598
  • I can't remeber what I already asked! I need help!
Re: DCL - Keep Open Until User Closes
« Reply #4 on: June 26, 2017, 01:13:05 PM »
I follow the thinking .... Let me take a stab at it and see what I can get out of it doing it the standards DCL method. Thanks for the heaps up Lee on the third party opendcl.
Civil3D 2020