Room Size Autolisp (Plz Chk)
Dear All,Plz Chk the My 2nd program room size (working on mm drg only)
(written start @ sep09 finished in jan10 because im poor in written autolisp & english)
Request
add function pick point
Problem in lisp not working in feet & mt. drg
(program written help me aarya & aastha)
Thanks
rm1.LSP Hi,
Please put your code in
tags: ;----program concept by sachin, written by Aarya & Aastha --------------;(defun c:Rm1 (/ roomname roomsz) (defun roomname ()(textpage)(princ "\nROOMNAME OPTIONS: ")(princ "\n\t Living Kitchen Bed Toilet ") (princ "\n\t Office SHop STore STUdy")(princ "\n\t Dining Puja BAth W.c. = WC")(princ "\n\t LIft = LT LObby S.toi.Living/dining = LD ")(princ "\n\nPress any key to return to your drawing ")(grread)(princ "\r ")(graphscr)) ;End of roomname(defun roomsz (/ p1 p2 p3 p4 x x1 y y1 tx h ht1 rm op pl pm tm ft rsz pll) (if (null txlay) (progn (setq txlay "tx") (setq txlayer (tblsearch "layer" txlay)) (if (null txlayer) (progn (setq txlay (getstring "\nLayer name for TEXT : ")) (setq txclr (getstring (strcat "\nColor for " txlay " layer: "))) (command "layer" "m" txlay "c" txclr "" "") ) (prompt "\nTEXT ON TX LAYER") ) )) (setvar "osmode" 32)(menucmd "p0=filters") (menucmd "p0=*") (if (null ht) (setq ht "250"))(setq p1 (getpoint "\nPick room corner: ") p2 (getcorner p1 "\nPick Diagonally opposite corner: ") p3 (list (car p2)(cadr p1)) p4 (list (car p1)(cadr p2)) a(distance p1 p3) b (distance p1 p4) x(* 0.001 a) y (* 0.001 b) x1 (rtos x 2 2) y1 (rtos y 2 2) mt (strcat x1 "x" y1))(setq ix (cvunit x "meter" "inch") iy (cvunit y "meter" "inch") xf (rtos ix 4 0) yf (rtos iy 4 0) ft (strcat xf "x" yf))(PROMPT "\nENTER FOLLOWING KEYWORD OR TY FOR TYPE") (setq cnt T)(while cnt (initget 1 (strcat "Living Kitchen Bed Toilet " "Office SHop STore STUdy " "Dining Puja BAth WC TY ? " "LT LObby S.toi. LD "))(setq rm (getkword "\nROOM NAME = Liv/Bed/Kit/Toi/Off/Din/SHop/BAth/WC/STore/STUdy/S./LT/LD/LO/TYpe/?:"))(if (/= (type rm) 'LIST) (if (= rm "?") (progn (roomname) (setq cnt T) ) (progn (setq cnt nil) (if (= rm "LT") (setq rm "LIFT")) (if (= rm "LD") (setq rm "living/dining")) (if (= rm "WC")(setq rm "W.C.")) (IF (= rm "TY") (setq rsz (strcase (getstring t"\nTYPE ROOM NAME: "))) (setq rsz (strcase rm)) ) ) ) (setq cnt nil) ))(setq tm (strcase (getstring (strcat "\nENTER TEXT HEIGHT :")) t))(if (/= tm "")(setq ht tm))(setq h (atof ht) ht1 (* h 0.88888) dt (* h 1.7))(setvar "osmode" 0) (setvar "orthomode" 1) (setq ht1 (fix ht1))(setq pc (polar p1 (angle p1 p2) (/ (distance p1 p2) 2)) pm (polar pc (* pi 1.5) (/ h 3.55)) pt (polar pc (/ pi 2) dt) pf (polar pc (* pi 1.5) dt))(command "layer" "t" txlay "on" txlay "s" txlay "" "text" "s" "rD" "m" pt h "0" rsz)(setq pm2 (getpoint pm "\nENDPOINT OF TEXT: ") PM1 (polar pm pi (distance pm pm2)) pf1 (polar pf pi (distance pm pm2)) pf2 (polar pf 0(distance pm pm2))) (command "text" "s" "rs" "f" pm1 pm2 ht1 mt "text" "f" pf1 pf2 ht1 ft ) ) (roomsz))
1. I cannot figure out what your problem is, the lisp does not seem to be working but if we do not know what the program should do...
2. You have used a local variable "roomsz" as a function -> that won't work for shure
3. I get a "right click pop up" with osnap points, is that meant to be.
Please describe your problem.
This is fine, you can declare a function as local, I do this quite often. Huh? I thought that this wouldn't work, also the VLIDE editor showed me the "bug". Hmm... Perhaps the code isn't right - but certainly the act of localising functions is correct.
页:
[1]