Autolisp生成孔
大家好,I 2D结构钢详图。
我正在寻找一个lisp,将创建孔与偏置规线孔直径孔数等选项。
有什么东西在外面或附近吗?
账单 这是一个快速程序。几年前,当我详细介绍结构钢时,我有一个更好的方法。没有错误捕获,可以改进。它应该可以帮助你开始。
布瑞恩
(defun c:holes ( / rows cols rowd rowv rowh hole )
(setq rows (getint "\nEnter the number of rows (---) <1>: ")
cols (getint "\nEnter the number of columns (|||) <1>: ")
rowd (getdist (strcat "\nBeam guage <" (itoa 3) ">: "))
rowv (getdist (strcat "\nVertical center / center <" (itoa 3) ">: "))
rowh (getdist (strcat "\nHorizontal center / center <" (itoa 4) ">: "))
hole (getdist (strcat "\nHole diameter " (rtos 0.8125) ">: "))
)
(if (= rows nil)(setq rows 1))
(if (= cols nil)(setq cols 1))
(if (= rowd nil)(setq rowd 3))
(if (= rowh nil)(setq rowh 4))
(if (= rowv nil)(setq rowv 3))
(if (= hole nil)(setq hole 0.8125))
(setq ins (getpoint "\nSelect insertion point: "))
(repeat cols
(setq lstpnt (polar ins (* pi 1.5) rowd))
(entmake (list (cons 0 "circle")(cons 10 lstpnt)(cons 40 (/ hole 2.0))))
(repeat (1- rows)
(setq lstpnt (polar lstpnt (* pi 1.5) rowv))
(entmake (list (cons 0 "circle")(cons 10 lstpnt)(cons 40 (/ hole 2.0))))
)
(setq ins (polar ins 0 rowh))
)
(princ)
) 谢谢brian。。。。希望你不介意我拿一份。。
美好的易于理解的常规 谢谢你的代码。
它工作得很好。
现在,如何添加钢边缘到第一列/行孔中心的偏移?
账单
(defun c:holes ( / rows cols rowd rowv rowh hole )
(setq rows (getint "\nEnter the number of rows (---) <1>: ")
cols (getint "\nEnter the number of columns (|||) <1>: ")
rowd (getdist (strcat "\nBeam guage <" (itoa 3) ">: "))
rowv (getdist (strcat "\nVertical center / center <" (itoa 3) ">: "))
rowh (getdist (strcat "\nHorizontal center / center <" (itoa 4) ">: "))
hole (getdist (strcat "\nHole diameter " (rtos 0.8125) ">: "))
)
(if (= rows nil)(setq rows 1))
(if (= cols nil)(setq cols 1))
(if (= rowd nil)(setq rowd 3))
(if (= rowh nil)(setq rowh 4))
(if (= rowv nil)(setq rowv 3))
(if (= hole nil)(setq hole 0.8125))
(setq ins (getpoint "\nSelect insertion point: "))
' Add this
(if (> cols 1)(setq ins (polar ins pi (/ (* (1- cols) rowh) 2.0))))
(repeat cols
(setq lstpnt (polar ins (* pi 1.5) rowd))
(entmake (list (cons 0 "circle")(cons 10 lstpnt)(cons 40 (/ hole 2.0))))
(repeat (1- rows)
(setq lstpnt (polar lstpnt (* pi 1.5) rowv))
(entmake (list (cons 0 "circle")(cons 10 lstpnt)(cons 40 (/ hole 2.0))))
)
(setq ins (polar ins 0 rowh))
)
(princ)
)
我认为这可能管用。如果不是你想要的,给我一个你想要的cad文件,我会看看我能做什么。
布瑞恩 谢谢Brian,
我发现它还不起作用。
我想做的是,一旦所有的输入都完成了,我需要的最后一件事是输入从插入点的偏移距离。
比尔·斯凯尔特马 没问题。我希望这有帮助。
这是绘制端点连接的修改版本。我有一个更完整的详细计划,但我通常收费。(对不起!)
布瑞恩
(defun c:holes_center ( / rows cols rowd rowv rowh hole )
(setq rows (getint "\nEnter the number of rows (---) <1>: ")
cols (getint "\nEnter the number of columns (|||) <1>: ")
rowd (getdist (strcat "\nBeam guage <" (rtos 3) ">: "))
rowv (getdist (strcat "\nVertical center / center <" (rtos 3) ">: "))
rowh (getdist (strcat "\nHorizontal center / center <" (rtos 4) ">: "))
hole (getdist (strcat "\nHole diameter " (rtos 0.8125) ">: "))
)
(if (= rows nil)(setq rows 1))
(if (= cols nil)(setq cols 1))
(if (= rowd nil)(setq rowd 3))
(if (= rowh nil)(setq rowh 4))
(if (= rowv nil)(setq rowv 3))
(if (= hole nil)(setq hole 0.8125))
(setq ins (getpoint "\nSelect insertion point: "))
(if (> cols 1)(setq ins (polar ins pi (/ (* (1- cols) rowh) 2.0))))
(repeat cols
(setq lstpnt (polar ins (* pi 1.5) rowd))
(entmake (list (cons 0 "circle")(cons 10 lstpnt)(cons 40 (/ hole 2.0))))
(repeat (1- rows)
(setq lstpnt (polar lstpnt (* pi 1.5) rowv))
(entmake (list (cons 0 "circle")(cons 10 lstpnt)(cons 40 (/ hole 2.0))))
)
(setq ins (polar ins 0 rowh))
)
(princ)
)
(defun c:holes_end ( / dir rows rowd rowh rowv rowo hole )
(initget 0 "Left Right")
(setq dir(getkword "\nEnd of beam (Left/Right) <L>: ")
rows (getint "\nEnter the number of rows (---) <1>: ")
rowd (getdist (strcat "\nBeam guage <" (rtos 3) ">: "))
rowv (getdist (strcat "\nVertical center / center <" (rtos 3) ">: "))
rowo (getdist (strcat "\nEndge offset <" (rtos 1.5) ">: "))
hole (getdist (strcat "\nHole diameter " (rtos 0.8125) ">: "))
)
(if (= dirnil)(setq dir "Left"))
(if (= rows nil)(setq rows 1))
(if (= rowd nil)(setq rowd 3))
(if (= rowh nil)(setq rowh 4))
(if (= rowv nil)(setq rowv 3))
(if (= rowo nil)(setq rowo 1.5))
(if (= hole nil)(setq hole 0.8125))
(setq ins (getpoint "\nSelect insertion point: "))
(if (= dir "Left")
(progn
(setq ins (polar ins 0 rowo)
lstpnt (polar ins (* pi 1.5) rowd)
)
(entmake (list (cons 0 "circle")(cons 10 lstpnt)(cons 40 (/ hole 2.0))))
(repeat (1- rows)
(setq lstpnt (polar lstpnt (* pi 1.5) rowv))
(entmake (list (cons 0 "circle")(cons 10 lstpnt)(cons 40 (/ hole 2.0))))
)
)
(progn
(setq ins (polar ins pi rowo)
lstpnt (polar ins (* pi 1.5) rowd)
)
(entmake (list (cons 0 "circle")(cons 10 lstpnt)(cons 40 (/ hole 2.0))))
(repeat (1- rows)
(setq lstpnt (polar lstpnt (* pi 1.5) rowv))
(entmake (list (cons 0 "circle")(cons 10 lstpnt)(cons 40 (/ hole 2.0))))
)
)
)
(princ)
)
谢谢你的密码,
我试图将列函数也添加到holes\u end,但我知道我遗漏了一些东西。加粗的蓝色是我添加的代码。
我接近了吗?
(defun c:holes_center ( / rows cols rowd rowv rowh hole )
(setq rows (getint "\nEnter the number of rows (---) <1>: ")
cols (getint "\nEnter the number of columns (|||) <1>: ")
rowd (getdist (strcat "\nBeam guage <" (rtos 30) ">: "))
rowv (getdist (strcat "\nVertical center / center <" (rtos 30) ">: "))
rowh (getdist (strcat "\nHorizontal center / center <" (rtos 4) ">: "))
hole (getdist (strcat "\nHole diameter " (rtos 17.5) ">: "))
)
(if (= rows nil)(setq rows 1))
(if (= cols nil)(setq cols 1))
(if (= rowd nil)(setq rowd 30))
(if (= rowh nil)(setq rowh 4))
(if (= rowv nil)(setq rowv 30))
(if (= hole nil)(setq hole 17.5))
(setq ins (getpoint "\nSelect insertion point: "))
(if (> cols 1)(setq ins (polar ins pi (/ (* (1- cols) rowh) 2.0))))
(repeat cols
(setq lstpnt (polar ins (* pi 1.5) rowd))
(entmake (list (cons 0 "circle")(cons 10 lstpnt)(cons 40 (/ hole 2.0))))
(repeat (1- rows)
(setq lstpnt (polar lstpnt (* pi 1.5) rowv))
(entmake (list (cons 0 "circle")(cons 10 lstpnt)(cons 40 (/ hole 2.0))))
)
(setq ins (polar ins 0 rowh))
)
(princ)
)
(defun c:holes_end ( / dir rows cols rowd rowh rowv rowo hole )
(initget 0 "Left Right")
(setq dir(getkword "\nEnd of beam (Left/Right) <L>: ")
rows (getint "\nEnter the number of rows (---) <1>: ")
cols (getint "\nEnter the number of columns (|||) <1>: ")
rowd (getdist (strcat "\nBeam guage <" (rtos 30) ">: "))
rowv (getdist (strcat "\nVertical center / center <" (rtos 30) ">: "))
rowo (getdist (strcat "\nEndge offset <" (rtos 30) ">: "))
hole (getdist (strcat "\nHole diameter " (rtos 17.5) ">: "))
)
(if (= dirnil)(setq dir "Left"))
(if (= rows nil)(setq rows 1))
(if (= cols nil)(setq cols 1))
(if (= rowd nil)(setq rowd 30))
(if (= rowh nil)(setq rowh 4))
(if (= rowv nil)(setq rowv 30))
(if (= rowo nil)(setq rowo 30))
(if (= hole nil)(setq hole 17.5))
(setq ins (getpoint "\nSelect insertion point: "))
(if (> cols 1)(setq ins (polar ins pi (/ (* (1- cols) rowh) 2.0))))
(repeat cols
(setq lstpnt (polar ins (* pi 1.5) rowd))
(entmake (list (cons 0 "circle")(cons 10 lstpnt)(cons 40 (/ hole 2.0))))
(if (= dir "Left")
(progn
(setq ins (polar ins 0 rowo)
lstpnt (polar ins (* pi 1.5) rowd)
)
(entmake (list (cons 0 "circle")(cons 10 lstpnt)(cons 40 (/ hole 2.0))))
(repeat (1- rows)
(setq lstpnt (polar lstpnt (* pi 1.5) rowv))
(entmake (list (cons 0 "circle")(cons 10 lstpnt)(cons 40 (/ hole 2.0))))
)
)
(progn
(setq ins (polar ins pi rowo)
lstpnt (polar ins (* pi 1.5) rowd)
)
(entmake (list (cons 0 "circle")(cons 10 lstpnt)(cons 40 (/ hole 2.0))))
(repeat (1- rows)
(setq lstpnt (polar lstpnt (* pi 1.5) rowv))
(entmake (list (cons 0 "circle")(cons 10 lstpnt)(cons 40 (/ hole 2.0))))
)
)
)
(princ)
)
试试这个。
布瑞恩
(defun c:holes_end ( / cols dir rows rowd rowh rowv rowo hole )
(initget 0 "Left Right")
(setq dir(getkword "\nEnd of beam (Left/Right) <L>: ")
rows (getint "\nEnter the number of rows (---) <1>: ")
cols (getint "\nEnter the number of columns (|||) <1>: ")
rowd (getdist (strcat "\nBeam guage <" (rtos 3) ">: "))
rowv (getdist (strcat "\nVertical center / center <" (rtos 3) ">: "))
rowh (getdist (strcat "\nHorizontal center / center <" (rtos 3) ">: "))
rowo (getdist (strcat "\nEndge offset <" (rtos 1.5) ">: "))
hole (getdist (strcat "\nHole diameter " (rtos 0.8125) ">: "))
)
(if (= dirnil)(setq dir "Left"))
(if (= rows nil)(setq rows 1))
(if (= cols nil)(setq cols 1))
(if (= rowd nil)(setq rowd 3))
(if (= rowh nil)(setq rowh 3))
(if (= rowv nil)(setq rowv 3))
(if (= rowo nil)(setq rowo 1.5))
(if (= hole nil)(setq hole 0.8125))
(setq ins (getpoint "\nSelect insertion point: "))
(if (= dir "Left")
(progn
(setq ins (polar ins 0 rowo))
(repeat cols
(setq lstpnt (polar ins (* pi 1.5) rowd))
(entmake (list (cons 0 "circle")(cons 10 lstpnt)(cons 40 (/ hole 2.0))))
(repeat (1- rows)
(setq lstpnt (polar lstpnt (* pi 1.5) rowv))
(entmake (list (cons 0 "circle")(cons 10 lstpnt)(cons 40 (/ hole 2.0))))
)
(setq ins (polar ins 0 rowh))
)
)
(progn
(setq ins (polar ins pi rowo))
(repeat cols
(setq lstpnt (polar ins (* pi 1.5) rowd))
(entmake (list (cons 0 "circle")(cons 10 lstpnt)(cons 40 (/ hole 2.0))))
(repeat (1- rows)
(setq lstpnt (polar lstpnt (* pi 1.5) rowv))
(entmake (list (cons 0 "circle")(cons 10 lstpnt)(cons 40 (/ hole 2.0))))
)
(setq ins (polar ins pi rowh))
)
)
)
(princ)
)
谢谢Brian,
它工作得很好。
最后一个请求。我理解如果你说不,你在这里帮了很多忙。
如果我想让用户输入列,他们可以选择设置一系列列,该怎么办。
我经常使用角钢,并且在长度方向上有很多孔。
因此,用户可以选择1或2行、波束规、孔径。,但被触发以请求第一偏移、第二偏移、第三偏移
再次感谢。
账单
页:
[1]
2