明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 3597|回复: 3

[LISP]直接填充自定X,Y尺寸的LSP!(画天花特方便)

[复制链接]
发表于 2004-10-2 21:58:00 | 显示全部楼层 |阅读模式
我这有一个能修改原有HATCH文件(grid.pat),而直接填充自定X,Y尺寸(但是好象只能输入300,600,900,1200的建筑基数)的LSP,可以作为参考,加以完善命令! 希望有人能改改,使之修改HATCH的比例或间距的命令改为能单独修改HATCH的X,Y轴的比例或间距!

;[XG.LSP]BY jeep 08Jan04
;TO DRAW CEILING GRID
(defun c:xg (/ a -a b c)
(getnewline)
(setvar "cmdecho" 0)
(setq snap (getvar "osmode"))
(setq OLDERR *ERROR*
*ERROR* MYERROR
pt1 (getpoint "\nSetting up point:")
distY (getstring "\nLength of grid :")
distX (getstring "\nHeight of grid :")
pt2 (getpoint pt1 "\nAngle of grid :")
)
(setq angleX (angle pt1 pt2))
(setq angleY (+ angleX (/ 3.14159265358979323846264338327950288419716939937510 2)))

(setq angleX (* angleX 57.2957795130823208767981548141326))
(setq angleY (* angleY 57.2957795130823208767981548141326))

(setq Line1 (strcat (rtos angleX 2 5) ",0,0,0," distX))
(setq Line2 (strcat (rtos angleY 2 5) ",0,0,0," distY))

(setq FILENAME "GRID.PAT")
(setq OPENFILE (open FILENAME "w"))
(write-line "*GRID, XGrid" OPENFILE)

(write-line Line1 OPENFILE)
(write-line Line2 OPENFILE)

(write-line "" OPENFILE)
(close OPENFILE)

(princ "\nSelect Polyline to fill:")
(setq select (ssget))

(command "snapbase" pt1)
(command "-bhatch" "P" "GRID" "" "" "S" select "" "")
(command "snapbase" 0,0)
(setq *ERROR* OLDERR)

(princ)
);END OF XG.LSP

发表于 2004-10-4 01:05:00 | 显示全部楼层
哇~~~这个程序为什么要把 pi 值用"3.14159265358979323846264338327950288419716939937510"表示???
 楼主| 发表于 2004-10-4 09:46:00 | 显示全部楼层
这是那个填充文件GRID.PAT *GRID, XGrid
90, 0,0, 0,1000
90, 100,0, 0,1000
0, 0,0, 0,450, -100,900
 楼主| 发表于 2004-11-5 11:06:00 | 显示全部楼层
版主帮忙改改!
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-11-25 07:44 , Processed in 0.160722 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表