- build docs - remove EDITHARDWARE and EDITMATERIAL commandsmaster
parent
9e525ed4c8
commit
d7c2b816df
@ -1,88 +0,0 @@
|
||||
(psc-include '("dialog/dialog.lsp"))
|
||||
|
||||
(defun-q c:edithardware ( /
|
||||
hdw-table
|
||||
hdwlst
|
||||
current-hardware
|
||||
update-hardware
|
||||
data
|
||||
;; variables defined here for dialog-init
|
||||
defaults-file
|
||||
popup-keys
|
||||
dist-keys
|
||||
int-keys
|
||||
toggle-keys
|
||||
plain-string-keys
|
||||
default-actions
|
||||
dialog-ties
|
||||
sub-dialogs
|
||||
;; hook
|
||||
dialog-after-load
|
||||
dialog-save-action
|
||||
dialog-edit-box-action
|
||||
;; variables included here for scope,
|
||||
;; but not defined here directly
|
||||
extra-keys
|
||||
tile-actions
|
||||
)
|
||||
"Edits a hardware table entry in a fab drawing
|
||||
|
||||
Only the description is locked, to ensure items are present in the hardware database, so
|
||||
Quantity and Note can be edited without using the command."
|
||||
|
||||
;; fail early with no hardware table
|
||||
(if (not (setq hdw-table (get-table-by-title "Hardware")))
|
||||
(error "EDITHARDWARE: No hardware table found"))
|
||||
|
||||
(setq plain-string-keys '("qty" "desc")
|
||||
toggle-keys '("sl")
|
||||
hdwlst (read-csv "fab/hardware.csv")
|
||||
popup-keys (list (append '("category"
|
||||
"All")
|
||||
(uniquify (mapcar 'cadddr hdwlst)))
|
||||
'("hardware" . current-hardware)))
|
||||
|
||||
;; calculate value of hardware box
|
||||
(defun current-hardware ( / cat hlst)
|
||||
(setq cat (dialog-popup-val "category")
|
||||
hlst hdwlst)
|
||||
(if (= (get_tile "show_all") "0")
|
||||
(remove! 'hlst '(= (nth 2 x) "xtra")))
|
||||
(if (not (= cat "All"))
|
||||
(remove! 'hlst '(not (= (nth 3 x) cat))))
|
||||
(mapcar 'car hlst))
|
||||
|
||||
;; update hardware list box
|
||||
(defun update-hardware ( / )
|
||||
(dialog-popup-list-update "hardware")
|
||||
(update-description))
|
||||
|
||||
(defun update-description ( / )
|
||||
(set_tile "desc" (dialog-popup-val "hardware")))
|
||||
|
||||
(defun dialog-after-load ( / )
|
||||
(dialog-add-action "hardware" '(update-description))
|
||||
(update-description)
|
||||
(dialog-add-action "show_all" '(update-hardware))
|
||||
(dialog-add-action "category" '(update-hardware)))
|
||||
|
||||
;; overwrite to get untyped data
|
||||
(defun dialog-save-action ( / )
|
||||
(setq data (dialog-get-data nil))
|
||||
(tk '(if (= sl "1") (add-to-list 'data (list "note" "SL"))))
|
||||
;; remove extraneous keys
|
||||
(remove! 'data
|
||||
'(member (car x) '("material"
|
||||
"category"
|
||||
"sl")))
|
||||
(done_dialog 0))
|
||||
|
||||
;; undefine to stop error checking on empty tiles
|
||||
(defun dialog-edit-box-action (key string)
|
||||
nil)
|
||||
|
||||
(if (and (setq data (dialog-init "fab/hardware.dcl" "hardware" '(("sl" "1"))))
|
||||
(setq hdw-row (table-get-row hdw-table)))
|
||||
(hdw-table-set-row hdw-table hdw-row data)))
|
||||
(defun-r 'c:edithardware)
|
||||
|
@ -1,122 +0,0 @@
|
||||
(psc-include '("dialog/dialog.lsp"
|
||||
"fab/util.lsp"))
|
||||
|
||||
(defun-q c:editmaterial ( /
|
||||
mat-table
|
||||
matlst
|
||||
current-material
|
||||
update-material
|
||||
update-properties
|
||||
data
|
||||
;; variables defined here for dialog-init
|
||||
defaults-file
|
||||
popup-keys
|
||||
dist-keys
|
||||
int-keys
|
||||
toggle-keys
|
||||
plain-string-keys
|
||||
default-actions
|
||||
dialog-ties
|
||||
sub-dialogs
|
||||
;; hook
|
||||
dialog-after-load
|
||||
dialog-save-action
|
||||
dialog-edit-box-action
|
||||
;; variables included here for scope,
|
||||
;; but not defined here directly
|
||||
extra-keys
|
||||
tile-actions
|
||||
)
|
||||
"Edits a material table entry in a fab drawing
|
||||
|
||||
Only the Description and Weight columns are locked, to ensure items are present in the
|
||||
hardware database, so Quantity, Length, Width, and Note can be edited without using the
|
||||
command."
|
||||
;; fail early with no material table
|
||||
(if (not (setq mat-table (get-table-by-title "Material")))
|
||||
(error "EDITMATERIAL: No material table found"))
|
||||
|
||||
(setq toggle-keys '("sl" "lc")
|
||||
plain-string-keys '("mark" "desc")
|
||||
int-keys '("qty")
|
||||
dist-keys '("length" "width")
|
||||
default-actions '(("category" . update-material)
|
||||
("material" . update-properties))
|
||||
matlst (read-csv "fab/material.csv")
|
||||
popup-keys (list (append '("category"
|
||||
"All")
|
||||
(uniquify (mapcar '(lambda(x) (nth 4 x)) matlst)))
|
||||
'("material" . current-material)))
|
||||
|
||||
;; calculate value of material box
|
||||
(defun current-material ( / cat mlst)
|
||||
(setq cat (dialog-popup-val "category")
|
||||
mlst matlst)
|
||||
(if (= (get_tile "show_all") "0")
|
||||
(remove! 'mlst '(= (nth 3 x) "xtra")))
|
||||
(if (not (= cat "All"))
|
||||
(remove! 'mlst '(not (= (nth 4 x) cat))))
|
||||
(mapcar 'car mlst))
|
||||
|
||||
;; update material box list
|
||||
(defun update-material (key val / )
|
||||
(dialog-popup-list-update "material")
|
||||
(update-properties nil nil))
|
||||
|
||||
;; update properties based on selection in material box
|
||||
(defun update-properties (key val / desc wt-type)
|
||||
(setq desc (dialog-popup-val "material")
|
||||
wt-type (nth 2 (assoc desc matlst)))
|
||||
(set_tile "desc" desc)
|
||||
(cond ((= wt-type "sqft")
|
||||
(mode_tile "width" 0)
|
||||
(mode_tile "length" 0))
|
||||
((= wt-type "foot")
|
||||
(set_tile "width" "")
|
||||
(mode_tile "width" 1)
|
||||
(mode_tile "length" 0))
|
||||
((= wt-type "each")
|
||||
(set_tile "width" "")
|
||||
(mode_tile "width" 1)
|
||||
(set_tile "length" "")
|
||||
(mode_tile "length" 1))))
|
||||
|
||||
(defun dialog-after-load ( / )
|
||||
(dialog-add-action "show_all" '(update-material nil nil))
|
||||
(update-properties nil nil))
|
||||
|
||||
;; overwrite to get untyped data
|
||||
(defun dialog-save-action ( / note wt-type wt)
|
||||
(setq data (dialog-get-data nil))
|
||||
;; process notes
|
||||
(setq note (tk '(cond ((and (= sl "1")
|
||||
(= lc "1"))
|
||||
"SL,LC")
|
||||
((= sl "1") "SL")
|
||||
((= lc "1") "LC")
|
||||
(T nil))))
|
||||
(if note (add-to-list 'data (list "note" note)))
|
||||
;; determine weight formula
|
||||
(add-to-list 'data
|
||||
(list "weight" (tk '(calc-weight-formula desc))))
|
||||
;; remove extraneous keys
|
||||
(remove! 'data
|
||||
'(member (car x) '("category"
|
||||
"material"
|
||||
"sl"
|
||||
"lc")))
|
||||
(done_dialog 0))
|
||||
|
||||
;; undefine to stop error checking on empty tiles
|
||||
(defun dialog-edit-box-action (key string)
|
||||
nil)
|
||||
|
||||
((lambda(/ set-func)
|
||||
(setq set-func (if (= (get-custom-dwgprop "fab") "generic-ship-loose")
|
||||
gsl-mat-table-set-row
|
||||
mat-table-set-row))
|
||||
(if (and (setq data (dialog-init "fab/material.dcl" "material" nil))
|
||||
(setq mat-row (table-get-row mat-table)))
|
||||
(set-func mat-table mat-row data))))
|
||||
(princ))
|
||||
(defun-r 'c:editmaterial)
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in new issue