乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
查看: 38|回复: 4

[编程交流] Room Size Autolisp (Plz Chk)

[复制链接]

54

主题

208

帖子

46

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
386
发表于 2022-7-6 11:55:33 | 显示全部楼层 |阅读模式
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
回复

使用道具 举报

59

主题

327

帖子

268

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
295
发表于 2022-7-6 12:25:17 | 显示全部楼层
Hi,
 
Please put your code in
  1. tags:[code] ;----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 )         ) ([color=red]roomsz[/color]))
 
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.
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 12:39:02 | 显示全部楼层
 
This is fine, you can declare a function as local, I do this quite often.
回复

使用道具 举报

59

主题

327

帖子

268

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
295
发表于 2022-7-6 12:47:30 | 显示全部楼层
Huh? I thought that this wouldn't work, also the VLIDE editor showed me the "bug". Hmm...
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 13:03:56 | 显示全部楼层
Perhaps the code isn't right - but certainly the act of localising functions is correct.
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-3-5 10:35 , Processed in 0.406891 second(s), 62 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表