pete
/
psc
1
0
Fork 0

Reorganize util/object/table functions

- build docs
- remove EDITHARDWARE and EDITMATERIAL commands
master
Pete Ley 2 months ago
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)

@ -9,7 +9,7 @@ In a material table, this command also updates the item weight."
(if (not cell) (error "No table selected"))
(setq table (pop! 'cell)
col-names (get-table-column-names table)
title (get-table-title table))
title (table-get-title table))
(cond ((ends-with title "Material")
((lambda(/ row row-ht)
(if (not (member "description" col-names))

@ -1,13 +1,4 @@
(defun-q c:trimrows ( /
cell
table
title
row
nrows
mt
ht
table-nrows
)
(defun-q c:trimrows ( / cell table)
"Trims empty rows from a fab drawing table
A row is considered empty if its first column is blank.
@ -21,34 +12,7 @@ updated."
(setq cell (get-table-cell))
(if (not cell)
(error "No table cell selected"))
(setq table (pop! 'cell)
title (get-table-title table)
row (car cell)
table-nrows (vla-get-Rows table)
nrows 0)
(if (= title "Material")
(dec! 'table-nrows))
(while (and (< row table-nrows)
(empty-first-column-p table row))
(inc! 'row)
(inc! 'nrows))
(if (= title "Material")
(mat-table-update-marks table - nrows (- row nrows)))
(if (> nrows 0)
(vla-DeleteRows table (- row nrows) nrows))
(if (begins-with title "Assembly")
(progn
(setq mt (get-table-by-title "Material")
ht (get-table-by-title "Hardware"))
(if mt
(progn
(table-divide-qty mt (- table-nrows 2))
(table-multiply-qty mt (- table-nrows nrows 2))
(mat-table-update-ea-wt mt)))
(if ht
(progn
(table-divide-qty ht (- table-nrows 2))
(table-multiply-qty ht (- table-nrows nrows 2))))))
(shift-tables-maybe title (* (vla-GetRowHeight table 0) nrows))
(setq table (pop! 'cell))
(table-trim-empty-rows table (car cell))
(princ))
(defun-r 'c:trimrows)

@ -24,11 +24,6 @@
<td>Returns the next available fab drawing number with this SIGIL</td>
</tr>
<tr>
<td class="funcsig"><a href="fab-util.html#calc-weight-formula">(<span class="funcname">calc-weight-formula</span> description)</a></td>
<td>Returns the weight formula for a material description</td>
</tr>
<tr>
<td class="funcsig"><a href="fab-util.html#fab-combine-like-data">(<span class="funcname">fab-combine-like-data</span> data-lists keys)</a></td>
<td>Returns groups of similar datalists for fab drawing consolidation</td>
@ -39,6 +34,26 @@
<td>Gets a list of fab drawing types via dialog</td>
</tr>
<tr>
<td class="funcsig"><a href="fab-util.html#get-finish">(<span class="funcname">get-finish</span>)</a></td>
<td>Returns the finish from the finish table or nil if no finish table found</td>
</tr>
<tr>
<td class="funcsig"><a href="fab-util.html#get-finish">(<span class="funcname">get-finish</span>)</a></td>
<td>Prompts the user to choose a finish description via dialog and returns it</td>
</tr>
<tr>
<td class="funcsig"><a href="fab-util.html#get-hardware">(<span class="funcname">get-hardware</span>)</a></td>
<td>Prompts the user to choose a hardware description via dialog and returns it</td>
</tr>
<tr>
<td class="funcsig"><a href="fab-util.html#get-material">(<span class="funcname">get-material</span>)</a></td>
<td>Prompts the user to choose a material description via dialog and returns it</td>
</tr>
<tr>
<td class="funcsig"><a href="fab-util.html#make-fab-dwgs">(<span class="funcname">make-fab-dwgs</span> types enames)</a></td>
<td>Makes all the TYPES of fab drawings using data from ENAMES</td>
@ -59,6 +74,11 @@
<td>Returns the next available mark prefix and increments it</td>
</tr>
<tr>
<td class="funcsig"><a href="fab-util.html#set-finish">(<span class="funcname">set-finish</span> value)</a></td>
<td>Sets the finish in the finish table to VALUE</td>
</tr>
<tr>
<td class="funcsig"><a href="fab-util.html#write-title-block">(<span class="funcname">write-title-block</span> job-info stairno login style)</a></td>
<td>Rewrites special text objects in a fab drawing title block</td>
@ -79,14 +99,6 @@ VARS:
(SIGIL STR)</pre>
</section>
<section>
<h3 id="calc-weight-formula" class="funcsig">(<span class="funcname">calc-weight-formula</span> description)</h3>
<pre class="fulldoc">Returns the weight formula for a material description
VARS:
(DESCRIPTION STR)</pre>
</section>
<section>
<h3 id="fab-combine-like-data" class="funcsig">(<span class="funcname">fab-combine-like-data</span> data-lists keys)</h3>
<pre class="fulldoc">Returns groups of similar datalists for fab drawing consolidation
@ -99,6 +111,26 @@ Similarity is based on equivalence of the values of all keys in KEYS.</pre>
<pre class="fulldoc">Gets a list of fab drawing types via dialog</pre>
</section>
<section>
<h3 id="get-finish" class="funcsig">(<span class="funcname">get-finish</span>)</h3>
<pre class="fulldoc">Returns the finish from the finish table or nil if no finish table found</pre>
</section>
<section>
<h3 id="get-finish" class="funcsig">(<span class="funcname">get-finish</span>)</h3>
<pre class="fulldoc">Prompts the user to choose a finish description via dialog and returns it</pre>
</section>
<section>
<h3 id="get-hardware" class="funcsig">(<span class="funcname">get-hardware</span>)</h3>
<pre class="fulldoc">Prompts the user to choose a hardware description via dialog and returns it</pre>
</section>
<section>
<h3 id="get-material" class="funcsig">(<span class="funcname">get-material</span>)</h3>
<pre class="fulldoc">Prompts the user to choose a material description via dialog and returns it</pre>
</section>
<section>
<h3 id="make-fab-dwgs" class="funcsig">(<span class="funcname">make-fab-dwgs</span> types enames)</h3>
<pre class="fulldoc">Makes all the TYPES of fab drawings using data from ENAMES</pre>
@ -128,6 +160,16 @@ closes the drawing.</pre>
<pre class="fulldoc">Returns the next available mark prefix and increments it</pre>
</section>
<section>
<h3 id="set-finish" class="funcsig">(<span class="funcname">set-finish</span> value)</h3>
<pre class="fulldoc">Sets the finish in the finish table to VALUE
Returns VALUE if successful or nil if no finish table found
VARS:
(VALUE STR)</pre>
</section>
<section>
<h3 id="write-title-block" class="funcsig">(<span class="funcname">write-title-block</span> job-info stairno login style)</h3>
<pre class="fulldoc">Rewrites special text objects in a fab drawing title block</pre>

File diff suppressed because one or more lines are too long

@ -323,7 +323,7 @@
<table>
<thead>
<h3>Public Functions A-Z (660 documented)</h3>
<h3>Public Functions A-Z (676 documented)</h3>
<th>Function Signature</th>
<th>Description</th>
</thead>
@ -351,6 +351,10 @@
<tr>
<td class="funcsig"><a href="util-list.html#2-item-list">(<span class="funcname">2-item-list</span> lst)</a></td>
<td>Returns the elements of LST grouped by twos</td>
@ -1109,13 +1113,6 @@
<tr>
<td class="funcsig"><a href="fab-util.html#calc-weight-formula">(<span class="funcname">calc-weight-formula</span> description)</a></td>
<td>Returns the weight formula for a material description</td>
</tr>
<tr>
<td class="funcsig"><a href="fab-stair-pan.html#call-out-pans">(<span class="funcname">call-out-pans</span>)</a></td>
<td>Adds pan MLEADERS to main view</td>
@ -2002,6 +1999,13 @@
<tr>
<td class="funcsig"><a href="util-object-table.html#get-all-tables">(<span class="funcname">get-all-tables</span>)</a></td>
<td>Returns a list of all tables</td>
</tr>
<tr>
<td class="funcsig"><a href="stair-details.html#get-bot-kick-dist">(<span class="funcname">get-bot-kick-dist</span>)</a></td>
<td>Returns the bottom kick distance</td>
@ -2044,6 +2048,20 @@
<tr>
<td class="funcsig"><a href="fab-util.html#get-finish">(<span class="funcname">get-finish</span>)</a></td>
<td>Prompts the user to choose a finish description via dialog and returns it</td>
</tr>
<tr>
<td class="funcsig"><a href="fab-util.html#get-hardware">(<span class="funcname">get-hardware</span>)</a></td>
<td>Prompts the user to choose a hardware description via dialog and returns it</td>
</tr>
<tr>
<td class="funcsig"><a href="util-selection.html#get-ins-and-delete">(<span class="funcname">get-ins-and-delete</span> ename)</a></td>
<td>Deletes the entity named ENAME and returns its former insertion point</td>
@ -2065,6 +2083,13 @@
<tr>
<td class="funcsig"><a href="fab-util.html#get-material">(<span class="funcname">get-material</span>)</a></td>
<td>Prompts the user to choose a material description via dialog and returns it</td>
</tr>
<tr>
<td class="funcsig"><a href="util-selection.html#get-sset">(<span class="funcname">get-sset</span> app-ids-str)</a></td>
<td>Gets a selection from the user of objects with given XDATA app-ID</td>
@ -2100,6 +2125,15 @@
<tr>
<td class="funcsig"><a href="util-object-table.html#get-table-cell">(<span class="funcname">get-table-cell</span>)</a></td>
<td>Prompts user for a point and checks if it is inside in a table</td>
</tr>
<tr>
<td class="funcsig"><a href="util-object-line.html#get-vlist">(<span class="funcname">get-vlist</span> pline)</a></td>
<td>Returns the list of vertices comprising PLINE in the form (x y bulge)</td>
@ -2128,13 +2162,6 @@
<tr>
<td class="funcsig"><a href="util-object-table.html#gsl-mat-table-set-row">(<span class="funcname">gsl-mat-table-set-row</span> gsl-mat-table row data)</a></td>
<td>Sets a ROW in a generic ship loose template table</td>
</tr>
<tr>
<td class="funcsig"><a href="rail-util.html#guard-con-read">(<span class="funcname">guard-con-read</span> str)</a></td>
<td>Returns intiger from guard connection string by stripping X</td>
@ -2170,13 +2197,6 @@
<tr>
<td class="funcsig"><a href="util-object-table.html#hdw-table-set-row">(<span class="funcname">hdw-table-set-row</span> hdw-table row data)</a></td>
<td>Sets a ROW in HDW-TABLE</td>
</tr>
<tr>
<td class="funcsig"><a href="rail-rail-section.html#hr&bracket">(<span class="funcname">hr&bracket</span> con ins dir stl i/o)</a></td>
<td>create of hr and bracket for sr or wr</td>
@ -2219,6 +2239,13 @@
<tr>
<td class="funcsig"><a href="util-string.html#increment-mark">(<span class="funcname">increment-mark</span> mark)</a></td>
<td>Return the next string in spreadsheet column order</td>
</tr>
<tr>
<td class="funcsig"><a href="util-object-block.html#insert-block">(<span class="funcname">insert-block</span> container ins block)</a></td>
<td>Wrapper for vla-InsertBlock</td>
@ -2546,32 +2573,12 @@
<tr>
<td class="funcsig"><a href="util-object-table.html#mat-table-add-data">(<span class="funcname">mat-table-add-data</span> before datas)</a></td>
<td>Adds bulk data to material table</td>
</tr>
<tr>
<td class="funcsig"><a href="util-object-table.html#mat-table-set-row">(<span class="funcname">mat-table-set-row</span> mat-table row data)</a></td>
<td>Sets a ROW in MAT-TABLE</td>
</tr>
<tr>
<td class="funcsig"><a href="util-object-table.html#mat-table-update-ea-wt">(<span class="funcname">mat-table-update-ea-wt</span> mat-table)</a></td>
<td>Updates the formula for "each weight" in MAT-TABLE to include any added rows</td>
</tr>
<tr>
<td class="funcsig"><a href="util-object-table.html#mat-table-update-marks">(<span class="funcname">mat-table-update-marks</span> +- n at)</a></td>
<td>Update fab mark numbers in material table and callouts</td>
</tr>
<tr>
@ -2791,13 +2798,6 @@
<tr>
<td class="funcsig"><a href="util-object-table.html#parse-table">(<span class="funcname">parse-table</span> table)</a></td>
<td>Returns the data in TABLE as a nested list of strings</td>
</tr>
<tr>
<td class="funcsig"><a href="util-object-3D.html#path-p">(<span class="funcname">path-p</span> obj)</a></td>
<td>Returns T if passed OBJ is a valid path</td>
@ -3239,6 +3239,13 @@
<tr>
<td class="funcsig"><a href="fab-util.html#set-finish">(<span class="funcname">set-finish</span> value)</a></td>
<td>Sets the finish in the finish table to VALUE</td>
</tr>
<tr>
<td class="funcsig"><a href="util-document.html#setup-env">(<span class="funcname">setup-env</span> 3d-p)</a></td>
<td>Ensure necessary layers, linetypes, and text styles are present</td>
@ -3653,30 +3660,43 @@
<tr>
<td class="funcsig"><a href="util-object-table.html#table-divide-qty">(<span class="funcname">table-divide-qty</span> table qty-col n)</a></td>
<td>Divides every quantity in TABLE by N</td>
</tr>
<tr>
<td class="funcsig"><a href="util-object-table.html#table-get-row">(<span class="funcname">table-get-row</span> table)</a></td>
<td>Prompts user for a point and checks if it is inside a row in TABLE</td>
<td class="funcsig"><a href="util-object-table.html#table-add-data">(<span class="funcname">table-add-data</span> table row datas)</a></td>
<td>Adds bulk data to TABLE with regeneration suppressed</td>
</tr>
<tr>
<td class="funcsig"><a href="util-object-table.html#table-insert-rows">(<span class="funcname">table-insert-rows</span> table nrows before)</a></td>
<td>Inserts NROWS rows in a fab drawing TABLE before row BEFORE</td>
<td class="funcsig"><a href="util-object-table.html#table-get-title">(<span class="funcname">table-get-title</span> table)</a></td>
<td>Returns the contents of cell 0,0</td>
</tr>
<tr>
<td class="funcsig"><a href="util-object-table.html#table-multiply-qty">(<span class="funcname">table-multiply-qty</span> table qty-col n)</a></td>
<td>Multiplies every quantity in TABLE by N</td>
<td class="funcsig"><a href="util-object-table.html#table-insert-rows">(<span class="funcname">table-insert-rows</span> table nrows after)</a></td>
<td>Inserts NROWS rows in a fab drawing TABLE after row AFTER</td>
</tr>
@ -3689,8 +3709,15 @@
<tr>
<td class="funcsig"><a href="util-object-table.html#table-row-extents">(<span class="funcname">table-row-extents</span> table row)</a></td>
<td>Returns the extents of a row in TABLE</td>
<td class="funcsig"><a href="util-object-table.html#table-set-row">(<span class="funcname">table-set-row</span> table row data)</a></td>
<td>Sets a ROW in TABLE</td>
</tr>
<tr>
<td class="funcsig"><a href="util-object-table.html#table-trim-empty-rows">(<span class="funcname">table-trim-empty-rows</span> table row)</a></td>
<td>Trims empty rows from TABLE, starting at ROW</td>
</tr>

@ -22,82 +22,152 @@ operations.</pre>
</thead>
<tbody>
<tr><td colspan="3">Public</td></tr>
<tr>
<td class="funcsig"><a href="util-object-table.html#get-table-by-title">(<span class="funcname">get-table-by-title</span> title)</a></td>
<td>Returns the table with matching TITLE</td>
</tr>
<tr>
<td class="funcsig"><a href="util-object-table.html#gsl-mat-table-set-row">(<span class="funcname">gsl-mat-table-set-row</span> gsl-mat-table row data)</a></td>
<td>Sets a ROW in a generic ship loose template table</td>
<td class="funcsig"><a href="util-object-table.html#get-all-tables">(<span class="funcname">get-all-tables</span>)</a></td>
<td>Returns a list of all tables</td>
</tr>
<tr>
<td class="funcsig"><a href="util-object-table.html#hdw-table-set-row">(<span class="funcname">hdw-table-set-row</span> hdw-table row data)</a></td>
<td>Sets a ROW in HDW-TABLE</td>
</tr>
<tr>
<td class="funcsig"><a href="util-object-table.html#mat-table-add-data">(<span class="funcname">mat-table-add-data</span> before datas)</a></td>
<td>Adds bulk data to material table</td>
</tr>
<tr>
<td class="funcsig"><a href="util-object-table.html#mat-table-set-row">(<span class="funcname">mat-table-set-row</span> mat-table row data)</a></td>
<td>Sets a ROW in MAT-TABLE</td>
</tr>
<tr>
<td class="funcsig"><a href="util-object-table.html#mat-table-update-ea-wt">(<span class="funcname">mat-table-update-ea-wt</span> mat-table)</a></td>
<td>Updates the formula for "each weight" in MAT-TABLE to include any added rows</td>
<td class="funcsig"><a href="util-object-table.html#get-table-by-title">(<span class="funcname">get-table-by-title</span> title)</a></td>
<td>Returns the table with matching TITLE</td>
</tr>
<tr>
<td class="funcsig"><a href="util-object-table.html#mat-table-update-marks">(<span class="funcname">mat-table-update-marks</span> +- n at)</a></td>
<td>Update fab mark numbers in material table and callouts</td>
<td class="funcsig"><a href="util-object-table.html#get-table-cell">(<span class="funcname">get-table-cell</span>)</a></td>
<td>Prompts user for a point and checks if it is inside in a table</td>
</tr>
<tr>
<td class="funcsig"><a href="util-object-table.html#parse-table">(<span class="funcname">parse-table</span> table)</a></td>
<td>Returns the data in TABLE as a nested list of strings</td>
<td class="funcsig"><a href="util-object-table.html#table-add-data">(<span class="funcname">table-add-data</span> table row datas)</a></td>
<td>Adds bulk data to TABLE with regeneration suppressed</td>
</tr>
<tr>
<td class="funcsig"><a href="util-object-table.html#table-divide-qty">(<span class="funcname">table-divide-qty</span> table qty-col n)</a></td>
<td>Divides every quantity in TABLE by N</td>
<td class="funcsig"><a href="util-object-table.html#table-get-title">(<span class="funcname">table-get-title</span> table)</a></td>
<td>Returns the contents of cell 0,0</td>
</tr>
<tr>
<td class="funcsig"><a href="util-object-table.html#table-get-row">(<span class="funcname">table-get-row</span> table)</a></td>
<td>Prompts user for a point and checks if it is inside a row in TABLE</td>
<td class="funcsig"><a href="util-object-table.html#table-insert-rows">(<span class="funcname">table-insert-rows</span> table nrows after)</a></td>
<td>Inserts NROWS rows in a fab drawing TABLE after row AFTER</td>
</tr>
<tr>
<td class="funcsig"><a href="util-object-table.html#table-insert-rows">(<span class="funcname">table-insert-rows</span> table nrows before)</a></td>
<td>Inserts NROWS rows in a fab drawing TABLE before row BEFORE</td>
<td class="funcsig"><a href="util-object-table.html#table-p">(<span class="funcname">table-p</span> obj)</a></td>
<td>Returns T if OBJ is a table</td>
</tr>
<tr>
<td class="funcsig"><a href="util-object-table.html#table-multiply-qty">(<span class="funcname">table-multiply-qty</span> table qty-col n)</a></td>
<td>Multiplies every quantity in TABLE by N</td>
<td class="funcsig"><a href="util-object-table.html#table-set-row">(<span class="funcname">table-set-row</span> table row data)</a></td>
<td>Sets a ROW in TABLE</td>
</tr>
<tr>
<td class="funcsig"><a href="util-object-table.html#table-p">(<span class="funcname">table-p</span> obj)</a></td>
<td>Returns T if OBJ is a table</td>
<td class="funcsig"><a href="util-object-table.html#table-trim-empty-rows">(<span class="funcname">table-trim-empty-rows</span> table row)</a></td>
<td>Trims empty rows from TABLE, starting at ROW</td>
</tr>
<tr>
<td class="funcsig"><a href="util-object-table.html#table-row-extents">(<span class="funcname">table-row-extents</span> table row)</a></td>
<td>Returns the extents of a row in TABLE</td>
</tr>
<tr><td colspan="3">Private</td></tr>
<tr>
<td class="funcsig"><a href="util-object-table.html#--shift-tables">(<span class="funcname">--shift-tables</span> names delta-y)</a></td>
<td>Move the tables named in NAMES vertically by DELTA-Y</td>
</tr>
<tr>
<td class="funcsig"><a href="util-object-table.html#--shift-tables-maybe">(<span class="funcname">--shift-tables-maybe</span> title delta-y)</a></td>
<td>If TITLE is one of the generic fab tables, call <a href="util-object-table.html#--shift-tables">--shift-tables</a></td>
</tr>
<tr>
<td class="funcsig"><a href="util-object-table.html#get-table-cell--bounding-box">(<span class="funcname">get-table-cell--bounding-box</span> table row col)</a></td>
<td>Returns the bounding box for the cell as a list of the form (minpt maxpt)</td>
</tr>
<tr>
<td class="funcsig"><a href="util-object-table.html#mat-table--calc-weight-formula">(<span class="funcname">mat-table--calc-weight-formula</span> table row)</a></td>
<td>Returns the weight formula for a material description</td>
</tr>
<tr>
<td class="funcsig"><a href="util-object-table.html#mat-table--update-ea-wt">(<span class="funcname">mat-table--update-ea-wt</span> table)</a></td>
<td>Updates the formula for each weight in TABLE to include any added rows</td>
</tr>
<tr>
<td class="funcsig"><a href="util-object-table.html#mat-table--update-marks">(<span class="funcname">mat-table--update-marks</span> table +- n row)</a></td>
<td>Update fab mark numbers in TABLE and callouts</td>
</tr>
<tr>
<td class="funcsig"><a href="util-object-table.html#mat-table--update-tot-wt">(<span class="funcname">mat-table--update-tot-wt</span> table)</a></td>
<td>Updates the formula for each weight in TABLE to include any added rows</td>
</tr>
<tr>
<td class="funcsig"><a href="util-object-table.html#table--cells">(<span class="funcname">table--cells</span> table)</a></td>
<td>Returns a list of cells in TABLE as 2-item lists of the form (row col)</td>
</tr>
<tr>
<td class="funcsig"><a href="util-object-table.html#table--column-name->letter">(<span class="funcname">table--column-name-&gt;letter</span> name)</a></td>
<td>Returns the letter designation of the column named NAME</td>
</tr>
<tr>
<td class="funcsig"><a href="util-object-table.html#table--divide-qty">(<span class="funcname">table--divide-qty</span> table n)</a></td>
<td>Divides every quantity in TABLE by N</td>
</tr>
<tr>
<td class="funcsig"><a href="util-object-table.html#table--empty-first-column-p">(<span class="funcname">table--empty-first-column-p</span> table row)</a></td>
<td>Returns T if column 0 of ROW is empty</td>
</tr>
<tr>
<td class="funcsig"><a href="util-object-table.html#table--fix-row-height">(<span class="funcname">table--fix-row-height</span> table row orig-ht)</a></td>
<td>Constrains the row height to multiples of table base row height</td>
</tr>
<tr>
<td class="funcsig"><a href="util-object-table.html#table--format-column-name">(<span class="funcname">table--format-column-name</span> name)</a></td>
<td>Returns NAME as lowercase with spaces replaced by underscores</td>
</tr>
<tr>
<td class="funcsig"><a href="util-object-table.html#table--get-column-names">(<span class="funcname">table--get-column-names</span> table)</a></td>
<td>Returns the column names as a list of formatted strings</td>
</tr>
<tr>
<td class="funcsig"><a href="util-object-table.html#table--get-header-row">(<span class="funcname">table--get-header-row</span> table)</a></td>
<td>Returns the index of the row containing the column headers</td>
</tr>
<tr>
<td class="funcsig"><a href="util-object-table.html#table--multiply-qty">(<span class="funcname">table--multiply-qty</span> table n)</a></td>
<td>Multiplies every quantity in TABLE by N</td>
</tr>
<tr>
<td class="funcsig"><a href="util-object-table.html#table--pt-in-table-p">(<span class="funcname">table--pt-in-table-p</span> pt table)</a></td>
<td>Returns T if PT is within TABLE's bounding box</td>
</tr>
</tbody>
</table>
<section>
<h3 id="get-all-tables" class="funcsig">(<span class="funcname">get-all-tables</span>)</h3>
<pre class="fulldoc">Returns a list of all tables</pre>
</section>
<section>
<h3 id="get-table-by-title" class="funcsig">(<span class="funcname">get-table-by-title</span> title)</h3>
<pre class="fulldoc">Returns the table with matching TITLE
@ -110,149 +180,232 @@ VARS:
</section>
<section>
<h3 id="gsl-mat-table-set-row" class="funcsig">(<span class="funcname">gsl-mat-table-set-row</span> gsl-mat-table row data)</h3>
<pre class="fulldoc">Sets a ROW in a generic ship loose template table
<h3 id="get-table-cell" class="funcsig">(<span class="funcname">get-table-cell</span>)</h3>
<pre class="fulldoc">Prompts user for a point and checks if it is inside in a table
ROW is a row index and DATA is a data list whose keys correspond to the table columns.
If so, it returns a list of the form (table row column).</pre>
</section>
<section>
<h3 id="table-add-data" class="funcsig">(<span class="funcname">table-add-data</span> table row datas)</h3>
<pre class="fulldoc">Adds bulk data to TABLE with regeneration suppressed
ROW is the row after which to add data. DATAS is a list of data lists representing row
data.
VARS:
(GSL-MAT-TABLE VLA-OBJECT (TABLE-P GSL-MAT-TABLE))
(TABLE VLA-OBJECT (TABLE-P TABLE))
(ROW INT (>= ROW 0))
(DATA nil (DATA-LIST-P DATA))</pre>
(DATAS LIST (VL-EVERY 'DATA-LIST-P DATAS))</pre>
</section>
<section>
<h3 id="table-get-title" class="funcsig">(<span class="funcname">table-get-title</span> table)</h3>
<pre class="fulldoc">Returns the contents of cell 0,0
VARS:
(TABLE VLA-OBJECT (TABLE-P TABLE))</pre>
</section>
<section>
<h3 id="hdw-table-set-row" class="funcsig">(<span class="funcname">hdw-table-set-row</span> hdw-table row data)</h3>
<pre class="fulldoc">Sets a ROW in HDW-TABLE
<h3 id="table-insert-rows" class="funcsig">(<span class="funcname">table-insert-rows</span> table nrows after)</h3>
<pre class="fulldoc">Inserts NROWS rows in a fab drawing TABLE after row AFTER
ROW is a row index and DATA is a data list whose keys correspond to the table columns.
If this is a generic fab table there are other generic fab tables below this one, move
them down to accomodate. If this is the Assembly* table, update the quantities in Material
and Hardware tables, if found.
VARS:
(HDW-TABLE VLA-OBJECT (TABLE-P HDW-TABLE))
(TABLE VLA-OBJECT (TABLE-P TABLE))
(NROWS INT)
(AFTER INT)</pre>
</section>
<section>
<h3 id="table-p" class="funcsig">(<span class="funcname">table-p</span> obj)</h3>
<pre class="fulldoc">Returns T if OBJ is a table
VARS:
(OBJ VLA-OBJECT)</pre>
</section>
<section>
<h3 id="table-set-row" class="funcsig">(<span class="funcname">table-set-row</span> table row data)</h3>
<pre class="fulldoc">Sets a ROW in TABLE
ROW is a row index and DATA is a data list whose keys correspond to the table columns. If TABLE is a material table, attempts to set the weight formula.
To add data in bulk with formula regeneration disabled to improve performance, see
<a href="util-object-table.html#table-add-data">table-add-data</a>
VARS:
(TABLE VLA-OBJECT (TABLE-P TABLE))
(ROW INT (>= ROW 0))
(DATA nil (DATA-LIST-P DATA))</pre>
</section>
<section>
<h3 id="mat-table-add-data" class="funcsig">(<span class="funcname">mat-table-add-data</span> before datas)</h3>
<pre class="fulldoc">Adds bulk data to material table
<h3 id="table-trim-empty-rows" class="funcsig">(<span class="funcname">table-trim-empty-rows</span> table row)</h3>
<pre class="fulldoc">Trims empty rows from TABLE, starting at ROW
BEFORE is the row to add data at. The special symbol 'end means the last row. DATAS is a
list of data lists representing row data.
Determines if row is empty using <a href="util-object-table.html#table--empty-first-column-p">table--empty-first-column-p</a>
VARS:
(BEFORE nil (OR (= BEFORE 'END) (= (TYPE BEFORE) 'INT)))
(DATAS LIST (VL-EVERY 'DATA-LIST-P DATAS))</pre>
(TABLE VLA-OBJECT (TABLE-P TABLE))
(ROW INT)</pre>
</section>
<section>
<h3 id="mat-table-set-row" class="funcsig">(<span class="funcname">mat-table-set-row</span> mat-table row data)</h3>
<pre class="fulldoc">Sets a ROW in MAT-TABLE
<h3 id="--shift-tables" class="funcsig">(<span class="funcname">--shift-tables</span> names delta-y)</h3>
<pre class="fulldoc">Move the tables named in NAMES vertically by DELTA-Y
ROW is a row index and DATA is a data list whose keys correspond to the table columns.
VARS:
(NAMES (LIST nil) (VL-EVERY 'STRINGP NAMES))
(DELTA-Y nil (NUMBERP DELTA-Y))</pre>
</section>
<section>
<h3 id="--shift-tables-maybe" class="funcsig">(<span class="funcname">--shift-tables-maybe</span> title delta-y)</h3>
<pre class="fulldoc">If TITLE is one of the generic fab tables, call <a href="util-object-table.html#--shift-tables">--shift-tables</a></pre>
</section>
<section>
<h3 id="get-table-cell--bounding-box" class="funcsig">(<span class="funcname">get-table-cell--bounding-box</span> table row col)</h3>
<pre class="fulldoc">Returns the bounding box for the cell as a list of the form (minpt maxpt)
VARS:
(MAT-TABLE VLA-OBJECT (TABLE-P MAT-TABLE))
(ROW INT (>= ROW 0))
(DATA nil (DATA-LIST-P DATA))</pre>
(TABLE VLA-OBJECT (TABLE-P TABLE))
(ROW INT)
(COL INT)</pre>
</section>
<section>
<h3 id="mat-table-update-ea-wt" class="funcsig">(<span class="funcname">mat-table-update-ea-wt</span> mat-table)</h3>
<pre class="fulldoc">Updates the formula for "each weight" in MAT-TABLE to include any added rows
<h3 id="mat-table--calc-weight-formula" class="funcsig">(<span class="funcname">mat-table--calc-weight-formula</span> table row)</h3>
<pre class="fulldoc">Returns the weight formula for a material description
VARS:
(MAT-TABLE VLA-OBJECT (TABLE-P MAT-TABLE))</pre>
(TABLE VLA-OBJECT (TABLE-P TABLE))
(ROW INT)</pre>
</section>
<section>
<h3 id="mat-table-update-marks" class="funcsig">(<span class="funcname">mat-table-update-marks</span> +- n at)</h3>
<pre class="fulldoc">Update fab mark numbers in material table and callouts
<h3 id="mat-table--update-ea-wt" class="funcsig">(<span class="funcname">mat-table--update-ea-wt</span> table)</h3>
<pre class="fulldoc">Updates the formula for each weight in TABLE to include any added rows
VARS:
(TABLE VLA-OBJECT (TABLE-P TABLE))</pre>
</section>
<section>
<h3 id="mat-table--update-marks" class="funcsig">(<span class="funcname">mat-table--update-marks</span> table +- n row)</h3>
<pre class="fulldoc">Update fab mark numbers in TABLE and callouts
+- should be one of the built-in functions + or -, indicating whether the mark numbers
should increase or decrease. N is the number of places the number should jump. AT is the
should increase or decrease. N is the number of places the number should jump. ROW is the
first row in the material table containing mark numbers to change.
Expects to be called by a function with TABLE set to the material table.
VARS:
(TABLE VLA-OBJECT (TABLE-P TABLE))
(+- SUBR (MEMBER +- (LIST + -)))
(N INT)
(AT INT)
(ROW INT)</pre>
</section>
<section>
<h3 id="mat-table--update-tot-wt" class="funcsig">(<span class="funcname">mat-table--update-tot-wt</span> table)</h3>
<pre class="fulldoc">Updates the formula for each weight in TABLE to include any added rows
VARS:
(TABLE VLA-OBJECT (TABLE-P TABLE))</pre>
</section>
<section>
<h3 id="parse-table" class="funcsig">(<span class="funcname">parse-table</span> table)</h3>
<pre class="fulldoc">Returns the data in TABLE as a nested list of strings
<h3 id="table--cells" class="funcsig">(<span class="funcname">table--cells</span> table)</h3>
<pre class="fulldoc">Returns a list of cells in TABLE as 2-item lists of the form (row col)</pre>
</section>
<section>
<h3 id="table--column-name->letter" class="funcsig">(<span class="funcname">table--column-name-&gt;letter</span> name)</h3>
<pre class="fulldoc">Returns the letter designation of the column named NAME
Skips the first two rows (assumes they are headers) and any rows whose first column is
blank.
Either col-names or table must be defined.
VARS:
(TABLE VLA-OBJECT (TABLE-P TABLE))</pre>
(NAME STR)</pre>
</section>
<section>
<h3 id="table-divide-qty" class="funcsig">(<span class="funcname">table-divide-qty</span> table qty-col n)</h3>
<h3 id="table--divide-qty" class="funcsig">(<span class="funcname">table--divide-qty</span> table n)</h3>
<pre class="fulldoc">Divides every quantity in TABLE by N
QTY-COL is the index of the quantities column.
VARS:
(TABLE VLA-OBJECT (TABLE-P TABLE))
(QTY-COL INT (>= QTY-COL 0))
(N INT)</pre>
</section>
<section>
<h3 id="table-get-row" class="funcsig">(<span class="funcname">table-get-row</span> table)</h3>
<pre class="fulldoc">Prompts user for a point and checks if it is inside a row in TABLE
If so, it returns the index of that row.
<h3 id="table--empty-first-column-p" class="funcsig">(<span class="funcname">table--empty-first-column-p</span> table row)</h3>
<pre class="fulldoc">Returns T if column 0 of ROW is empty
VARS:
(TABLE VLA-OBJECT (TABLE-P TABLE))</pre>
(TABLE VLA-OBJECT (TABLE-P TABLE))
(ROW INT)</pre>
</section>
<section>
<h3 id="table-insert-rows" class="funcsig">(<span class="funcname">table-insert-rows</span> table nrows before)</h3>
<pre class="fulldoc">Inserts NROWS rows in a fab drawing TABLE before row BEFORE
<h3 id="table--fix-row-height" class="funcsig">(<span class="funcname">table--fix-row-height</span> table row orig-ht)</h3>
<pre class="fulldoc">Constrains the row height to multiples of table base row height
If there are other fab tables below this one, move them down to accomodate.
If ROW height has changed from ORIG-HT, calls <a href="util-object-table.html#--shift-tables-maybe">--shift-tables-maybe</a>
VARS:
(TABLE VLA-OBJECT (TABLE-P TABLE))
(NROWS INT)
(BEFORE INT)</pre>
(ROW INT)
(ORIG-HT REAL)</pre>
</section>
<section>
<h3 id="table-multiply-qty" class="funcsig">(<span class="funcname">table-multiply-qty</span> table qty-col n)</h3>
<pre class="fulldoc">Multiplies every quantity in TABLE by N
QTY-COL is the index of the quantities column.
<h3 id="table--format-column-name" class="funcsig">(<span class="funcname">table--format-column-name</span> name)</h3>
<pre class="fulldoc">Returns NAME as lowercase with spaces replaced by underscores
VARS:
(TABLE VLA-OBJECT (TABLE-P TABLE))
(QTY-COL INT (>= QTY-COL 0))
(N INT)</pre>
(NAME STR)</pre>
</section>
<section>
<h3 id="table-p" class="funcsig">(<span class="funcname">table-p</span> obj)</h3>
<pre class="fulldoc">Returns T if OBJ is a table</pre>
<h3 id="table--get-column-names" class="funcsig">(<span class="funcname">table--get-column-names</span> table)</h3>
<pre class="fulldoc">Returns the column names as a list of formatted strings
Strings are formatted by <a href="util-object-table.html#table--format-column-name">table--format-column-name</a>
VARS:
(TABLE VLA-OBJECT (TABLE-P TABLE))</pre>
</section>
<section>
<h3 id="table-row-extents" class="funcsig">(<span class="funcname">table-row-extents</span> table row)</h3>
<pre class="fulldoc">Returns the extents of a row in TABLE
<h3 id="table--get-header-row" class="funcsig">(<span class="funcname">table--get-header-row</span> table)</h3>
<pre class="fulldoc">Returns the index of the row containing the column headers
The return value is a 2-item list in the form '(top-left-pt bot-right-pt).
VARS:
(TABLE VLA-OBJECT (TABLE-P TABLE))</pre>
</section>
<section>
<h3 id="table--multiply-qty" class="funcsig">(<span class="funcname">table--multiply-qty</span> table n)</h3>
<pre class="fulldoc">Multiplies every quantity in TABLE by N
VARS:
(TABLE VLA-OBJECT (TABLE-P TABLE))
(ROW INT)</pre>
(N INT)</pre>
</section>
<section>
<h3 id="table--pt-in-table-p" class="funcsig">(<span class="funcname">table--pt-in-table-p</span> pt table)</h3>
<pre class="fulldoc">Returns T if PT is within TABLE's bounding box
VARS:
(PT LIST (POINT-P PT))
(TABLE VLA-OBJECT (TABLE-P TABLE))</pre>
</section>

@ -49,6 +49,11 @@
<td>Returns the first line of STR</td>
</tr>
<tr>
<td class="funcsig"><a href="util-string.html#increment-mark">(<span class="funcname">increment-mark</span> mark)</a></td>
<td>Return the next string in spreadsheet column order</td>
</tr>
<tr>
<td class="funcsig"><a href="util-string.html#lowercase">(<span class="funcname">lowercase</span> str)</a></td>
<td>Returns STR in lowercase</td>
@ -164,6 +169,19 @@ TESTS:
item2") "item1")</pre>
</section>
<section>
<h3 id="increment-mark" class="funcsig">(<span class="funcname">increment-mark</span> mark)</h3>
<pre class="fulldoc">Return the next string in spreadsheet column order
VARS:
(MARK STR)
TESTS:
(= (INCREMENT-MARK "A") "B")
(= (INCREMENT-MARK "Z") "AA")
(= (INCREMENT-MARK "ZZ") "AAA")</pre>
</section>
<section>
<h3 id="lowercase" class="funcsig">(<span class="funcname">lowercase</span> str)</h3>
<pre class="fulldoc">Returns STR in lowercase

@ -5,7 +5,7 @@
<link rel="stylesheet" href="style.css" />
</head>
<body>
<h1><a href="user-manual.html">User Manual</a> - List of Commands (55)</h1>
<h1><a href="user-manual.html">User Manual</a> - List of Commands (54)</h1>
<div id="content">
<p>Commands with more than one line of documentation have the
full version included below.</p>
@ -92,13 +92,8 @@
</tr>
<tr>
<td><a href="#EDITHARDWARE">EDITHARDWARE</a></td>
<td>Edits a hardware table entry in a fab drawing</td>
</tr>
<tr>
<td><a href="#EDITMATERIAL">EDITMATERIAL</a></td>
<td>Edits a material table entry in a fab drawing</td>
<td><a href="#EDITTABLE">EDITTABLE</a></td>
<td>Edits the description of an item in a material or hardware table.</td>
</tr>
<tr>
@ -380,20 +375,10 @@ double-clicking.</pre>
</section>
<section>
<h3 id="EDITHARDWARE">EDITHARDWARE</h3>
<pre class="fulldoc">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.</pre>
</section>
<section>
<h3 id="EDITMATERIAL">EDITMATERIAL</h3>
<pre class="fulldoc">Edits a material table entry in a fab drawing
<h3 id="EDITTABLE">EDITTABLE</h3>
<pre class="fulldoc">Edits the description of an item in a material or hardware table.
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.</pre>
In a material table, this command also updates the item weight.</pre>
</section>
<section>
@ -444,12 +429,12 @@ This is a placeholder command</pre>
<h3 id="INSERTROWS">INSERTROWS</h3>
<pre class="fulldoc">Inserts rows in a fab drawing table
This command works on the material, hardware, and assembly tables. The tables below the
one you choose will be shifted to accommodate the new rows.
In a generic fab drawing, the tables below the one you choose will be shifted to
accommodate the new rows.
If inserting rows in the material list above an existing standard-prefix part (i.e. not
pans, STN, QT, or NRT), the mark numbers for parts below will be increased by the number
of rows added. This carries to the callouts in the drawing as well.
If inserting rows in the material list above an existing standard-prefix part (e.g. AA;
i.e. not pans, STN, QT, or NRT), the mark numbers for parts below will be increased by the
number of rows added. This carries to the callouts in the drawing as well.
If inserting rows in the assembly table, the quantities in the material table will be
updated.</pre>
@ -574,14 +559,11 @@ their tags.</pre>
A row is considered empty if its first column is blank.
This command works on the material, hardware, and assembly tables. The tables below the
one you choose will be shifted to accommodate the removed rows.
If trimming rows from the material list above an existing standard-prefix part (i.e. not
pans, STN, QT, or NRT), the mark numbers for parts below will be decreased by the number
of rows removed. This carries to the callouts in the drawing as well.
If inserting rows in the material list above an existing standard-prefix part (e.g. AA;
i.e. not pans, STN, QT, or NRT), the mark numbers for parts below will be increased by the
number of rows added. This carries to the callouts in the drawing as well.
If trimming rows from the assembly table, the quantities in the material table will be
If trimming rows in the assembly table, the quantities in the material table will be
updated.</pre>
</section>

File diff suppressed because one or more lines are too long

@ -221,6 +221,9 @@
;;
((LAMBDA (/ ERRORS) (SETQ ERRORS ((LAMBDA (/ *ASSERT-RETURN-ERROR*) (SETQ *ASSERT-RETURN-ERROR* T) (ASSERT-ALL (QUOTE ((= (ESCAPE-NEWLINES "hi") "hi") (= (ESCAPE-NEWLINES "item1\nitem2") "item1\\nitem2"))))))) (IF ERRORS (PROGN (PRINC "\nTEST autotest-escape-newlines: declare autotest\n") (PRINC (STRJOIN ERRORS "\n")) (PRINC "\n") (SETQ N-ERRORS (+ N-ERRORS (LENGTH ERRORS)))))))
;;
((LAMBDA (/ ERRORS) (SETQ ERRORS ((LAMBDA (/ *ASSERT-RETURN-ERROR*) (SETQ *ASSERT-RETURN-ERROR* T) (ASSERT-ALL (QUOTE ((= (INCREMENT-MARK "A") "B") (= (INCREMENT-MARK "Z") "AA") (= (INCREMENT-MARK "ZZ") "AAA"))))))) (IF ERRORS (PROGN (PRINC "\nTEST autotest-increment-mark: declare autotest\n") (PRINC (STRJOIN ERRORS "\n")) (PRINC "\n") (SETQ N-ERRORS (+ N-ERRORS (LENGTH ERRORS)))))))
(psc-include (list "util/xdata.lsp"))
;;

@ -33,38 +33,18 @@ wildcards wcmatch accepts will work here."
ret)
(defun-r 'get-table-by-title)
(defun-q get-table-title (table)
(defun-q table-get-title (table)
"Returns the contents of cell 0,0"
(declare (vars (table vla-object (table-p table))))
(vla-GetText table 0 0))
(defun-r 'get-table-title)
(defun-r 'table-get-title)
(defun-q pt-in-table-p (pt table / minpt maxpt min-x max-x min-y max-y x y)
"Returns T if PT is within TABLE's bounding box"
(declare (vars (pt list (point-p pt))
(table vla-object (table-p table))))
(vla-GetBoundingBox table 'minpt 'maxpt)
(within-box-p pt (vlax-safearray->list minpt) (vlax-safearray->list maxpt)))
(defun-r 'pt-in-table-p)
(defun-q table-cells (table / rows cols ret)
(defun-q table--cells (table / rows cols ret)
"Returns a list of cells in TABLE as 2-item lists of the form (row col)"
(foreach row (range 0 (vla-get-Rows table) 1)
(foreach col (range 0 (vla-get-Columns table) 1)
(add-to-list 'ret (list row col)))))
(defun-r 'table-cells)
(defun-q get-table-cell-bounding-box (table row col / extents)
"Returns the bounding box for the cell as a list of the form (minpt maxpt)"
(declare (vars (table vla-object (table-p table))
(row int)
(col int)))
(setq extents (3-item-list
(vlax-safearray->list
(vlax-variant-value
(vla-GetCellExtents table row col :vlax-false)))))
(list (nth 2 extents) (nth 1 extents)))
(defun-r 'get-table-cell-bounding-box)
(defun-r 'table--cells)
(defun-q get-table-cell (/ pt table)
"Prompts user for a point and checks if it is inside in a table
@ -74,7 +54,7 @@ If so, it returns a list of the form (table row column)."
(setq pt (getpoint "\nSelect table cell: ")
table (car
(strip-nil
(mapcar '(lambda(table) (if (pt-in-table-p pt table) table))
(mapcar '(lambda(table) (if (table--pt-in-table-p pt table) table))
(get-all-tables)))))
(osnap-on)
(if table
@ -84,39 +64,59 @@ If so, it returns a list of the form (table row column)."
'(lambda(cell / row col)
(setq row (car cell)
col (cadr cell))
(if (apply 'within-box-p (cons pt (get-table-cell-bounding-box table row col)))
(if (apply 'within-box-p (cons pt (get-table-cell--bounding-box table row col)))
(cons table cell)))
(table-cells table))))))
(table--cells table))))))
(defun-r 'get-table-cell)
(defun-q format-table-column-name (name)
(defun-q table--pt-in-table-p (pt table / minpt maxpt min-x max-x min-y max-y x y)
"Returns T if PT is within TABLE's bounding box"
(declare (vars (pt list (point-p pt))
(table vla-object (table-p table))))
(vla-GetBoundingBox table 'minpt 'maxpt)
(within-box-p pt (vlax-safearray->list minpt) (vlax-safearray->list maxpt)))
(defun-r 'table--pt-in-table-p)
(defun-q get-table-cell--bounding-box (table row col / extents)
"Returns the bounding box for the cell as a list of the form (minpt maxpt)"
(declare (vars (table vla-object (table-p table))
(row int)
(col int)))
(setq extents (3-item-list
(vlax-safearray->list
(vlax-variant-value
(vla-GetCellExtents table row col :vlax-false)))))
(list (nth 2 extents) (nth 1 extents)))
(defun-r 'get-table-cell--bounding-box)
(defun-q table--format-column-name (name)
"Returns NAME as lowercase with spaces replaced by underscores"
(declare (vars (name str)))
(string-subst-all "_" " " (lowercase name)))
(defun-r 'format-table-column-name)
(defun-r 'table--format-column-name)
(defun-q empty-first-column-p (table row)
(defun-q table--empty-first-column-p (table row)
"Returns T if column 0 of ROW is empty"
(declare (vars (table vla-object (table-p table))
(row int)))
(= (vla-GetText table row 0) ""))
(defun-r 'empty-first-column-p)
(defun-r 'table--empty-first-column-p)
(defun-q get-table-header-row (table)
(defun-q table--get-header-row (table)
"Returns the index of the row containing the column headers"
(declare (vars (table vla-object (table-p table))))
(if (empty-first-column-p table 1) 2 1))
(defun-r 'get-table-header-row)
(if (table--empty-first-column-p table 1) 2 1))
(defun-r 'table--get-header-row)
(defun-q get-table-column-names (table / header-row)
(defun-q table--get-column-names (table / header-row)
"Returns the column names as a list of formatted strings
Strings are formatted by %format-table-column-name"
Strings are formatted by %table--format-column-name"
(declare (vars (table vla-object (table-p table))))
(setq header-row (get-table-header-row table))
(mapcar '(lambda(col) (format-table-column-name (vla-GetText table header-row col)))
(setq header-row (table--get-header-row table))
(mapcar '(lambda(col) (table--format-column-name (vla-GetText table header-row col)))
(range 0 (vla-get-Columns table) 1)))
(defun-r 'get-table-column-names)
(defun-r 'table--get-column-names)
(defun-q table-insert-rows (table nrows after / title rowht)
"Inserts NROWS rows in a fab drawing TABLE after row AFTER
@ -128,8 +128,8 @@ and Hardware tables, if found."
(nrows int)
(after int)))
(setq rowht (vla-GetRowHeight table 0)
title (get-table-title table))
(shift-tables-maybe title (- (* rowht nrows)))
title (table-get-title table))
(--shift-tables-maybe title (- (* rowht nrows)))
(vla-InsertRows table (1+ after) rowht nrows)
(if (begins-with title "Assembly")
(progn
@ -140,161 +140,209 @@ and Hardware tables, if found."
(progn
(table-divide-qty mt (- table-nrows nrows 2))
(table-multiply-qty mt (- table-nrows 2))
(mat-table-update-ea-wt mt)))
(mat-table--update-ea-wt mt)))
(if ht
(progn
(table-divide-qty ht (- table-nrows nrows 2))
(table-multiply-qty ht (- table-nrows 2))))))
(if (= title "Material")
(progn
(mat-table-update-marks table + nrows (1+ after))
(mat-table-update-tot-wt table))))
(mat-table--update-marks table + nrows (1+ after))
(mat-table--update-tot-wt table))))
(defun-r 'table-insert-rows)
(defun-q mat-table-update-marks (table +- n row / prefix row rows mark marks)
"Update fab mark numbers in TABLE and callouts
(defun-q table-trim-empty-rows (table row / title nrows mt ht table-nrows)
"Trims empty rows from TABLE, starting at ROW
+- should be one of the built-in functions + or -, indicating whether the mark numbers
should increase or decrease. N is the number of places the number should jump. ROW is the
first row in the material table containing mark numbers to change."
Determines if row is empty using %table--empty-first-column-p"
(declare (vars (table vla-object (table-p table))
(+- subr (member +- (list + -)))
(n int)
(row int)))
(defun new-mark (mark)
(strcat prefix (to-string (+- (atoi (vl-string-left-trim prefix mark)) n))))
(setq mark-col (vl-position "mark" (get-table-column-names table))
prefix (vl-string-right-trim "0123456789" (vla-GetText table 2 mark-col))
rows (1- (vla-get-Rows table)))
(while (and (< row rows)
(or (begins-with (setq mark (vla-GetText table row mark-col)) prefix)
(= mark "")))
(if (/= mark "")
(progn
(add-to-list 'marks (list mark (new-mark mark)))
(vla-SetText table row mark-col (new-mark mark))))
(inc! 'row))
(mapcar '(lambda(x) (vla-replace-string modelSpace (car x) (cadr x)))
((if (= +- +) reverse identity) marks))
(vla-Regen acadDoc acAllViewPorts))
(defun-r 'mat-table-update-marks)
(defun-q mat-table-fix-row-height (table row orig-ht / base-ht ass-table)
"Constrains the row height to multiples of ORIG-HT
If row height has changed from ORIG-HT, moves hardware/assembly tables as necessary"
(declare (vars (table vla-object (table-p table))
(row int)
(orig-ht real)))
(setq i 1
base-ht (vla-GetRowHeight table 0))
(while (> (- (vla-GetRowHeight table row) (* base-ht i)) 0.1)
(vla-SetRowHeight table row (* orig-ht (inc! 'i)))
(if (= title "Material")
(shift-tables '("Hardware" "Assembly*" "Finish") (- orig-ht)))))
(defun-r 'mat-table-fix-row-height)
(setq title (table-get-title table)
table-nrows (vla-get-Rows table)
nrows 0)
(if (= title "Material")
(dec! 'table-nrows))
(while (and (< row table-nrows)
(empty-first-column-p table row))
(inc! 'row)
(inc! 'nrows))
(if (= title "Material")
(mat-table-update-marks table - nrows (- row nrows)))
(if (> nrows 0)
(vla-DeleteRows table (- row nrows) nrows))
(if (begins-with title "Assembly")
(progn
(setq mt (get-table-by-title "Material")
ht (get-table-by-title "Hardware"))
(if mt
(progn
(table-divide-qty mt (- table-nrows 2))
(table-multiply-qty mt (- table-nrows nrows 2))
(mat-table-update-ea-wt mt)))
(if ht
(progn
(table-divide-qty ht (- table-nrows 2))
(table-multiply-qty ht (- table-nrows nrows 2))))))
(--shift-tables-maybe title (* (vla-GetRowHeight table 0) nrows)))
(defun-r 'table-trim-empty-rows)
(defun-q shift-tables-maybe (title delta-y)
"If TITLE is one of the generic fab tables, call %shift-tables"
(defun-q --shift-tables-maybe (title delta-y)
"If TITLE is one of the generic fab tables, call %--shift-tables"
(cond ((= title "Material")
(shift-tables '("Hardware" "Assembly*" "Finish") delta-y))
(--shift-tables '("Hardware" "Assembly*" "Finish") delta-y))
((= title "Hardware")
(shift-tables '("Assembly*" "Finish") delta-y))
(--shift-tables '("Assembly*" "Finish") delta-y))
((wcmatch title "Assembly*")
(shift-tables '("Finish") delta-y))))
(defun-r 'shift-tables-maybe)
(--shift-tables '("Finish") delta-y))))
(defun-r '--shift-tables-maybe)
(defun-q shift-tables (names delta-y)
(defun-q --shift-tables (names delta-y)
"Move the tables named in NAMES vertically by DELTA-Y"
(declare (vars (names (list nil) (vl-every 'stringp names))
(delta-y nil (numberp delta-y))))
(foreach tbl (mapcar 'get-table-by-title names)
(vla-Move tbl (3dpt 0 0) (3dpt 0 delta-y))))
(defun-r 'shift-tables)
(defun-r '--shift-tables)
(defun-q mat-table-update-desc (table row desc / row-ht)
"Updates the description column at ROW with DESC
If present, line weight and each weight are updated."
(declare (vars (table vla-object (table-p table))
(row int)
(desc str)))
(setq weight-col (vl-position "weight" (get-table-column-names table))
row-ht (vla-GetRowHeight table row))
(vla-SetText table row (vl-position "description" col-names) desc)
(mat-table-fix-row-height table row row-ht)
(if weight-col
(progn
(vla-SetText table row weight-col
(string-subst-all (to-string (1+ row)) "#" (calc-weight-formula table row)))
(vla-SetCellFormat table row weight-col "%lu2%pr1"))))
(defun-r 'mat-table-update-desc)
(defun-q mat-table-add-data (before datas / n row)
"Adds bulk data to material table
BEFORE is the row to add data at. The special symbol 'end means the last row. DATAS is a
list of data lists representing row data."
(declare (vars (before nil (or (= before 'end)
(= (type before) 'int)))
(datas list (vl-every 'data-list-p datas))))
(if (= before 'end)
(setq before (1- (vla-get-Rows mat-table))))
(setq n (length datas)
row before)
(table-insert-rows mat-table n before)
(vla-put-RegenerateTableSuppressed mat-table :vlax-true)
(foreach data datas
(mat-table-set-row mat-table row data)
(inc! 'row))
(vla-put-RegenerateTableSuppressed mat-table :vlax-false))
(defun-r 'mat-table-add-data)
(defun-q column-name->letter (name / pos)
(defun-q table--column-name->letter (name / pos)
"Returns the letter designation of the column named NAME
Either col-names or table must be defined."
(declare (vars (name str)))
(setq pos (vl-position name (if col-names col-names (get-table-column-names table))))
(setq pos (vl-position name (if col-names col-names (table--get-column-names table))))
(if (< pos 27)
(chr (vl-string-elt "ABCDEFGHIJKLMNOPQRSTUVWXYZ" pos))
((lambda(/ mark)
(setq mark "AA")
(repeat (- pos 27) (setq mark (increment-mark mark)))
mark))))
(defun-r 'column-name->letter)
(defun-r 'table--column-name->letter)
(defun-q calc-weight-formula (table row / desc line wt wt-type col-names letters col)
"Returns the weight formula for a material description"
(defun-q table--multiply-qty (table n / i lastrow qty row-ht)
"Multiplies every quantity in TABLE by N"
(declare (vars (table vla-object (table-p table))
(n int)))
(setq qty-col (vl-position "qty" (table--get-column-names table))
i 1
lastrow (vla-get-Rows table))
(vla-put-RegenerateTableSuppressed table :vlax-true)
(while (< (inc! 'i) lastrow)
(setq qty (atoi (vla-GetText table i qty-col)))
(if (> qty 0) (vla-SetText table i qty-col (to-string (* qty n)))))
(vla-put-RegenerateTableSuppressed table :vlax-false))
(defun-r 'table--multiply-qty)
(defun-q table--divide-qty (table n / i lastrow qty)
"Divides every quantity in TABLE by N"
(declare (vars (table vla-object (table-p table))
(n int)))
(setq qty-col (vl-position "qty" (table--get-column-names table))
i 1
lastrow (vla-get-Rows table))
(vla-put-RegenerateTableSuppressed table :vlax-true)
(while (< (inc! 'i) lastrow)
(setq qty (atoi (vla-GetText table i qty-col)))
(if (> qty 0) (vla-SetText table i qty-col (to-string (/ qty n)))))
(vla-put-RegenerateTableSuppressed table :vlax-false))
(defun-r 'table--divide-qty)
(defun-q table--fix-row-height (table row orig-ht / base-ht ass-table)
"Constrains the row height to multiples of table base row height
If ROW height has changed from ORIG-HT, calls %--shift-tables-maybe"
(declare (vars (table vla-object (table-p table))
(row int)
(orig-ht real)))
(setq i 1
base-ht (vla-GetRowHeight table 0))
(while (> (- (vla-GetRowHeight table row) (* base-ht i)) 0.1)
(vla-SetRowHeight table row (* orig-ht (inc! 'i)))
(--shift-tables-maybe (table-get-title table) (- orig ht))))
(defun-r 'table--fix-row-height)
(defun-q table-set-row (table row data / title cols idx)
"Sets a ROW in TABLE
ROW is a row index and DATA is a data list whose keys correspond to the table columns. If TABLE is a material table, attempts to set the weight formula.
To add data in bulk with formula regeneration disabled to improve performance, see
%table-add-data"
(declare (vars (table vla-object (table-p table))
(row int (>= row 0))
(data nil (data-list-p data))))
(setq cols (table--get-column-names table)
idx 0
row-ht (vla-GetRowHeight table row)
title (table-get-title table))
(foreach col cols
(if (setq col (xd-value col data))
(vla-SetText table row idx col))
(inc! 'idx))
(if (and (ends-with title "Material")
(setq weight-formula (mat-table--calc-weight-formula table row)))
(vla-SetText table row (vl-position "weight" cols) weight-formula))
(table--fix-row-height table row row-ht))
(defun-r 'table-set-row)
(defun-q table-add-data (table row datas)
"Adds bulk data to TABLE with regeneration suppressed
ROW is the row after which to add data. DATAS is a list of data lists representing row
data."
(declare (vars (table vla-object (table-p table))
(row int (>= row 0))
(datas list (vl-every 'data-list-p datas))))
(vla-put-RegenerateTableSuppressed table :vlax-true)
(table-insert-rows table (length datas) row)
(foreach data datas
(inc! 'row)
(table-set-row table row data))
(vla-put-RegenerateTableSuppressed table :vlax-false))
(defun-r 'table-add-data)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; material table specific functions
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun-q mat-table--update-marks (table +- n row / prefix row rows mark marks)
"Update fab mark numbers in TABLE and callouts
+- should be one of the built-in functions + or -, indicating whether the mark numbers
should increase or decrease. N is the number of places the number should jump. ROW is the
first row in the material table containing mark numbers to change."
(declare (vars (table vla-object (table-p table))
(+- subr (member +- (list + -)))
(n int)
(row int)))
(setq col-names (get-table-column-names table)
description (vla-GetText table row (vl-position "description" col-names)))
(setq line (assoc description (read-csv "fab/material.csv")))
(if (not line) (error (strcat "Weight formula not found: " description)))
(defun col (name)
(strcat (column-name->letter name) (to-string (1+ row))))
(setq wt (nth 1 line)
wt-type (nth 2 line))
(cond ((= wt-type "sqft")
(strcat "=(" (col "qty") "*" (col "length") "*" (col "width") "/144)*" wt))
((= wt-type "foot")
(strcat "=(" (col "qty") "*" (col "length") "/12)*" wt))
((= wt-type "each")
(strcat "=" (col "qty") "*" wt))))
(defun-r 'calc-weight-formula)
(defun-q mat-table-update-tot-wt (table / row col col-letter)
(defun new-mark (mark)
(strcat prefix (to-string (+- (atoi (vl-string-left-trim prefix mark)) n))))
(setq mark-col (vl-position "mark" (table--get-column-names table))
prefix (vl-string-right-trim "0123456789" (vla-GetText table 2 mark-col))
rows (1- (vla-get-Rows table)))
(while (and (< row rows)
(or (begins-with (setq mark (vla-GetText table row mark-col)) prefix)
(= mark "")))
(if (/= mark "")
(progn
(add-to-list 'marks (list mark (new-mark mark)))
(vla-SetText table row mark-col (new-mark mark))))
(inc! 'row))
(mapcar '(lambda(x) (vla-replace-string modelSpace (car x) (cadr x)))
((if (= +- +) reverse identity) marks))
(vla-Regen acadDoc acAllViewPorts))
(defun-r 'mat-table--update-marks)
(defun-q mat-table--update-tot-wt (table / row col col-letter)
"Updates the formula for each weight in TABLE to include any added rows"
(declare (vars (table vla-object (table-p table))))
(setq row (1- (vla-get-Rows table))
col (- (vla-get-Columns table) 3)
weight-col (column-name->letter "weight"))
weight-col (table--column-name->letter "weight"))
(vla-SetCellFormat table row col "%lu2%pr1")
(vla-SetText table row col (strcat "=SUM(" weight-col "3:" weight-col (to-string row) ")")))
(defun-r 'mat-table-update-tot-wt)
(defun-r 'mat-table--update-tot-wt)
(defun-q mat-table-update-ea-wt (table / at lastrow formula weight-col)
(defun-q mat-table--update-ea-wt (table / at lastrow formula weight-col)
"Updates the formula for each weight in TABLE to include any added rows"
(declare (vars (table vla-object (table-p table))))
(setq at (get-table-by-title "Assembly*")
@ -306,28 +354,25 @@ Either col-names or table must be defined."
(to-string (- (vla-get-Rows at) 2))))
(vla-SetCellFormat table lastrow 6 "%lu2%pr1")
(vla-SetText table lastrow 6 formula))
(defun-r 'mat-table-update-ea-wt)
(defun-r 'mat-table--update-ea-wt)
(defun-q table-multiply-qty (table n / i lastrow qty row-ht)
"Multiplies every quantity in TABLE by N"
(declare (vars (table vla-object (table-p table))
(n int)))
(setq qty-col (vl-position "qty" (get-table-column-names table))
i 1
lastrow (vla-get-Rows table))
(while (< (inc! 'i) lastrow)
(setq qty (atoi (vla-GetText table i qty-col)))
(if (> qty 0) (vla-SetText table i qty-col (to-string (* qty n))))))
(defun-r 'table-multiply-qty)
(defun-q table-divide-qty (table n / i lastrow qty)
"Divides every quantity in TABLE by N"
(defun-q mat-table--calc-weight-formula (table row / description line wt wt-type col col-names)
"Returns the weight formula for a material description"
(declare (vars (table vla-object (table-p table))
(n int)))
(setq qty-col (vl-position "qty" (get-table-column-names table))
i 1
lastrow (vla-get-Rows table))
(while (< (inc! 'i) lastrow)
(setq qty (atoi (vla-GetText table i qty-col)))
(if (> qty 0) (vla-SetText table i qty-col (to-string (/ qty n))))))
(defun-r 'table-divide-qty)
(row int)))
(setq col-names (table--get-column-names table)
description (vla-GetText table row (vl-position "description" col-names))
line (assoc description (read-csv "fab/material.csv")))
(if line
(progn
(defun col (name)
(strcat (table--column-name->letter name) (to-string (1+ row))))
(setq wt (nth 1 line)
wt-type (nth 2 line))
(cond ((= wt-type "sqft")
(strcat "=(" (col "qty") "*" (col "length") "*" (col "width") "/144)*" wt))
((= wt-type "foot")
(strcat "=(" (col "qty") "*" (col "length") "/12)*" wt))
((= wt-type "each")
(strcat "=" (col "qty") "*" wt))))))
(defun-r 'mat-table--calc-weight-formula)

Loading…
Cancel
Save