OAKWOOD Posted January 27 Posted January 27 (edited) Hi I currently have a lisp to draw even spaced T+G boards across a specified length (the measurement of a line is specified on screen) I would like to be able to input the chamfer (default 3mm) and the gap between (default 3mm) as a separate variable, so i could have no space between them or i could have 2mm between but no chamfer (square edged) I have added a drawing showing what the lisp does now and what I would like it to do. Ideally it would also ask whether or not I needed tounges on the outside boards (explained in the drawing attached) Current code is as follows: (defun c:t_g_board (/ total_width_dim _redraw total_width boards_number tongue_thickness tongue_setback tongue_length tongue_overlap insertion_point board_thickness boards_gap_chamfer one_board_width board_start_geom_list board_end_geom_list vertices_list ) (setq total_width_dim (car (entsel "\nPick dimension for total width: ")) _redraw (redraw total_width_dim 3) total_width (cdr (assoc 42 (entget total_width_dim))) boards_number (getint "\nEnter number of boards: ") board_thickness (getreal "\nEnter board_thickness: ") ; 22 tongue_thickness (getreal "\nEnter tongue thickness: ") ; 6 tongue_setback (getreal "\nEnter tongue setback: ") ; 8 tongue_length (getreal "\nEnter tongue_length: ") ; 12 boards_gap_chamfer (getreal "\nEnter boards_gap_chamfer: ") ; 3 insertion_point (getpoint "\nPick insertion point: ") insertion_point_list '((0 0)) tongue_overlap (- tongue_length boards_gap_chamfer) one_board_width (/ (- total_width (* boards_gap_chamfer (1- boards_number))) boards_number) board_start_geom_list (list (list (list one_board_width (+ (- board_thickness) tongue_setback)) ; 1 (list one_board_width (+ (- board_thickness) boards_gap_chamfer)) ; 2 (list (- one_board_width boards_gap_chamfer) (- board_thickness)) ; 3 (list boards_gap_chamfer (- board_thickness)) ; 4 (list 0 (+ (- board_thickness) boards_gap_chamfer)) ; 5 (list 0 (+ (- board_thickness) tongue_setback)) ; 6 (list (- tongue_length) (+ (- board_thickness) tongue_setback)) ; 7 (list (- tongue_length) (+ (- board_thickness) tongue_setback tongue_thickness)) ; 8 (list 0 (+ (- board_thickness) tongue_setback tongue_thickness)) ; 9 (list 0 0) ; 10 (list one_board_width 0) ; 11 (list one_board_width (+ (- board_thickness) tongue_setback tongue_thickness)) ; 12 ) (list (list (- one_board_width tongue_overlap) (+ (- board_thickness) tongue_setback tongue_thickness)) ; 1 (list (- one_board_width tongue_overlap boards_gap_chamfer) (+ (- board_thickness) tongue_setback tongue_thickness)) ; 2 (list (- one_board_width tongue_overlap boards_gap_chamfer) (+ (- board_thickness) tongue_setback)) ; 3 (list (- one_board_width tongue_overlap) (+ (- board_thickness) tongue_setback)) ; 4 ) ) board_end_geom_list (append (car board_start_geom_list) (list (list (+ one_board_width tongue_length) (+ (- board_thickness) tongue_setback tongue_thickness))) ; 13 (list (list (+ one_board_width tongue_length) (+ (- board_thickness) tongue_setback))) ; 14 ) ) (repeat (1- boards_number) (setq insertion_point_list (append insertion_point_list (list (mapcar '+ (last insertion_point_list) (list (+ one_board_width boards_gap_chamfer) 0)))))) (foreach insertion (vl-remove (last insertion_point_list) insertion_point_list) (foreach pline board_start_geom_list (vla-addlightweightpolyline (vla-get-block (vla-get-activelayout (vla-get-activedocument (vlax-get-acad-object)))) (vlax-safearray-fill (vlax-make-safearray vlax-vbdouble (cons 1 (length (setq vertices_list (apply 'append (mapcar '(lambda (vertex) (mapcar '+ insertion_point insertion vertex)) pline ) ) ) ) ) ) vertices_list ) ) ) ) (vlax-put (vla-addlightweightpolyline (vla-get-block (vla-get-activelayout (vla-get-activedocument (vlax-get-acad-object)))) (vlax-safearray-fill (vlax-make-safearray vlax-vbdouble (cons 1 (length (setq vertices_list (apply 'append (mapcar '(lambda (vertex) (mapcar '+ insertion_point (last insertion_point_list) vertex ) ) board_end_geom_list ) ) ) ) ) ) vertices_list ) ) 'closed 1 ) (redraw total_width_dim 4) (princ) ) any help much appreciated. Drawing1.dwgFetching info... Edited January 28 by fuccaro adding CODE tags Quote
mhupp Posted January 28 Posted January 28 Use the <> when posting code please. if you have AutoCAD look up Dynamic blocks Quote
fuccaro Posted January 28 Posted January 28 I added those CODE tags. You guys just do the rest of the work! Quote
BIGAL Posted January 29 Posted January 29 You posted this over at forums auto desk and som solutions were provider Quote
rlx Posted January 30 Posted January 30 (edited) Thanx for the intel Bigal, so chances are OP is a no-show. Did have some fun with this on my couch though (mainly because of how to make the image (already thinking about how to automate this further) but for now I guess no use spending any more time on this because OP already has solution on other forum. On the other hand , I needed the practice so maybe its nice to play with for somebody else... oakwood.lspFetching info... Edited January 31 by rlx Quote
BIGAL Posted January 31 Posted January 31 Great DCL approach. The link, https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-for-t-g-boards-modifying-existing-lisp-required/td-p/13272042 1 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.