(defun C:border	()
  (initerr)
  (command "undo" "m")
  (command "opendcl")
  (dcl_project_load "border" t)
  (dcl_Form_Show Border_Form1)
  (princ)
)
;;;;;;(defun c:Border_Form1_OnInitialize (/)
;;;;;; (dcl_Control_SetVisible Border_Form1_CheckBox1 nil)
;;;;;; (dcl_Control_SetVisible Border_Form1_CheckBox2 nil)
;;;;;;  )
;;;Patrick Hurst P.E. Stamp
(defun c:Border_Form1_CheckBox1_OnClicked (Value /)
  (setq phpestamp (dcl_Control_GetValue Border_Form1_CheckBox1))
  (cond
    ((= 1 phpestamp)
     (setq pestamp "phurst")
     (dcl_Control_SetEnabled Border_Form1_CheckBox2 nil)
    )
    ((= 0 phpestamp)
     (dcl_Control_SetEnabled Border_Form1_CheckBox2 t)
     )
    )
  )
  

;;;Joe Ferguson P.E. Stamp
(defun c:Border_Form1_CheckBox2_OnClicked (Value /)
  (dcl_Control_GetEnabled Border_Form1_CheckBox2)
  (setq jfpestamp (dcl_Control_GetValue Border_Form1_CheckBox2))
  (cond
    ((= 1 jfpestamp)
     (setq pestamp "jferguson")
     (dcl_Control_SetEnabled Border_Form1_CheckBox1 nil)
     )
    ((= 0 jfpestamp)
     (dcl_Control_SetEnabled Border_Form1_CheckBox1 t)
    )
    )
  )
    
  
    

;;;(defun c:Border_Form1_CheckBox1_OnDblClicked (/)
;;;(dcl_Control_SetEnabled Border_Form1_CheckBox1 t)
;;;  )

(defun c:Border_Form1_OptionButton1_OnClicked (Value /)
  (setq elecbtton (dcl_Control_GetValue Border_Form1_OptionButton1))
)

(defun c:Border_Form1_OptionButton2_OnClicked (Value /)
  (setq mechbtton (dcl_Control_GetValue Border_Form1_OptionButton2))
)

(defun c:Border_Form1_OptionButton3_OnClicked (Value /)
  (setq firebtton (dcl_Control_GetValue Border_Form1_OptionButton3))
)

(defun c:Border_Form1_OptionButton4_OnClicked (Value /)
  (setq coverbtton (dcl_Control_GetValue Border_Form1_OptionButton4))
)

(defun c:Border_Form1_ComboBox2_OnDropDown (/)
  (setq test(dcl_ComboBox_GetCurSel Border_Form1_ComboBox2))
  (cond
    ((= 0 test)
     (setq whatever "test")
     (dcl_Control_SetEnabled Border_Form1_CheckBox2 t)
     )
    )
  )



(defun c:Border_Form1_ComboBox1_OnDropDown (/)
;;; (setq location(dcl_ComboBox_GetEBText Border_Form1_ComboBox1))
;;;  (cond
;;;    ((= "Alabama" location)
;;;     (dcl_Control_SetEnabled Border_Form1_CheckBox2 t)
;;;     (dcl_Control_SetEnabled Border_Form1_CheckBox1 nil)
;;;     
;;;     )
;;;    ((= "Arizona" location)
;;;     (dcl_Control_SetVisible Border_Form1_CheckBox1 t)
;;;     (dcl_Control_SetEnabled Border_Form1_CheckBox2 t)
;;;     )
;;;    )
;;;  )
  (setq drop (dcl_ComboBox_Gettbtext Border_Form1_ComboBox1))
  (cond
    ((= 0 drop)
     (setq location "General")
     (dcl_Control_SetEnabled Border_Form1_CheckBox2 nil)
    )
    ((= 1 drop)
     (setq location "Alabama")
    )
    ((= 2 drop)
     (setq location "Arizona")
    )
    ((= 3 drop)
     (setq location "Arkansas")
    )
    ((= 4 drop)
     (setq location "California")
     )
    ((= 5 drop)
     (setq location "Colorado")
     )
    ((= 6 drop)
     (setq location "Connecticut")
     )
    ((= 7 drop)
     (setq location "Delaware")
     )
    ((= 8 drop)
     (setq location "District Of Columbia")
     )
    ((= 9 drop)
     (setq location "Florida")
     )
    ((= 10 drop)
     (setq location "Georgia")
     )
    ((= 11 drop)
     (setq location "Hawaii")
     )
    ((= 12 drop)
     (setq location "Idaho")
     )
    ((= 13 drop)
     (setq location "Illinois")
     )
    ((= 14 drop)
     (setq location "Indiana")
     )
    ((= 15 drop)
     (setq location "Iowa")
     )
    ((= 16 drop)
     (setq location "Kansas")
     )
    ((= 17 drop)
     (setq location "Kentucky")
     )
    ((= 18 drop)
     (setq location "Louisiana")
     )
    ((= 19 drop)
     (setq location "Maine")
     )
    ((= 20 drop)
     (setq location "Maryland")
     )
    ((= 21 drop)
     (setq location "Massachusetts")
     )
    ((= 22 drop)
     (setq location "Michigan")
     )
    ((= 23 drop)
     (setq location "Minnesota")
     )
    ((= 24 drop)
     (setq location "Mississippi")
     )
    ((= 25 drop)
     (setq location "Missouri")
     )
    ((= 26 drop)
     (setq location "Montana")
     )
    ((= 27 drop)
     (setq location "Nebraska")
     )
    ((= 28 drop)
     (setq location "New Hamphire")
     )
    ((= 29 drop)
     (setq location "New Jersey")
     )
    ((= 30 drop)
     (setq location "New Mexico")
     )
    ((= 31 drop)
     (setq location "New York")
     )
    ((= 32 drop)
     (setq location "North Carolina")
     )
    ((= 33 drop)
     (setq location "North Dakota")
     )
    ((= 34 drop)
     (setq location "Ohio")
     )
    ((= 35 drop)
     (setq location "Oklahoma")
     )
    ((= 36 drop)
     (setq location "Oregon")
     )
    ((= 37 drop)
     (setq location "Pennsylvania")
     )
    ((= 38 drop)
     (setq location "Rhode Island")
     )
    ((= 39 drop)
     (setq location "South Carolina")
     )
    ((= 40 drop)
     (setq location "South Dakota")
     )
    ((= 41 drop)
     (setq location "Tennessee")
     )
    ((= 42 drop)
     (setq location "Texas")
     )
    ((= 43 drop)
     (setq location "Utah")
     )
    ((= 44 drop)
     (setq location "Vermont")
     )
    ((= 45 drop)
     (setq location "Virginia")
     )
    ((= 46 drop)
     (setq location "Washington")
     )
    ((= 47 drop)
     (setq location "West Virginia")
     )
    ((= 48 drop)
     (setq location "Wisconsin")
     )
    ((= 49 drop)
     (setq location "Wyoming")
     )
  ))


(defun c:Border_Form1_TextButton1_OnClicked (/)
  
;;;  (VL-LOAD-COM)
;;;  Border Type Selection and Border Insertion
(DCL_FORM_CLOSE border_form1)
(progn
  (setq elecbtton (dcl_Control_GetValue Border_Form1_OptionButton1))
  (setq mechbtton (dcl_Control_GetValue Border_Form1_OptionButton2))
  (setq firebtton (dcl_Control_GetValue Border_Form1_OptionButton3))
  (setq coverbtton (dcl_Control_GetValue Border_Form1_OptionButton4))
  (cond
    ((= 1 elecbtton)
     (setq typ "Magellan Electrical")
    )
    ((= 1 mechbtton)
     (setq typ "mech")
    )
    ((= 1 firebtton)
     (setq typ "fire")
    )
    ((= 1 COVERBTTON)
     (setq typ "cover")
    )
  )
  
;;; Location Selection
;;; (setq drop (dcl_ComboBox_GetCurSel Border_Form1_ComboBox1))
;;;  (cond
;;;    ((= 0 drop)
;;;     (setq location "General")
;;;     (dcl_Control_SetEnabled Border_Form1_CheckBox2 nil)
;;;    )
;;;    ((= 1 drop)
;;;     (setq location "Alabama")
;;;    )
;;;    ((= 2 drop)
;;;     (setq location "Arizona")
;;;    )
;;;    ((= 3 drop)
;;;     (setq location "Arkansas")
;;;    )
;;;    ((= 4 drop)
;;;     (setq location "California")
;;;     )
;;;    ((= 5 drop)
;;;     (setq location "Colorado")
;;;     )
;;;    ((= 6 drop)
;;;     (setq location "Connecticut")
;;;     )
;;;    ((= 7 drop)
;;;     (setq location "Delaware")
;;;     )
;;;    ((= 8 drop)
;;;     (setq location "District Of Columbia")
;;;     )
;;;    ((= 9 drop)
;;;     (setq location "Florida")
;;;     )
;;;    ((= 10 drop)
;;;     (setq location "Georgia")
;;;     )
;;;    ((= 11 drop)
;;;     (setq location "Hawaii")
;;;     )
;;;    ((= 12 drop)
;;;     (setq location "Idaho")
;;;     )
;;;    ((= 13 drop)
;;;     (setq location "Illinois")
;;;     )
;;;    ((= 14 drop)
;;;     (setq location "Indiana")
;;;     )
;;;    ((= 15 drop)
;;;     (setq location "Iowa")
;;;     )
;;;    ((= 16 drop)
;;;     (setq location "Kansas")
;;;     )
;;;    ((= 17 drop)
;;;     (setq location "Kentucky")
;;;     )
;;;    ((= 18 drop)
;;;     (setq location "Louisiana")
;;;     )
;;;    ((= 19 drop)
;;;     (setq location "Maine")
;;;     )
;;;    ((= 20 drop)
;;;     (setq location "Maryland")
;;;     )
;;;    ((= 21 drop)
;;;     (setq location "Massachusetts")
;;;     )
;;;    ((= 22 drop)
;;;     (setq location "Michigan")
;;;     )
;;;    ((= 23 drop)
;;;     (setq location "Minnesota")
;;;     )
;;;    ((= 24 drop)
;;;     (setq location "Mississippi")
;;;     )
;;;    ((= 25 drop)
;;;     (setq location "Missouri")
;;;     )
;;;    ((= 26 drop)
;;;     (setq location "Montana")
;;;     )
;;;    ((= 27 drop)
;;;     (setq location "Nebraska")
;;;     )
;;;    ((= 28 drop)
;;;     (setq location "New Hamphire")
;;;     )
;;;    ((= 29 drop)
;;;     (setq location "New Jersey")
;;;     )
;;;    ((= 30 drop)
;;;     (setq location "New Mexico")
;;;     )
;;;    ((= 31 drop)
;;;     (setq location "New York")
;;;     )
;;;    ((= 32 drop)
;;;     (setq location "North Carolina")
;;;     )
;;;    ((= 33 drop)
;;;     (setq location "North Dakota")
;;;     )
;;;    ((= 34 drop)
;;;     (setq location "Ohio")
;;;     )
;;;    ((= 35 drop)
;;;     (setq location "Oklahoma")
;;;     )
;;;    ((= 36 drop)
;;;     (setq location "Oregon")
;;;     )
;;;    ((= 37 drop)
;;;     (setq location "Pennsylvania")
;;;     )
;;;    ((= 38 drop)
;;;     (setq location "Rhode Island")
;;;     )
;;;    ((= 39 drop)
;;;     (setq location "South Carolina")
;;;     )
;;;    ((= 40 drop)
;;;     (setq location "South Dakota")
;;;     )
;;;    ((= 41 drop)
;;;     (setq location "Tennessee")
;;;     )
;;;    ((= 42 drop)
;;;     (setq location "Texas")
;;;     )
;;;    ((= 43 drop)
;;;     (setq location "Utah")
;;;     )
;;;    ((= 44 drop)
;;;     (setq location "Vermont")
;;;     )
;;;    ((= 45 drop)
;;;     (setq location "Virginia")
;;;     )
;;;    ((= 46 drop)
;;;     (setq location "Washington")
;;;     )
;;;    ((= 47 drop)
;;;     (setq location "West Virginia")
;;;     )
;;;    ((= 48 drop)
;;;     (setq location "Wisconsin")
;;;     )
;;;    ((= 49 drop)
;;;     (setq location "Wyoming")
;;;     )) 

;;;ESDC Logo & P.E. Stamp Insertion

;;;P.E. Insert
;;;  (cond
;;;    ((= pestamp t)
;;;     (
;;;      )
;;;     )
;;;ESDC Logo Insert
;;;    ((= pestamp nil)  
;;;  (setq	insertpoint
;;;	 (list (* 28.37500001 (getvar "dimscale"))
;;;	       (* 0.49999999 (getvar "dimscale"))
;;;	       0.0000
;;;	 )
;;;  )
;;;  (command "insert"
;;;	   "esdc_logo"
;;;	   insertpoint
;;;	   (* 1 (getvar "dimscale"))
;;;	   ""
;;;	   ""
;;;  )
;;;  (setq bname "esdc_logo")
;;;  (setq SS1 (ssget "X" (list '(0 . "INSERT") (cons 2 bname))))
;;;  (command "explode" SS1)
;;;  (setq obj (entlast))
;;;  (setq loca location)
;;;  (chgdynprop obj "Visibility1" loca)
;;;     ))
;;;
;;;
;;;
;;;
;;;
;;;
))

;;;Cancel Button
(defun c:Border_Form1_TextButton2_OnClicked (/)
  (reset)
  (DCL_FORM_CLOSE border_form1)
)

;;
;;----------------------------------------------------------------------
;; changes a given variable in your block

(defun chgdynprop (e propname newval / obj v vval sal tot i)

  (setq	obj  (if (= (type e) 'vla-object)
	       e
	       (vlax-ename->vla-object e)
	     )
	v    (vla-getdynamicblockproperties obj)
	vval (vlax-variant-value v)
	sal  (vlax-safearray->list vval)
	tot  (length sal)
	i    0
  )
  (while (< i tot)
    (if	(= (vlax-get-property (nth i sal) "PropertyName") propname)
      (progn
	(vlax-put-property (nth i sal) "Value" newval)
	(setq i tot)
      )
      (setq i (1+ i))
    )
  )
)
