Jump to content

Recommended Posts

Posted

hello fellow forum users, I have a compound lisp routine of 2, and it works fine. I have made several adjustments, but I need help with 1 adjustment. This involves having to select a block in the drawing yourself. I would like this to happen automatically because the block is placed in the drawing according to the first part of the lisp routine.

Lisp routine operation: Select via list boxes Hight(lb0), Lenght(lb1) and name(lb2). (for radiator) insert block radiator with x value Lenght. Then rename block radiator in the drawing to name from list lb2. This does not happen automatically and I think it should be possible. But I have a problem with AT:GetSel. I was able to remove AT:GetString. Who can help me with a solution?

 

CBLL.lsp

Posted (edited)

Not sure but it seems to me at this point 

 

					(command "layer" "s" "WB5611----_RADIATOR" "" )	 
					(command "insert" "radiator" pt4 lengte 100 (/ (* ang 180.0) pi))

 

You could use Bedit calling radiator then do a Bsaveas with the new name, then insert the new block with correct scale based on length. This will also keep radiator for further use. Will have a play.

 

Try this.

;; DCL List-Tile Dependency  -  V1.1 (2019-04-27)  -  Lee Mac
;; Configures action_tile statements for the list of keys to enabled dependency between the DCL tiles.
;; key     - [lst] List of DCL tile keys in order of dependency
;; lst-sym - [sym] Quoted variable containing list data
;; rtn-sym - [sym] Quoted variable containing initial selection indexes
(defun LM:dcld:action ( key lst-sym rtn-sym )
    
    (defun LM:dcld:addlist ( key lst )
        (start_list key)
        (foreach itm lst (add_list itm))
        (end_list)
    )
    (defun LM:dcld:getlists ( idx lst )
        (if (cdr idx)
            (cons (mapcar 'car lst) (LM:dcld:getlists (cdr idx) (cdr (nth (car idx) lst))))
            lst
        )
    )
    (defun LM:substnth ( itm idx lst )
        (if lst
            (if (zerop idx)
                (cons itm (mapcar '(lambda ( x ) 0) (cdr lst)))
                (cons (car lst) (LM:substnth itm (1- idx) (cdr lst)))
            )
        )
    )
    (defun LM:dcld:actions ( key lst-sym rtn-sym lvl / fun )
        (setq fun
            (if (cdr key)
                (list 'lambda '( val lst )
                    (list 'setq rtn-sym (list 'LM:substnth '(atoi val) lvl rtn-sym))
                    (list 'LM:dcld:addlist (cadr key) (list 'nth (1+ lvl) (list 'LM:dcld:getlists rtn-sym 'lst)))
                    (list
                        (LM:dcld:actions (cdr key) lst-sym rtn-sym (1+ lvl))
                        (list 'set_tile (cadr key) "0") 'lst
                    )
                )
                (list 'lambda '( val lst )
                    (list 'setq rtn-sym (list 'LM:substnth '(atoi val) lvl rtn-sym))
                )
            )
        )
        (action_tile (car key) (vl-prin1-to-string (list fun '$value lst-sym)))
        fun
    )
    (mapcar 'LM:dcld:addlist key (LM:dcld:getlists (eval rtn-sym) (eval lst-sym)))
    (   (eval (LM:dcld:actions key lst-sym rtn-sym 0))
        (set_tile (car key) (itoa (car (eval rtn-sym))))
        (eval lst-sym)
    )
    (princ)
)

;; DCL List-Tile Dependency  -  Get Items  -  Lee Mac
;; Returns a list of the items selected from each dependent list tile.
;; idx - [lst] List of selection indexes
;; lst - [lst] List data

(defun LM:dcld:getitems ( idx lst / tmp )
    (if (cdr idx)
        (cons (car (setq tmp (nth (car idx) lst))) (LM:dcld:getitems (cdr idx) (cdr tmp)))
        (list (nth (car idx) (car lst)))
    )
)

			

;; Two List Tile Dependency Example  -  Lee Mac
;; Requires ListTileDependency.lsp to be loaded.
;------------------------------------------------------START MAIN FUNCTION------------------------------------
(defun c:CBLL ( / *error* dch dcl des lst rtn)

    (defun *error* ( msg )
        (if (= 'file (type des))
            (close des)
        )
        (if (< 0 dch)
            (unload_dialog dch)
        )
        (if (and (= 'str (type dcl)) (findfile dcl))
            (vl-file-delete dcl)
        )
        (if (and msg (not (wcmatch (strcase msg t) "*break,*cancel*,*exit*")))
            (princ (strcat "\nError: " msg))
        )
        (princ)
    )

(setq lst
'(
	("300"	("500" 		("300x500_T21S_378W"  "300x500_T22_471W"))
			("600"		("300x600_T21S_453W"  "300x600_T22_565W"))
			("800"		("300x800_T21S_604W"  "300x800_T22_754W"    "300x800_T33_1067W"))
			("1000"		("300x1000_T22_945W"  "300x1000_T33_1334W"))
			("1200"		("300x1200_T22_1130W" "300x1200_T33_1601W"))
			("1300"		("300x1300_T22_1225W" "300x1300_T33_1734W"))
			("1400"		("300x1400_T22_1319W" "300x1400_T33_1868W"))
			("1600"		("300x1600_T22_1507W" "300x1600_T33_2134W"))
			("1800"		("300x1800_T22_1696W" "300x1800_T33_2401W"))
			("2000"		("300x2000_T22_1884W" "300x2000_T33_2668W"))
	)
	("400"	("400"		("400x400_T11_266W"))
			("500"		("400x500_T11_333W"   "400x500_T21S_477W"   "400x500_T22_601W"))
			("600"		("400x600_T11_400W"   "400x600_T21S_572W"   "400x600_T22_721W"   "400x600_T33_1020W"))
			("700"		("400x700_T11_466W"))
			("800"		("400x800_T11_533W"   "400x800_T21S_762W"   "400x800_T22_962W"   "400x800_T33_1360W"))
			("900"		("400x900_T11_599W"))
			("1000"		("400x1000_T11_667W"  "400x1000_T21S_953W"  "400x1000_T22_1202W" "400x1000_T33_1700W"))
			("1100"		("400x1100_T11_733W"))
			("1200"		("400x1200_T11_799W"  "400x1200_T21S_1144W" "400x1200_T22_1442W" "400x1200_T33_2040W"))
			("1300"		("400x1300_T11_866W"  "400x1300_T21S_1239W" "400x1300_T22_1563W" "400x1300_T33_2210W"))
			("1400"		("400x1400_T11_932W"  "400x1400_T21S_1334W" "400x1400_T22_1683W" "400x1400_T33_2380W"))
			("1600"		("400x1600_T11_1066W" "400x1600_T21S_1525W" "400x1600_T22_1923W" "400x1600_T33_2720W"))
			("1800"		("400x1800_T11_1199W" "400x1800_T21S_1715W" "400x1800_T22_2164W" "400x1800_T33_3060W"))
			("2000"		("400x2000_T11_1332W" "400x2000_T21S_1906W" "400x2000_T22_2404W" "400x2000_T33_3400W"))
	)		
	("500"	("400"		("500x400_T11_321W"   "500x400_T21S_456W"   "500x400_T22_580W"))
			("500"		("500x500_T11_401W"   "500x500_T21S_571W"   "500x500_T22_725W"   "500x500_T33_1024W"))
			("600"		("500x600_T11_481W"   "500x600_T21S_685W"   "500x600_T22_869W"   "500x600_T33_1229W"))
			("700"		("500x700_T11_561W"   "500x700_T21S_799W"   "500x700_T22_1014W"  "500x700_T33_1434W"))
			("800"		("500x800_T11_642W"   "500x800_T21S_913W"   "500x800_T22_1159W"  "500x800_T33_1638W"))
			("900"		("500x900_T11_722W"   "500x900_T21S_1027W"  "500x900_T22_1304W"  "500x900_T33_1843W"))
			("1000"		("500x1000_T11_802W"  "500x1000_T21S_1141W" "500x1000_T22_1449W" "500x1000_T33_2048W"))
			("1100"		("500x1100_T11_882W"  "500x1100_T21S_1255W" "500x1100_T22_1594W" "500x1100_T33_2253W"))
			("1200"		("500x1200_T11_962W"  "500x1200_T21S_1369W" "500x1200_T22_1739W" "500x1200_T33_2458W"))
			("1300"		("500x1300_T11_1043W" 						"500x1300_T22_1884W" "500x1300_T33_2662W"))
			("1400"		("500x1400_T11_1123W" "500x1400_T21S_1597W" "500x1400_T22_2029W" "500x1400_T33_2867W"))
			("1600"		("500x1600_T11_1283W" "500x1600_T21S_1826W" "500x1600_T22_2318W" "500x1600_T33_3277W"))
			("1800"		("500x1800_T11_1444W" "500x1800_T21S_2054W" "500x1800_T22_2608W" "500x1800_T33_3686W"))
			("2000"		("500x2000_T11_1604W" "500x2000_T21S_2282W" "500x2000_T22_2898W" "500x2000_T33_4096W"))
	)
	("600"	("400"		("600x400_T11_374W"   "600x400_T21S_529W"   "600x400_T22_673W"))
			("500"		("600x500_T11_467W"   "600x500_T21S_661W"   "600x500_T22_842W"   "600x500_T33_1190W"))
			("600"		("600x600_T11_560W"   "600x600_T21S_793W"   "600x600_T22_1010W"  "600x600_T33_1427W"))
			("700"		("600x700_T11_654W"   "600x700_T21S_925W"   "600x700_T22_1178W"  "600x700_T33_1665W"))
			("800"		("600x800_T11_747W"   "600x800_T21S_1058W"  "600x800_T22_1346W"  "600x800_T33_1903W"))
			("900"		("600x900_T11_841W"   "600x900_T21S_1190W"  "600x900_T22_1515W"  "600x900_T33_2141W"))
			("1000"		("600x1000_T11_934W"  "600x1000_T21S_1322W" "600x1000_T22_1683W" "600x1000_T33_2379W"))
			("1100"		("600x1100_T11_1027W" "600x1100_T21S_1454W" "600x1100_T22_1851W" "600x1100_T33_2617W"))
			("1200"		("600x1200_T11_1121W" "600x1200_T21S_1586W" "600x1200_T22_2020W" "600x1200_T33_2855W"))
			("1300"		("600x1300_T11_1214W" "600x1300_T21S_1719W" "600x1300_T22_2188W" "600x1300_T33_3093W"))
			("1400"		("600x1400_T11_1308W" "600x1400_T21S_1851W" "600x1400_T22_2356W" "600x1400_T33_3331W"))
			("1600"		("600x1600_T11_1494W" "600x1600_T21S_2115W" "600x1600_T22_2693W" "600x1600_T33_3806W"))
			("1800"		("600x1800_T11_1681W" "600x1800_T21S_2380W" "600x1800_T22_3029W" "600x1800_T33_4282W"))
			("2000"		("600x2000_T11_1868W" "600x2000_T21S_2644W" "600x2000_T22_3366W" "600x2000_T33_4758W"))
	)
	("700"	("400"		( "700x400_T21S_600W"   "700x400_T22_763W"))
			("500"		( "700x500_T21S_750W"   "700x500_T22_954W"   "700x500_T33_1348w"))
			("600"		( "700x600_T21S_899W"   "700x600_T22_1144W"  "700x600_T33_1618W"))
			("700"		( "700x700_T21S_1049W"  "700x700_T22_1335W"  "700x700_T33_1887W"))
			("800"		( "700x800_T21S_1199W"  "700x800_T22_1526W"  "700x800_T33_2157W"))
			("900"		( "700x900_T21S_1349W"  "700x900_T22_1716W"  "700x900_T33_2426W"))
			("1000"		( "700x1000_T21S_1499W" "700x1000_T22_1907W" "700x1000_T33_2696W"))
			("1100"		( "700x1100_T21S_1649W" "700x1100_T22_2098W"))
			("1200"		( "700x1200_T21S_1799W" "700x1200_T22_2288W"))
			("1300"		( "700x1300_T21S_1949W" "700x1300_T22_2479W" "700x1300_T33_3503W"))
			("1400"		( "700x1400_T21S_2099W" "700x1400_T22_2670W"))
			("1600"		( "700x1600_T21S_2398W" "700x1600_T22_3051W"))
	)
	("900"	("400"		("900x400_T11_525W"   "900x400_T21S_736W"   "900x400_T22_930W"))
			("500"		("900x500_T11_656W"   "900x500_T21S_921W"   "900x500_T22_1163W"  "900x500_T33_1649W"))
			("600"		("900x600_T11_787W"   "900x600_T21S_1105W"  "900x600_T22_1396W"  "900x600_T33_1978W"))
			("700"		("900x700_T11_918W"   "900x700_T21S_1289W"  "900x700_T22_1628W"  "900x700_T33_2308W"))
			("800"		("900x800_T11_1050W"  "900x800_T21S_1473W"  "900x800_T22_1861W"  "900x800_T33_2638W"))
			("900"		("900x900_T11_1181W"  "900x900_T21S_1657W"  "900x900_T22_2093W"  "900x900_T33_2967W"))
			("1000"		("900x1000_T11_1312W" "900x1000_T21S_1841W" "900x1000_T22_2326W" "900x1000_T33_3297W"))
			("1100"		("900x1100_T11_1443W" 						"900x1100_T22_2559W" "900x1100_T33_3627W"))
			("1200"		("900x1200_T11_1574W" "900x1200_T21S_2209W" "900x1200_T22_2791W" "900x1200_T33_3956W"))
			("1300"		("900x1300_T11_1706W" "900x1300_T21S_2393W" "900x1300_T22_3024W" "900x1300_T33_4286W"))
			("1400"		("900x1400_T11_1837W" "900x1400_T21S_2577W" "900x1400_T22_3256W" "900x1400_T33_4616W"))
			("1600"		("900x1600_T11_2099W" "900x1600_T21S_2946W" "900x1600_T22_3722W" "900x1600_T33_5275W"))
			("1800"		("900x1800_T11_2362W" "900x1800_T21S_3314W" "900x1800_T22_4187W" "900x1800_T33_5935W"))
			("2000"		("900x2000_T11_2624W" "900x2000_T21S_3682W" "900x2000_T22_4652W" "900x2000_T33_6594W"))
	)	
	)
)

(setq dcl (vl-filename-mktemp "tmp.dcl"))
(setq des (open dcl "w"))
(foreach str
'(
"lbx : list_box"
"{"
"    alignment = centered;"
"    fixed_width = true;"
"    fixed_height = true;"
"    width = 35;"
"    height = 15;"
"}"
"test : dialog"
"{"
"    label = \"Brugman Compact 4 Bibliotheek\";"
"    spacer;"
"    : row"
"    {"
"        : lbx { key = \"lb0\"; label = \"Hoogte\"; }"
"        : lbx { key = \"lb1\"; label = \"Breedte\"; }"
"        : lbx { key = \"lb2\"; label = \"Type\"; }"
"    }"
"    spacer;"
"    ok_cancel;"
"}"
 )
(write-line str des)
)

(not (setq des (close des)))
(< 0 (setq dch (load_dialog dcl)))
(new_dialog "test" dch)
(setq rtn '(0 0 0))
(LM:dcld:action '("lb0" "lb1" "lb2") 'lst 'rtn)
(if (= 1 (start_dialog))
	(progn
		(setq lb1list (LM:dcld:getitems rtn lst)
			  newname  (nth 2 lb1list)

			  old-lay (getvar "clayer")
			  LAY (if  (not (tblsearch "layer" "WB5611----_RADIATOR"))
			    (command "layer" "M" "WB5611----_RADIATOR" "C" "2" "" "L" "CONTINUOUS" "" "")
			    )
		)
		(setq dist (getreal "\nEnter length "))
		(setq pt (getpoint "\nPick point for new block "))
		(command "layer" "s" "WB5611----_RADIATOR" "" )	 
		(command "-bedit" "Radiator" "bsaveas" newname "No" "Bclose" "")
        (command "-insert" newname pt dist 100 0.0)
		(command "zoom" "E")
    )
)	

(princ)
)
(c:cbll)

 

Edited by BIGAL
  • Like 1
Posted
9 hours ago, BIGAL said:

Not sure but it seems to me at this point 

 

					(command "layer" "s" "WB5611----_RADIATOR" "" )	 
					(command "insert" "radiator" pt4 lengte 100 (/ (* ang 180.0) pi))

 

You could use Bedit calling radiator then do a Bsaveas with the new name, then insert the new block with correct scale based on length. This will also keep radiator for further use. Will have a play.

 

Try this.

;; DCL List-Tile Dependency  -  V1.1 (2019-04-27)  -  Lee Mac
;; Configures action_tile statements for the list of keys to enabled dependency between the DCL tiles.
;; key     - [lst] List of DCL tile keys in order of dependency
;; lst-sym - [sym] Quoted variable containing list data
;; rtn-sym - [sym] Quoted variable containing initial selection indexes
(defun LM:dcld:action ( key lst-sym rtn-sym )
    
    (defun LM:dcld:addlist ( key lst )
        (start_list key)
        (foreach itm lst (add_list itm))
        (end_list)
    )
    (defun LM:dcld:getlists ( idx lst )
        (if (cdr idx)
            (cons (mapcar 'car lst) (LM:dcld:getlists (cdr idx) (cdr (nth (car idx) lst))))
            lst
        )
    )
    (defun LM:substnth ( itm idx lst )
        (if lst
            (if (zerop idx)
                (cons itm (mapcar '(lambda ( x ) 0) (cdr lst)))
                (cons (car lst) (LM:substnth itm (1- idx) (cdr lst)))
            )
        )
    )
    (defun LM:dcld:actions ( key lst-sym rtn-sym lvl / fun )
        (setq fun
            (if (cdr key)
                (list 'lambda '( val lst )
                    (list 'setq rtn-sym (list 'LM:substnth '(atoi val) lvl rtn-sym))
                    (list 'LM:dcld:addlist (cadr key) (list 'nth (1+ lvl) (list 'LM:dcld:getlists rtn-sym 'lst)))
                    (list
                        (LM:dcld:actions (cdr key) lst-sym rtn-sym (1+ lvl))
                        (list 'set_tile (cadr key) "0") 'lst
                    )
                )
                (list 'lambda '( val lst )
                    (list 'setq rtn-sym (list 'LM:substnth '(atoi val) lvl rtn-sym))
                )
            )
        )
        (action_tile (car key) (vl-prin1-to-string (list fun '$value lst-sym)))
        fun
    )
    (mapcar 'LM:dcld:addlist key (LM:dcld:getlists (eval rtn-sym) (eval lst-sym)))
    (   (eval (LM:dcld:actions key lst-sym rtn-sym 0))
        (set_tile (car key) (itoa (car (eval rtn-sym))))
        (eval lst-sym)
    )
    (princ)
)

;; DCL List-Tile Dependency  -  Get Items  -  Lee Mac
;; Returns a list of the items selected from each dependent list tile.
;; idx - [lst] List of selection indexes
;; lst - [lst] List data

(defun LM:dcld:getitems ( idx lst / tmp )
    (if (cdr idx)
        (cons (car (setq tmp (nth (car idx) lst))) (LM:dcld:getitems (cdr idx) (cdr tmp)))
        (list (nth (car idx) (car lst)))
    )
)

			

;; Two List Tile Dependency Example  -  Lee Mac
;; Requires ListTileDependency.lsp to be loaded.
;------------------------------------------------------START MAIN FUNCTION------------------------------------
(defun c:CBLL ( / *error* dch dcl des lst rtn)

    (defun *error* ( msg )
        (if (= 'file (type des))
            (close des)
        )
        (if (< 0 dch)
            (unload_dialog dch)
        )
        (if (and (= 'str (type dcl)) (findfile dcl))
            (vl-file-delete dcl)
        )
        (if (and msg (not (wcmatch (strcase msg t) "*break,*cancel*,*exit*")))
            (princ (strcat "\nError: " msg))
        )
        (princ)
    )

(setq lst
'(
	("300"	("500" 		("300x500_T21S_378W"  "300x500_T22_471W"))
			("600"		("300x600_T21S_453W"  "300x600_T22_565W"))
			("800"		("300x800_T21S_604W"  "300x800_T22_754W"    "300x800_T33_1067W"))
			("1000"		("300x1000_T22_945W"  "300x1000_T33_1334W"))
			("1200"		("300x1200_T22_1130W" "300x1200_T33_1601W"))
			("1300"		("300x1300_T22_1225W" "300x1300_T33_1734W"))
			("1400"		("300x1400_T22_1319W" "300x1400_T33_1868W"))
			("1600"		("300x1600_T22_1507W" "300x1600_T33_2134W"))
			("1800"		("300x1800_T22_1696W" "300x1800_T33_2401W"))
			("2000"		("300x2000_T22_1884W" "300x2000_T33_2668W"))
	)
	("400"	("400"		("400x400_T11_266W"))
			("500"		("400x500_T11_333W"   "400x500_T21S_477W"   "400x500_T22_601W"))
			("600"		("400x600_T11_400W"   "400x600_T21S_572W"   "400x600_T22_721W"   "400x600_T33_1020W"))
			("700"		("400x700_T11_466W"))
			("800"		("400x800_T11_533W"   "400x800_T21S_762W"   "400x800_T22_962W"   "400x800_T33_1360W"))
			("900"		("400x900_T11_599W"))
			("1000"		("400x1000_T11_667W"  "400x1000_T21S_953W"  "400x1000_T22_1202W" "400x1000_T33_1700W"))
			("1100"		("400x1100_T11_733W"))
			("1200"		("400x1200_T11_799W"  "400x1200_T21S_1144W" "400x1200_T22_1442W" "400x1200_T33_2040W"))
			("1300"		("400x1300_T11_866W"  "400x1300_T21S_1239W" "400x1300_T22_1563W" "400x1300_T33_2210W"))
			("1400"		("400x1400_T11_932W"  "400x1400_T21S_1334W" "400x1400_T22_1683W" "400x1400_T33_2380W"))
			("1600"		("400x1600_T11_1066W" "400x1600_T21S_1525W" "400x1600_T22_1923W" "400x1600_T33_2720W"))
			("1800"		("400x1800_T11_1199W" "400x1800_T21S_1715W" "400x1800_T22_2164W" "400x1800_T33_3060W"))
			("2000"		("400x2000_T11_1332W" "400x2000_T21S_1906W" "400x2000_T22_2404W" "400x2000_T33_3400W"))
	)		
	("500"	("400"		("500x400_T11_321W"   "500x400_T21S_456W"   "500x400_T22_580W"))
			("500"		("500x500_T11_401W"   "500x500_T21S_571W"   "500x500_T22_725W"   "500x500_T33_1024W"))
			("600"		("500x600_T11_481W"   "500x600_T21S_685W"   "500x600_T22_869W"   "500x600_T33_1229W"))
			("700"		("500x700_T11_561W"   "500x700_T21S_799W"   "500x700_T22_1014W"  "500x700_T33_1434W"))
			("800"		("500x800_T11_642W"   "500x800_T21S_913W"   "500x800_T22_1159W"  "500x800_T33_1638W"))
			("900"		("500x900_T11_722W"   "500x900_T21S_1027W"  "500x900_T22_1304W"  "500x900_T33_1843W"))
			("1000"		("500x1000_T11_802W"  "500x1000_T21S_1141W" "500x1000_T22_1449W" "500x1000_T33_2048W"))
			("1100"		("500x1100_T11_882W"  "500x1100_T21S_1255W" "500x1100_T22_1594W" "500x1100_T33_2253W"))
			("1200"		("500x1200_T11_962W"  "500x1200_T21S_1369W" "500x1200_T22_1739W" "500x1200_T33_2458W"))
			("1300"		("500x1300_T11_1043W" 						"500x1300_T22_1884W" "500x1300_T33_2662W"))
			("1400"		("500x1400_T11_1123W" "500x1400_T21S_1597W" "500x1400_T22_2029W" "500x1400_T33_2867W"))
			("1600"		("500x1600_T11_1283W" "500x1600_T21S_1826W" "500x1600_T22_2318W" "500x1600_T33_3277W"))
			("1800"		("500x1800_T11_1444W" "500x1800_T21S_2054W" "500x1800_T22_2608W" "500x1800_T33_3686W"))
			("2000"		("500x2000_T11_1604W" "500x2000_T21S_2282W" "500x2000_T22_2898W" "500x2000_T33_4096W"))
	)
	("600"	("400"		("600x400_T11_374W"   "600x400_T21S_529W"   "600x400_T22_673W"))
			("500"		("600x500_T11_467W"   "600x500_T21S_661W"   "600x500_T22_842W"   "600x500_T33_1190W"))
			("600"		("600x600_T11_560W"   "600x600_T21S_793W"   "600x600_T22_1010W"  "600x600_T33_1427W"))
			("700"		("600x700_T11_654W"   "600x700_T21S_925W"   "600x700_T22_1178W"  "600x700_T33_1665W"))
			("800"		("600x800_T11_747W"   "600x800_T21S_1058W"  "600x800_T22_1346W"  "600x800_T33_1903W"))
			("900"		("600x900_T11_841W"   "600x900_T21S_1190W"  "600x900_T22_1515W"  "600x900_T33_2141W"))
			("1000"		("600x1000_T11_934W"  "600x1000_T21S_1322W" "600x1000_T22_1683W" "600x1000_T33_2379W"))
			("1100"		("600x1100_T11_1027W" "600x1100_T21S_1454W" "600x1100_T22_1851W" "600x1100_T33_2617W"))
			("1200"		("600x1200_T11_1121W" "600x1200_T21S_1586W" "600x1200_T22_2020W" "600x1200_T33_2855W"))
			("1300"		("600x1300_T11_1214W" "600x1300_T21S_1719W" "600x1300_T22_2188W" "600x1300_T33_3093W"))
			("1400"		("600x1400_T11_1308W" "600x1400_T21S_1851W" "600x1400_T22_2356W" "600x1400_T33_3331W"))
			("1600"		("600x1600_T11_1494W" "600x1600_T21S_2115W" "600x1600_T22_2693W" "600x1600_T33_3806W"))
			("1800"		("600x1800_T11_1681W" "600x1800_T21S_2380W" "600x1800_T22_3029W" "600x1800_T33_4282W"))
			("2000"		("600x2000_T11_1868W" "600x2000_T21S_2644W" "600x2000_T22_3366W" "600x2000_T33_4758W"))
	)
	("700"	("400"		( "700x400_T21S_600W"   "700x400_T22_763W"))
			("500"		( "700x500_T21S_750W"   "700x500_T22_954W"   "700x500_T33_1348w"))
			("600"		( "700x600_T21S_899W"   "700x600_T22_1144W"  "700x600_T33_1618W"))
			("700"		( "700x700_T21S_1049W"  "700x700_T22_1335W"  "700x700_T33_1887W"))
			("800"		( "700x800_T21S_1199W"  "700x800_T22_1526W"  "700x800_T33_2157W"))
			("900"		( "700x900_T21S_1349W"  "700x900_T22_1716W"  "700x900_T33_2426W"))
			("1000"		( "700x1000_T21S_1499W" "700x1000_T22_1907W" "700x1000_T33_2696W"))
			("1100"		( "700x1100_T21S_1649W" "700x1100_T22_2098W"))
			("1200"		( "700x1200_T21S_1799W" "700x1200_T22_2288W"))
			("1300"		( "700x1300_T21S_1949W" "700x1300_T22_2479W" "700x1300_T33_3503W"))
			("1400"		( "700x1400_T21S_2099W" "700x1400_T22_2670W"))
			("1600"		( "700x1600_T21S_2398W" "700x1600_T22_3051W"))
	)
	("900"	("400"		("900x400_T11_525W"   "900x400_T21S_736W"   "900x400_T22_930W"))
			("500"		("900x500_T11_656W"   "900x500_T21S_921W"   "900x500_T22_1163W"  "900x500_T33_1649W"))
			("600"		("900x600_T11_787W"   "900x600_T21S_1105W"  "900x600_T22_1396W"  "900x600_T33_1978W"))
			("700"		("900x700_T11_918W"   "900x700_T21S_1289W"  "900x700_T22_1628W"  "900x700_T33_2308W"))
			("800"		("900x800_T11_1050W"  "900x800_T21S_1473W"  "900x800_T22_1861W"  "900x800_T33_2638W"))
			("900"		("900x900_T11_1181W"  "900x900_T21S_1657W"  "900x900_T22_2093W"  "900x900_T33_2967W"))
			("1000"		("900x1000_T11_1312W" "900x1000_T21S_1841W" "900x1000_T22_2326W" "900x1000_T33_3297W"))
			("1100"		("900x1100_T11_1443W" 						"900x1100_T22_2559W" "900x1100_T33_3627W"))
			("1200"		("900x1200_T11_1574W" "900x1200_T21S_2209W" "900x1200_T22_2791W" "900x1200_T33_3956W"))
			("1300"		("900x1300_T11_1706W" "900x1300_T21S_2393W" "900x1300_T22_3024W" "900x1300_T33_4286W"))
			("1400"		("900x1400_T11_1837W" "900x1400_T21S_2577W" "900x1400_T22_3256W" "900x1400_T33_4616W"))
			("1600"		("900x1600_T11_2099W" "900x1600_T21S_2946W" "900x1600_T22_3722W" "900x1600_T33_5275W"))
			("1800"		("900x1800_T11_2362W" "900x1800_T21S_3314W" "900x1800_T22_4187W" "900x1800_T33_5935W"))
			("2000"		("900x2000_T11_2624W" "900x2000_T21S_3682W" "900x2000_T22_4652W" "900x2000_T33_6594W"))
	)	
	)
)

(setq dcl (vl-filename-mktemp "tmp.dcl"))
(setq des (open dcl "w"))
(foreach str
'(
"lbx : list_box"
"{"
"    alignment = centered;"
"    fixed_width = true;"
"    fixed_height = true;"
"    width = 35;"
"    height = 15;"
"}"
"test : dialog"
"{"
"    label = \"Brugman Compact 4 Bibliotheek\";"
"    spacer;"
"    : row"
"    {"
"        : lbx { key = \"lb0\"; label = \"Hoogte\"; }"
"        : lbx { key = \"lb1\"; label = \"Breedte\"; }"
"        : lbx { key = \"lb2\"; label = \"Type\"; }"
"    }"
"    spacer;"
"    ok_cancel;"
"}"
 )
(write-line str des)
)

(not (setq des (close des)))
(< 0 (setq dch (load_dialog dcl)))
(new_dialog "test" dch)
(setq rtn '(0 0 0))
(LM:dcld:action '("lb0" "lb1" "lb2") 'lst 'rtn)
(if (= 1 (start_dialog))
	(progn
		(setq lb1list (LM:dcld:getitems rtn lst)
			  newname  (nth 2 lb1list)

			  old-lay (getvar "clayer")
			  LAY (if  (not (tblsearch "layer" "WB5611----_RADIATOR"))
			    (command "layer" "M" "WB5611----_RADIATOR" "C" "2" "" "L" "CONTINUOUS" "" "")
			    )
		)
		(setq dist (getreal "\nEnter length "))
		(setq pt (getpoint "\nPick point for new block "))
		(command "layer" "s" "WB5611----_RADIATOR" "" )	 
		(command "-bedit" "Radiator" "bsaveas" newname "No" "Bclose" "")
        (command "-insert" newname pt dist 100 0.0)
		(command "zoom" "E")
    )
)	

(princ)
)
(c:cbll)

 

Hi BIGAL, thanks for your work and time. I have a problem in AutoCAD with this. (command "-bedit" "Radiator" "bsaveas" newname "No" "Bclose" "")

I made some changes: I do not use Getreal because LB1 has the lenght of the radiator. LB2 has the name for the block. Then AutoCAD has a problem wiht NO. So i put it out. Then AutoCAD has a problem with CBIL command. So there is an enter to mutch. Then I removed the enter after Bclose and the function is ok. Only not if a name already at the drawing is called. The name already exists and the blockeditor comes on. I enclosed my new version of CBIL. 

CBiL.lsp

Posted
3 hours ago, patjeacad said:

Hi BIGAL, thanks for your work and time. I have a problem in AutoCAD with this. (command "-bedit" "Radiator" "bsaveas" newname "No" "Bclose" "")

I made some changes: I do not use Getreal because LB1 has the lenght of the radiator. LB2 has the name for the block. Then AutoCAD has a problem wiht NO. So i put it out. Then AutoCAD has a problem with CBIL command. So there is an enter to mutch. Then I removed the enter after Bclose and the function is ok. Only not if a name already at the drawing is called. The name already exists and the blockeditor comes on. I enclosed my new version of CBIL. 

CBiL.lsp 10.65 kB · 0 downloads

I'm learning  the limits of rename block and bedit. I have to work with attributes than i can use the same name for blocks at the same drawing.

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...