TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Visual DCL Programming => Topic started by: MSTG007 on June 21, 2017, 08:14:32 AM

Title: DCL - Keep Open Until User Closes
Post by: MSTG007 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;
    }
}
Title: Re: DCL - Keep Open Until User Closes
Post by: Bobby C. Jones 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.
Title: Re: DCL - Keep Open Until User Closes
Post by: Lee Mac 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.
Title: Re: DCL - Keep Open Until User Closes
Post by: Grrr1337 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.
Title: Re: DCL - Keep Open Until User Closes
Post by: MSTG007 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.