sachindkini Posted yesterday at 04:08 PM Posted yesterday at 04:08 PM Hi Sir, how to gap betwwen main block and nested block in dcl ;----------------------------------------------- (cond ((null (setq lst (vl-sort lst '<))) (princ "\nNo blocks found in drawing.") ) ((null (and (setq tmp (vl-filename-mktemp nil nil ".dcl")) (setq des (open tmp "w")) (foreach line (list (strcat "blockpreview : dialog { label = \"" datetitle "\";") ;; Title with date-time " spacer;" " : row {" " : boxed_column { label = \"Block List\"; width = 35; fixed_width = true;" " : list_box { key = \"lst\"; height = 15; fixed_height = true; }" " }" " spacer;" " : boxed_column { label = \"Preview\"; width = 35; fixed_width = true;" " : image { key = \"img\"; height = 15; fixed_height = true; }" " }" " }" " spacer;" " : image { color = 30; width = 50; height = 0.5; alignment = centered; }" ;; Orange line " spacer;" " : boxed_column { label = \"Block Tools\";" ;; Single box around ALL buttons " : row {" " : button { key = \"cbp_btn\"; label = \"Change Base Point\"; }" " : button { key = \"cbpr_btn\"; label = \"Change Base Point (Ref)\"; }" " }" " spacer;" " : row {" " : button { key = \"rename_btn\"; label = \"Rename\"; is_default = true; }" " : button { key = \"select_btn\"; label = \"Select Block\"; }" " : button { key = \"cancel\"; label = \"Cancel\"; is_cancel = true; }" " : button { key = \"about\"; label = \"About\"; }" " }" " }" " spacer;" " : text { label = \"Author: XYZ | https://abcd.com/\"; alignment = centered; }" "}" ) (write-line line des) ) (not (setq des (close des))) (< 0 (setq dcl (load_dialog tmp))) (new_dialog "blockpreview" dcl) ) ) (princ "\nUnable to load dialog.") ) ;------------------------------------------------ Quote
Steven P Posted yesterday at 04:49 PM Posted yesterday at 04:49 PM One way, might be the easiest is to change the list that populates 'Block List', adding spaces to the nested block So you might have a line like this in your LISP: (start_list "lst" 3)(mapcar 'add_list BlockList)(end_list) Where BlockList is your list of block, might be (setq BlockList (list "BLOCK-1" "BLK-1" "BLK-2"... "BLOCK-2")) Which you could change to be (setq BlockList (list "BLOCK-1" " BLK-1" " BLK-2"... "BLOCK-2")) I don't think you can do the indenting with DCL, has to be done before then. 1 Quote
Lee Mac Posted 23 hours ago Posted 23 hours ago Use the DCL tabs attribute and prefix the list items with a tab character ("\t"). 2 Quote
Steven P Posted 23 hours ago Posted 23 hours ago I didn't know you could do that! Still need to add the tabs \t to the base list, but you'd get a better result I think Quote
Lee Mac Posted 18 hours ago Posted 18 hours ago 4 hours ago, Steven P said: I didn't know you could do that! Still need to add the tabs \t to the base list, but you'd get a better result I think I use the technique frequently to achieve list box columns - for example, as used by the Content Builder dialog displayed by my Incremental Numbering Suite. 2 Quote
sachindkini Posted 7 hours ago Author Posted 7 hours ago Sir \t not working ;; Collect block names (setq lst nil) (while (setq def (tblnext "BLOCK" (null def))) (if (and (= 0 (logand 125 (cdr (assoc 70 def)))) (not (wcmatch (cdr (assoc 2 def)) "`_*,`**,*|*")) ) (setq lst (cons (cdr (assoc 2 def)) lst)) ) ) ;-----------------------------------------------DCL (cond ((null (setq lst (vl-sort lst '<))) (princ "\nNo blocks found in drawing.") ) ((null (and (setq tmp (vl-filename-mktemp nil nil ".dcl")) (setq des (open tmp "w")) (foreach line (list (strcat "blockpreview : dialog { label = \"" datetitle "\";") ;; Title with date-time " spacer;" " : row {" " : boxed_column { label = \"Block List\"; width = 35; fixed_width = true;" " : list_box { key = \"lst\"; height = 15; fixed_height = true; }" " }" " spacer;" " : boxed_column { label = \"Preview\"; width = 35; fixed_width = true;" " : image { key = \"img\"; height = 15; fixed_height = true; }" " }" " }" " spacer;" " : image { color = 30; width = 50; height = 0.5; alignment = centered; }" ;; Orange line " spacer;" " : boxed_column { label = \"Block Tools\";" ;; Single box around ALL buttons " : row {" " : button { key = \"cbp_btn\"; label = \"Change Base Point\"; }" " : button { key = \"cbpr_btn\"; label = \"Change Base Point (Ref)\"; }" " }" " spacer;" " : row {" " : button { key = \"rename_btn\"; label = \"Rename\"; is_default = true; }" " : button { key = \"select_btn\"; label = \"Select Block\"; }" " : button { key = \"cancel\"; label = \"Cancel\"; is_cancel = true; }" " : button { key = \"about\"; label = \"About\"; }" " }" " }" " spacer;" " : text { label = \"Author: XYZ | https://abcd.com/\"; alignment = centered; }" "}" ) (write-line line des) ) (not (setq des (close des))) (< 0 (setq dcl (load_dialog tmp))) (new_dialog "blockpreview" dcl) ) ) (princ "\nUnable to load dialog.") ) ;---------------------------------------------------------------------------- (t (start_list "lst") (foreach x lst (add_list x)) (end_list) (set_tile "lst" "0") (setq blkname (car lst)) (_blockpreview blkname) (action_tile "lst" "(setq blkname (nth (atoi $value) lst)) (_blockpreview blkname)" ) (action_tile "rename_btn" "(done_dialog 2)") (action_tile "select_btn" "(done_dialog 3)") (action_tile "cbp_btn" "(done_dialog 4)") (action_tile "cbpr_btn" "(done_dialog 5)") (action_tile "cancel" "(done_dialog 0)") (action_tile "about" "(startapp \"explorer\" \"https://ABCD.COM/\")") (setq response (start_dialog)) (cond ((= response 2) (RENB blkname)) ((= response 3) (princ "\nSelect a block reference in the drawing.") (if (and (setq ent (car (entsel))) (= "INSERT" (cdr (assoc 0 (entget ent))))) (progn (setq blkname (cdr (assoc 2 (entget ent)))) (RENB blkname)) (princ "\nInvalid selection.") ) ) ((= response 4) (LM:changeblockbasepoint nil)) ((= response 5) (LM:changeblockbasepoint t)) ) ) ) (*error* nil) (princ) ) Quote
Lee Mac Posted 6 hours ago Posted 6 hours ago Where have you added the tab character "\t"? Where did you add the tabs attribute? Quote
Steven P Posted 5 hours ago Posted 5 hours ago This might help the OP... my 2nd favourite LISP website... also use Lees example above (from my 1st favourite LISP website) https://www.afralisp.net/archive/lispa/lisp49af.htm Quote
sachindkini Posted 3 hours ago Author Posted 3 hours ago (edited) sorry wrongly code posted (cond ((null (setq lst (vl-sort lst '(lambda (a b) (< (car a) (car b)))))) (princ "\nNo blocks found in drawing.") ) ((null (and (setq tmp (vl-filename-mktemp nil nil ".dcl")) (setq des (open tmp "w")) (foreach line (list (strcat "blockpreview : dialog { label = \"" datetitle "\";") " spacer;" " : row {" " : boxed_column { label = \"Block List\"; width = 35; fixed_width = true;" " : list_box { key = \"lst\"; height = 15; fixed_height = true; tabs = \"20 8\"; }" " }" " spacer;" " : boxed_column { label = \"Preview\"; width = 35; fixed_width = true;" " : image { key = \"img\"; height = 15; fixed_height = true; }" " }" " }" " spacer;" " : image { color = 30; width = 50; height = 0.5; alignment = centered; }" " spacer;" " : boxed_column { label = \"Block Tools\";" " : row {" " : button { key = \"cbp_btn\"; label = \"Change Base Point\"; }" " : button { key = \"cbpr_btn\"; label = \"Change Base Point (Ref)\"; }" " }" " spacer;" " : row {" " : button { key = \"rename_btn\"; label = \"Rename\"; is_default = true; }" " : button { key = \"select_btn\"; label = \"Select Block\"; }" " : button { key = \"cancel\"; label = \"Cancel\"; is_cancel = true; }" " : button { key = \"about\"; label = \"About\"; }" " }" " }" " spacer;" " : text { label = \"Author: xyz | https://abcd.com/\"; alignment = centered; }" "}" ;; ) (write-line line des)) (not (setq des (close des))) (< 0 (setq dcl (load_dialog tmp))) (new_dialog "blockpreview" dcl) )) (princ "\nUnable to load dialog.") ) (t (start_list "lst") (foreach x lst (add_list (strcat (car x) "\t" (cadr x))) ; Tab-separated entry ) (end_list) (set_tile "lst" "0") (setq blkname (caar lst)) (_blockpreview blkname) ..... " : boxed_column { label = \"Block List\"; width = 35; fixed_width = true;" " : list_box { key = \"lst\"; height = 15; fixed_height = true; tabs = \"20 8\"; }" " }" ;---------------------------------------------------------------- (t (start_list "lst") (foreach x lst (add_list (strcat (car x) "\t" (cadr x))) ; Tab-separated entry ) (end_list) Edited 3 hours ago by sachindkini 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.