Tabel.releveu.lsp

10

Click here to load reader

description

Realizeaza tabelul ce contine numarul camerei, denumirea camerei si suprafata automat, prin selectarea poliliniilor camerelor respective.

Transcript of Tabel.releveu.lsp

Page 1: Tabel.releveu.lsp

releveu.lsp;;;;;;;;;;;;Catalin Vintila;;;;;;;;;;;;;;;;;;;;;;;;;;Octombrie 2011;;;;;;;;;;;;;;;;;;;;;;;;;;;Tabel Releveu;;;;;;;;;;;;;;;;

(defun c:releveu() (setvar "cmdecho" 0) (setvar "dimzin" 0) (command "undo" "m") (command "ucs" "w") (command "osnap" "none") (command "units" "2" "3" "3" "4" "0" "N") (command "-layer" "thaw" "Tabel releveu" "") (command "-layer" "thaw" "Dimensiuni" "") (command "-layer" "thaw" "Numerotare" "") (command "-layer" "thaw" "Suprafete utile" "") (command "-layer" "M" "Suprafete utile" "C" "90" "" "") (command "-layer" "M" "Dimensiuni" "C" "170" "" "") (command "-layer" "M" "Tabel releveu" "C" "white" "" "") (command "-layer" "M" "Numerotare" "C" "210" "" "")

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Scara de reprezentare

(setq scale (getreal "\nSCARA DE REPREZENTARE <100> 1: ")) (if (eq scale nil) (and (setq sc 0.05) (setq scale 100)) (setq sc (/ scale 2000.0)) );if (setq sc_block (* 2 sc))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Pct de inserare tabel

(setq pct_ins (getpoint "\nSELECTEAZA PUNCT INSERARE TABEL! ")) (WHILE (eq pct_ins nil) (setq pct_ins (getpoint "\nSELECTEAZA PUNCT INSERARE TABEL! ")) );WHILE (command "layer" "s" "tabel releveu" "") (command "insert" "C:\\CATALIN\\LSP\\RELEVEU\\cap_rel" pct_ins sc_block sc_block "0") (command "layer" "s" "0" "")

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Selectarea poliliniei (setq k 0) (setq nr 1);nr de camera (setq q 0)

(command "convertpoly" "l" "all" "") (setq ent (car (entsel "\nSELECTEAZA POLILINIA CAMEREI! "))) (while (= ent nil) (setq ent (car (entsel "\nSELECTEAZA POLILINIA CAMEREI! "))) );WHILE (setq entl (entget ent)) (setq ct 0)

Page 1

Page 2: Tabel.releveu.lsp

releveu.lsp (repeat (length entl)

(setq coord (nth ct entl)) (if (eq (car coord) 10) (progn (setq punct (list (cadr coord) (caddr coord)))

(setq x (car punct)) (setq y (cadr punct)) (if (<= k 15) (progn (setq xg x) (setq yg y) (setq xs x) (setq ys y) );progn );if (if (> k 15) (progn (if (<= xg x) (setq xg x) );if

(if (<= yg y) (setq yg y) );if

(if (>= xs x) (setq xs x) );if

(if (>= ys y) (setq ys y) );if

);progn )if mai mic, mai mare );progn );if (setq ct (1+ ct)) (setq k (+ k 1));;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;muta polilinia pe layerul suprafete utile

(if (eq (car coord) 8) (progn (setq lay (cdr coord)) );progn );if

);repeat

(command "area" "o" ent) (setq suprafata (getvar "area")) (command "copy" ent "" "0,0" "0,0" "chprop" "l" "" "lay" "suprafete utile" "") (setq xc (/ (+ xs xg) 2)) (setq yc (/ (+ ys yg) 2)) (setq centru (list xc yc)) (command "layer" "s" "numerotare" "") (command "insert" "C:\\CATALIN\\LSP\\RELEVEU\\nr_rel" centru sc_block sc_block "0" nr)

Page 2

Page 3: Tabel.releveu.lsp

releveu.lsp (command "layer" "s" "0" "") (command "erase" ent "");;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Folosinta camerei

(initget 1 "1 2 3 4 5 6 7 8 9 10 11 12") (setq cam (getkword "\nSELECTEAZA NR. CORESPUNZATOR: 1-Camera; 2-Bucatarie; 3-Baie; 4-Hol; 5-Vestibul; 6-Debara; 7-Camara; 8-Grup sanitar; 9-Balcon; 10-Logie; 11-Casa scarii; 12-Altceva:")) (if (= cam "1") (setq cam "Camera")) (if (= cam "2") (setq cam "Bucatarie")) (if (= cam "3") (setq cam "Baie")) (if (= cam "4") (setq cam "Hol")) (if (= cam "5") (setq cam "Vestibul")) (if (= cam "6") (setq cam "Debara")) (if (= cam "7") (setq cam "Camara")) (if (= cam "8") (setq cam "Grup sanitar")) (if (= cam "9") (setq cam "Balcon")) (if (= cam "10") (setq cam "Logie")) (if (= cam "11") (setq cam "Casa scarii")) (if (= cam "12") (setq cam (getstring T "\nDENUMIREA CAMEREI :")))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;eliminare suprafata (setq eliminare 0) (while (eq eliminare 0) (progn (initget 0 "Da Nu") (setq elim (getkword "\nELIMINI DIN SUPRAFATA CAMEREI Da/Nu? <Nu>:")) (if (eq elim nil) (setq elim "Nu"))

(if (eq elim "Da") (progn (setq ent (car (entsel "\nSELECTEAZA POLILINIA DE ELIMINAT! "))) (while (= ent nil) (setq ent (car (entsel "\nSELECTEAZA POLILINIA DE ELIMINAT! "))) );WHILE

(setq entl (entget ent)) (setq ct 0)

(repeat (length entl)

(setq coord (nth ct entl)) (if (eq (car coord) 8) (progn (setq lay (cdr coord))

);progn );if );repeat (command "copy" ent "" "0,0" "0,0" "chprop" "l" "" "lay" "suprafete utile" "")

(command "area" "o" ent) (setq sup_elim (getvar "area")) (command "erase" ent "") (setq suprafata (- suprafata sup_elim)) );progn (setq eliminare 1) );if );progn while

Page 3

Page 4: Tabel.releveu.lsp

releveu.lsp );while (setq sup (rtos suprafata 2 2))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;insereaza linie

(command "layer" "s" "tabel releveu" "") (command "insert" "C:\\CATALIN\\LSP\\RELEVEU\\lin_rel" (list (car pct_ins) (- (cadr pct_ins) (* 8 q sc))) sc_block sc_block "0" nr cam sup) (command "layer" "s" "suprafete utile" "") (setq sup_afis (strcat "S="sup"mp")) (command "text" "s" "style3" "j" "bc" centru (* 5 sc) "" cam) (command "text" "s" "style3" "j" "tc" centru (* 4 sc) "" sup_afis) (command "layer" "s" "0" "");;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;insereaza restul camerelor la suprafa utila (setq nr (+ nr 1)) (setq q (+ q 1)) (setq k 0) (setq repet 0) (setq sup_util (atof sup))

(while (eq repet 0) (progn (initget 0 "Da Nu") (setq intrebare1 (getkword "\nADAUGI CAMERA LA SUPRAFATA UTILA Da/Nu? <Da>:")) (if (eq intrebare1 nil) (setq intrebare1 "Da"))

(if (eq intrebare1 "Da") (progn (setq ent (car (entsel "\nSELECTEAZA POLILINIA CAMEREI! "))) (while (= ent nil) (setq ent (car (entsel "\nSELECTEAZA POLILINIA CAMEREI! "))) );WHILE (setq repet 0) (setq entl (entget ent)) (setq ct 0) (repeat (length entl)

(setq coord (nth ct entl)) (if (eq (car coord) 10) (progn (setq punct (list (cadr coord) (caddr coord)))

(setq x (car punct)) (setq y (cadr punct)) (if (<= k 15) (progn (setq xg x) (setq yg y) (setq xs x) (setq ys y) );progn );if (if (> k 15) (progn (if (<= xg x) (setq xg x) );if

(if (<= yg y) (setq yg y) );if

Page 4

Page 5: Tabel.releveu.lsp

releveu.lsp

(if (>= xs x) (setq xs x) );if

(if (>= ys y) (setq ys y) );if

);progn )if mai mic, mai mare );progn );if (setq ct (1+ ct)) (setq k (+ k 1))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;muta polilinia pe layerul suprafete utile (if (eq (car coord) 8) (progn (setq lay (cdr coord)) );progn );if );repeat

(command "copy" ent "" "0,0" "0,0" "chprop" "l" "" "lay" "suprafete utile" "") (command "area" "o" ent) (setq suprafata (getvar "area")) (command "erase" ent "") (setq xc (/ (+ xs xg) 2)) (setq yc (/ (+ ys yg) 2)) (setq centru (list xc yc)) (command "layer" "s" "numerotare" "") (command "insert" "C:\\CATALIN\\LSP\\RELEVEU\\nr_rel" centru sc_block sc_block "0" nr)(command "layer" "s" "0" "")

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Folosinta camerei

(initget 1 "1 2 3 4 5 6 7 8 9 10 11 12") (setq cam (getkword "\nSELECTEAZA NR. CORESPUNZATOR: 1-Camera; 2-Bucatarie; 3-Baie; 4-Hol; 5-Vestibul; 6-Debara; 7-Camara; 8-Grup sanitar; 9-Balcon; 10-Logie; 11-Casa scarii; 12-Altceva:")) (if (= cam "1") (setq cam "Camera")) (if (= cam "2") (setq cam "Bucatarie")) (if (= cam "3") (setq cam "Baie")) (if (= cam "4") (setq cam "Hol")) (if (= cam "5") (setq cam "Vestibul")) (if (= cam "6") (setq cam "Debara")) (if (= cam "7") (setq cam "Camara")) (if (= cam "8") (setq cam "Grup sanitar")) (if (= cam "9") (setq cam "Balcon")) (if (= cam "10") (setq cam "Logie")) (if (= cam "11") (setq cam "Casa scarii")) (if (= cam "12") (setq cam (getstring T "\nDENUMIREA CAMEREI :")))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;eliminare suprafata

(setq eliminare 0) (while (eq eliminare 0) (progn (initget 0 "Da Nu") (setq elim (getkword "\nELIMINI DIN SUPRAFATA CAMEREI Da/Nu? <Nu>:"))

Page 5

Page 6: Tabel.releveu.lsp

releveu.lsp (if (eq elim nil) (setq elim "Nu"))

(if (eq elim "Da") (progn (setq ent (car (entsel "\nSELECTEAZA POLILINIA DE ELIMINAT! "))) (while (= ent nil) (setq ent (car (entsel "\nSELECTEAZA POLILINIA DE ELIMINAT! "))) );WHILE (setq entl (entget ent)) (setq ct 0)

(repeat (length entl)

(setq coord (nth ct entl)) (if (eq (car coord) 8) (progn (setq lay (cdr coord))

);progn );if );repeat (command "copy" ent "" "0,0" "0,0" "chprop" "l" "" "lay" "suprafete utile" "") (command "area" "o" ent) (setq sup_elim (getvar "area")) (command "erase" ent "") (setq suprafata (- suprafata sup_elim)) );progn (setq eliminare 1) );if );progn while );while (setq sup (rtos suprafata 2 2))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;insereaza linie (command "layer" "s" "tabel releveu" "") (command "insert" "C:\\CATALIN\\LSP\\RELEVEU\\lin_rel" (list (car pct_ins) (- (cadr pct_ins) (* 8 q sc))) sc_block sc_block "0" nr cam sup)

(command "layer" "s" "suprafete utile" "") (setq sup_afis (strcat "S="sup"mp")) (command "text" "s" "style3" "j" "bc" centru (* 5 sc) "" cam) (command "text" "s" "style3" "j" "tc" centru (* 4 sc) "" sup_afis) (command "layer" "s" "0" "") (setq k 0) (setq q (+ 1 q)) (setq nr (+ 1 nr)) (setq sup_util (+ (atof sup) sup_util)) );progn then (setq repet 1);else );if );progn while intrebare1);while suprafata utila

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;INSEREAZA SUPRAFATA UTILA (setq sup_util (rtos sup_util 2 2)) (setq sup_utila (strcat "Suprafata utila = " sup_util "mp")) (command "insert" "C:\\CATALIN\\LSP\\RELEVEU\\sup_rel" (list (car pct_ins) (- (cadr pct_ins) (* 8 q sc))) sc_block sc_block "0" sup_utila) (setq q (+ 1 q));;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;insereaza restul camerelor la suprafata totala (setq sup_t 0)

Page 6

Page 7: Tabel.releveu.lsp

releveu.lsp (while (eq repet 1) (progn (initget 0 "Da Nu") (setq intrebare1 (getkword "\nADAUGI CAMERA LA SUPRAFATA TOTALA Da/Nu? <Da>:")) (if (eq intrebare1 nil) (setq intrebare1 "Da"))

(if (eq intrebare1 "Da") (progn (setq ent (car (entsel "\nSELECTEAZA POLILINIA CAMEREI! "))) (while (= ent nil) (setq ent (car (entsel "\nSELECTEAZA POLILINIA CAMEREI! "))) );WHILE (setq repet 1) (setq entl (entget ent)) (setq ct 0) (repeat (length entl)

(setq coord (nth ct entl)) (if (eq (car coord) 10) (progn (setq punct (list (cadr coord) (caddr coord)))

(setq x (car punct)) (setq y (cadr punct)) (if (<= k 15) (progn (setq xg x) (setq yg y) (setq xs x) (setq ys y) );progn );if (if (> k 15) (progn (if (<= xg x) (setq xg x) );if

(if (<= yg y) (setq yg y) );if

(if (>= xs x) (setq xs x) );if

(if (>= ys y) (setq ys y) );if

);progn )if mai mic, mai mare );progn );if (setq ct (1+ ct)) (setq k (+ k 1)) (if (eq (car coord) 8) (progn (setq lay (cdr coord)) );progn );if

);repeat

Page 7

Page 8: Tabel.releveu.lsp

releveu.lsp (command "copy" ent "" "0,0" "0,0" "chprop" "l" "" "lay" "suprafete utile" "") (command "area" "o" ent) (setq suprafata (getvar "area")) (command "erase" ent "") (setq xc (/ (+ xs xg) 2)) (setq yc (/ (+ ys yg) 2)) (setq centru (list xc yc)) (command "layer" "s" "numerotare" "") (command "insert" "C:\\CATALIN\\LSP\\RELEVEU\\nr_rel" centru sc_block sc_block "0" nr)(command "layer" "s" "0" "")

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Folosinta camerei

(initget 1 "1 2 3 4 5 6") (setq cam (getkword "\nSELECTEAZA NR. CORESPUNZATOR: 1-Scara; 2-Casa scarii; 3-Balcon; 4-Logie; 5-Terasa; 6-Altceva:")) (if (= cam "1") (setq cam "Scara")) (if (= cam "2") (setq cam "Casa scarii")) (if (= cam "3") (setq cam "Balcon")) (if (= cam "4") (setq cam "Logie")) (if (= cam "5") (setq cam "Terasa")) (if (= cam "6") (setq cam (getstring T "\nDENUMIREA CAMEREI :")))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;eliminare suprafata

(setq eliminare 0) (while (eq eliminare 0) (progn (initget 0 "Da Nu") (setq elim (getkword "\nELIMINI DIN SUPRAFATA CAMEREI Da/Nu? <Nu>:")) (if (eq elim nil) (setq elim "Nu"))

(if (eq elim "Da") (progn (setq ent (car (entsel "\nSELECTEAZA POLILINIA DE ELIMINAT! "))) (while (= ent nil) (setq ent (car (entsel "\nSELECTEAZA POLILINIA DE ELIMINAT! "))) );WHILE (setq entl (entget ent)) (setq ct 0)

(repeat (length entl)

(setq coord (nth ct entl)) (if (eq (car coord) 8) (progn (setq lay (cdr coord))

);progn );if );repeat (command "copy" ent "" "0,0" "0,0" "chprop" "l" "" "lay" "suprafete utile" "") (command "area" "o" ent) (setq sup_elim (getvar "area")) (command "erase" ent "") (setq suprafata (- suprafata sup_elim)) );progn (setq eliminare 1) );if );progn while );while

Page 8

Page 9: Tabel.releveu.lsp

releveu.lsp (setq sup_a (rtos suprafata 2 2)) (setq sup_t (+ (atof sup_a) sup_t))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;insereaza linie (command "layer" "s" "tabel releveu" "") (command "insert" "C:\\CATALIN\\LSP\\RELEVEU\\lin_rel" (list (car pct_ins) (- (cadr pct_ins) (* 8 q sc))) sc_block sc_block "0" nr cam sup_a) (command "layer" "s" "suprafete utile" "") (setq sup_afis (strcat "S="sup_a"mp")) (command "text" "s" "style3" "j" "bc" centru (* 5 sc) "" cam) (command "text" "s" "style3" "j" "tc" centru (* 4 sc) "" sup_afis) (command "layer" "s" "0" "") (setq k 0) (setq q (+ 1 q)) (setq nr (+ 1 nr)) );progn then (setq repet 2);else );if );progn while intrebare1);while suprafata totala

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;INSEREAZA SUPRAFATA TOTALA (setq sup_total (+ sup_t (atof sup_util))) (setq sup_total (rtos sup_total 2 2)) (setq sup_totala (strcat "Suprafata totala = " sup_total "mp")) (command "insert" "C:\\CATALIN\\LSP\\RELEVEU\\sup_rel" (list (car pct_ins) (- (cadr pct_ins) (* 8 q sc))) sc_block sc_block "0" sup_totala) (setq q (+ 1 q))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;INSEREAZA EXECUTANT

(setq EXECUT (getstring T "\nEXECUTANTUL LUCRARII? <Ing. Catalin VINTILA> :")) (if (eq execut nil) (setq execut "Ing. Catalin VINTILA"))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AFISARE DATA AUTOMAT;)

(setq DD (rtos (getvar "CDATE") 2 6) AN (substr DD 3 2) LUNA (substr DD 5 2) ZI (substr DD 7 2) ORA (substr DD 10 2) MINUTE (substr DD 12 2) );CDATE

(IF (EQ LUNA "01") (SETQ L "Ianuarie")) (IF (EQ LUNA "02") (SETQ L "Februarie")) (IF (EQ LUNA "03") (SETQ L "Martie")) (IF (EQ LUNA "04") (SETQ L "Aprilie")) (IF (EQ LUNA "05") (SETQ L "Mai")) (IF (EQ LUNA "06") (SETQ L "Iunie")) (IF (EQ LUNA "07") (SETQ L "Iulie")) (IF (EQ LUNA "08") (SETQ L "August")) (IF (EQ LUNA "09") (SETQ L "Septembrie")) (IF (EQ LUNA "10") (SETQ L "Octombrie")) (IF (EQ LUNA "11") (SETQ L "Noiembrie")) (IF (EQ LUNA "12") (SETQ L "Decembrie")) (setq data (strcat l", 20"an))

(if (or (eq l nil) (eq an nil))

Page 9

Page 10: Tabel.releveu.lsp

releveu.lsp (progn (setq DATA (getstring T "\nDATA REALIZARII? <Septembrie, 2011> :")) (if (eq data nil) (setq data "Septembrie, 2011")) );progn );if (command "insert" "C:\\CATALIN\\LSP\\RELEVEU\\sf_rel" (list (car pct_ins) (- (cadr pct_ins) (* 8 q sc))) sc_block sc_block "0" execut data)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SET DIMENSION STYLE

(command "_.-insert" "C:\\CATALIN\\LSP\\RELEVEU\\dim_rel" ^C)(if (eq scale 50) (command "dimstyle" "r" "R50"));if(if (eq scale 100) (command "dimstyle" "r" "R100"));if(if (eq scale 200) (command "dimstyle" "r" "R200"));if(if (eq scale 500) (command "dimstyle" "r" "R500"));if

(command "osnap" "End") (command "-layer" "freeze" "suprafete utile" "") (command "layer" "s" "0" "") (command "zoom") (command "extents") (command "regen") (PROMPT " ") (PRINT ) (PROMPT "*****************") (PRINT ) (PROMPT " ") (PRINT ) (prompt "**TABEL RELEVEU**")(PRINT ) (PROMPT "*****************") (PRINT ) (PROMPT " ") (PRINT )

);defun

Page 10