johnshar123xx 发表于 2022-7-6 09:35:37

需要线型和/或LISP

需要线型和/或LISP
 
 
AutoCAD 2007
我有很多棘手的问题/要求,我目前正在寻找一些LISP来解决它们。我一直在网上搜索我需要的lisps,虽然我已经找到了一些东西,但我仍然有一些东西,我似乎无法找到确切的我要找的东西。我想借此机会提前感谢每一位对我的问题有意见的人,感谢他们给予我的任何帮助。
 
 
 
我不确定这是否需要创建lisp或线型,但我正在寻找两种特定的线型。
 
第一个是我用来绘制雨水管道的线型。它由三条线组成,目前我必须将这三条线作为单独的部分绘制。基本上,它是一条中心多段线,设置为hidden2线型,全局宽度设置为,其他两条线是多段线两侧的连续线。例如,如果我要绘制直径为1’in的雨水管道,则多段线全局宽度设置为1.00,两条连续线之间的距离为1.00。因此,我希望能够创建一个线型/lisp,该线型/lisp将询问多段线的全局宽度(管径),然后允许我将管道(由三条线组成)绘制为一条线。此外,由于场地图形可能使用不同的比例(例如1“=40”),并且线型为hidden2线型,因此也可以在lisp中设置线型比例
 
 
第二种是一种与上述线型完全相同的线型,但中心多段线是连续的,而不是隐藏的。我使用此线型在场地平面上创建建筑轮廓。连续全局宽度多段线两侧的两条连续线使捕捉到建筑线的最外侧边缘变得更容易。
 
我知道这样的事情是存在的,因为我和一些人一起工作,他们使用了像这样的线型,这是他们过去工作过的公司,但我一直找不到他们。我已经包括了一个dwg文件,显示了所需的两种线型,以防我没有足够准确地描述它们。
 
有人准备挑战吗?
线型。图纸

ReMark 发表于 2022-7-6 09:39:21

你有2008,所以你必须有Express Tools。使用“生成线型”例程。

Lee Mac 发表于 2022-7-6 09:42:16

 
下面是一系列可以学习LISP的网站:
 
启动LISP:
 
http://www.cadtutor.net/forum/showthread.php?t=38760
 
http://www.cadtutor.net/forum/showthread.php?t=38734
 
http://www.afralisp.net/
 
http://www.jefferypsanders.com/autolisptut.html
 
http://ronleigh.info/autolisp/index.htm
 
 
更高级的LISP教程:
 
http://mitpress.mit.edu/sicp/full-text/book/book-Z-H-4.html
 
http://www.cs.cmu.edu/afs/cs.cmu.edu/project/ai-repository/ai/html/cltl/clm/node1.html
 
你准备好接受挑战了吗?

BIGAL 发表于 2022-7-6 09:45:25

虽然我有你想要的,但更高级的,我不能提供它,因为版权。但我可以告诉你怎么做。
 
在lisp中(不是实际代码,而是过程)
 
更改为管道连接层
获取点1
获取点2
getreal管道宽度/2.0
角度1 pt1-pt2
角度2 pt2-pt1
线路pt1 pt2
计算pt3和pt4 pt5 pt6使用(极角1+90角2-90等)pt1和pt2的90度
将图层更改为外线图层
线路pt3 pt4
线路pt5 pt6
 
嘿,都做完了

johnshar123xx 发表于 2022-7-6 09:50:44

谢谢大家的回复。
 
我尝试使用线型创建快速工具创建我要找的线型,但不幸的是,我没有成功。我完成了这些步骤,在它要求选择对象的起点和终点之后,当我选择组成线型的三条线时,程序返回一条类似“这是一个连续线型”的消息,不再让我继续。
 
谢谢你们所有的学习如何lisp链接,我同意,我想学习,我会看看他们。问题是我正在寻找的Lisp程序,我意识到这相当复杂,我可能无法很快学会如何创建它们。
 
感谢您提供了创建我正在寻找的线型的步骤,但不幸的是,我没有在lisp中执行这些步骤并应用它们的经验。

alanjt 发表于 2022-7-6 09:53:47

对于你想要的数量,你真的需要自己学习。

johnshar123xx 发表于 2022-7-6 09:57:15

再次感谢所有观看并回复的人。
只是想知道是否有其他人已经写了这个lisp或在网站上看到了它。我知道它是以lisp的形式存在的,与我共事过的许多人都使用过它。似乎找不到这个。

CarlB 发表于 2022-7-6 09:59:24

一些线程对此进行了讨论。显然,可以为此创建一条“多线”。
 
http://www.cadtutor.net/forum/showthread.php?t=17659
http://discussion.autodesk.com/forums/thread.jspa?threadID=629788&tstart=6360

gilsoto13 发表于 2022-7-6 10:03:17

 
 
我对lisp了解不多。。。演示如下。。。我快速接近。。。有一次我做了一个lisp,用极坐标点快速修剪交点。。。
 
所以我想我今天也可以做类似的事情。。但我确实需要阅读更多关于它的内容。。。无论如何这是其他人完成它的开始。。。
 
键入storm1并选择2个点。。。它现在不能完全工作。。但肯定会有人修复它。
 

;will draw a single line composed of three lines, width is equal to 1
;base=1"
;it may contain extra code for any pipe size
(defun C:storm1 ()
(setq om (getvar "osmode"))
(setq or (getvar "orthomode"))
(setvar "cmdecho" 0)
(setq p1 (getpoint "\nPick first point.. "))
(setq p2 (getpoint "\nPick second point.. "))
(setvar "osmode" 0)
(setvar "orthomode" 0)
(command "ucs" pt1 pt2 "")
(setq p3 (polar p1 90 0.5))
(setq p5 (polar p1 270 0.5))
(setq p4 (polar p2 90 0.5))
(setq p6 (polar p2 270 0.5))
(command "line" p3 p4 "")
(command "line" p5 p6 "")
(command "_.-linetype" "load" "hidden2" (strcat "C:/archivos de programa/AutoCAD 2009/UserDataCache/Support/acad.lin") "" "")
(command "_.-linetype" "set" "hidden2" "")
(command "pline" p1 "W" "1" "1" p2 "")
(command "_.-linetype" "set" "bylayer" "")
(command "ucs" "w")
(setvar "osmode" om)
(setvar "orthomode" or)
(setvar "cmdecho" 1)
(princ)
)

https://www.cadtutor.net/forum/uploads/monthly_2009_12/storm1.jpg.640fe169fbc56d10fde8af3709e5a3d0.jpg

alanjt 发表于 2022-7-6 10:06:07

第二个代码PSD应该给你想要的。
 
;original coding taken from Pipe.lsp, created by Tim Wilson (9.11.95, revised 6.22.97)
;modified by alan thompson (11.18.08) for use at Capital Engineering and Surveying, Inc.
;    1. created 2 routines (SSD & PSD)
;      a. SSD will create an existing (Survey) storm pipe on the "V-STRM-PIPE" layer with a hidden2 linetype.
;         (if layer and/or linetype do not exist, they are created/loaded)
;      b. PSD will create a proposed (Engineering) storm pipe on the "C-STRM-PIPE" layer with a continuous linetype.
;         (if layer and/or linetype do not exist, they are created/loaded)
;    2. added error handler
;    3. removed unnecessary code, formatted and cleaned up code
;    4. localized subroutines
;thank you Tim Wilson for the borrowed coding.

;;Survey STORM
(defun C:SSD (/ *error* DTR PNT1 PNT2 D D2 A ET HD L1 L2 L3 L4 OTM c_layer my_linfile my_layer my_color my_ltype )
(vl-load-com)
;;;;;SUB ROUTINES;;;;;
(defun *error* (msg)
msg
(setvar "clayer" c_layer)
(setvar "orthomode" OTM)
);defun

(defun DTR (a)
(* PI (/ A 180.0))
)
;;;;;MAIN ROUTINE;;;;;

(setq my_linfile "CES.lin")    ;linetype file to reference (if using default acad.lin, set as: nil)
(setq my_layer "V-STRM-PIPE")    ;layer to use
(setq my_color 172)      ;color to use
(setq my_ltype "hidden2")    ;linetype to use

(setq c_layer (getvar "clayer"))
(setq OTM (getvar "orthomode"))
(setvar "cmdecho" 0)
(setvar "orthomode" 0)
(if (and
      (not (= my_linfile nil))
      (findfile my_linfile)
      (not (tblsearch "ltype" my_ltype))
    );and
   (vl-cmdf "_.linetype" "_l" my_ltype my_linfile "")
);if
(if (and
      (setq PNT1 (getpoint "\nPick Start of Pipe: "))
      (setq PNT2 (getpoint pnt1 "\nPick End of Pipe: "))
      (setq D (getdist "\nEnter Pipe Width: ")) ;In INCHES IE 24", 30", 42" SO ON
    );and
      (progn
      (if (tblsearch "layer" my_layer)
          (vl-cmdf "_.layer" "_t" my_layer "_m" my_layer "_c" my_color my_layer "_lt" my_ltype my_layer "")
          (vl-cmdf "_.layer" "_m" my_layer "_c" my_color my_layer "_lt" my_ltype my_layer "")
      );if
      (setq D2 (/ D 12))
      (SETQ D D2)
      (while Pnt2
          (setq HD (/ D 2))
          (setq A (angle PNT1 PNT2))
          (setq ET (entlast))
          (setq L1 (polar pnt1 (- a (dtr 90)) HD))
          (setq L2 (polar pnt2 (- a (dtr 90)) HD))
          (setq L3 (polar pnt1 (+ a (dtr 90)) HD))
          (setq L4 (polar pnt2 (+ a (dtr 90)) HD))
          (vl-cmdf "_.line" "_non" L1 "_non" L2 "" "_.line" "_non" L3 "_non" L4 "")
          (setq PNT1 PNT2)
          (setq PNT2 (getpoint PNT1 "\nNext Point: <Return or Enter to Quit> "))
      );while
      (setvar "clayer" c_layer)
      (setvar "orthomode" OTM)
      );progn
);if
(princ)
);defun



;;Proposed STORM
(defun C:PSD (/ *error DTR PNT1 PNT2 D D2 A ET HD L1 L2 L3 L4 OTM c_layer my_linfile my_layer my_color my_ltype my_ltype_mid )
(vl-load-com)
;;;;;SUB ROUTINES;;;;;
(defun *error* (msg)
msg
(setvar "clayer" c_layer)
(setvar "orthomode" OTM)
);defun

(defun DTR (a)
(* PI (/ A 180.0))
)
;;;;;MAIN ROUTINE;;;;;

(setq my_linfile nil)      ;linetype file to reference (if using default acad.lin, set as: nil)
(setq my_layer "C-STRM-PIPE")    ;layer to use
(setq my_color 2)      ;color to use
(setq my_ltype "continuous")    ;linetype to use for exterior lines
(setq my_ltype_mid "hidden")    ;linetype to use for interior line (pline with width of pipe)

(setq c_layer (getvar "clayer"))
(setq OTM (getvar "orthomode"))
(setvar "cmdecho" 0)
(setvar "orthomode" 0)

;load my_ltype
(if (and
      (not (= my_linfile nil))
      (findfile my_linfile)
      (not (tblsearch "ltype" my_ltype))
    );and
   (vl-cmdf "_.linetype" "_l" my_ltype my_linfile "")
);if

;load my_ltype_mid
(if (and
      (not (= my_linfile nil))
      (findfile my_linfile)
      (not (tblsearch "ltype" my_ltype_mid))
    );and
   (vl-cmdf "_.linetype" "_l" my_ltype_mid my_linfile "")
);if
(if (and
      (setq PNT1 (getpoint "\nPick Start of Pipe: "))
      (setq PNT2 (getpoint PNT1 "\nPick End of Pipe: "))
      (setq D (getdist "\nEnter Pipe Width: ")) ;In INCHES IE 24", 30", 42" SO ON
    );and
      (progn
      (if (tblsearch "layer" my_layer)
          (vl-cmdf "_.layer" "_t" my_layer "_m" my_layer "_c" my_color my_layer "_lt" my_ltype my_layer "")
          (vl-cmdf "_.layer" "_m" my_layer "_c" my_color my_layer "_lt" my_ltype my_layer "")
      );if
      (setq D2 (/ D 12))
      (setq D D2)
      (while Pnt2
         (setq HD (/ D 2))
         (setq A (angle PNT1 PNT2))
         (vl-cmdf "_.pline" "non" PNT1 "non" PNT2 "")
         (setq ET (entlast))
         (setq L1 (polar pnt1 (- a (dtr 90)) HD))
         (setq L2 (polar pnt2 (- a (dtr 90)) HD))
         (setq L3 (polar pnt1 (+ a (dtr 90)) HD))
         (setq L4 (polar pnt2 (+ a (dtr 90)) HD))
         (vl-cmdf "_.line" "non" L1 "non" L2 "" "line" "non" L3 "non" L4 "")
         (vl-cmdf "_.change" ET "" "_p" "_lt" my_ltype_mid "") ;change linetype to suit
         (vl-cmdf "_.pedit" ET "_w" D "")
         (setq PNT1 PNT2)
         (setq PNT2 (getpoint PNT1 "\nNext Point: <Return or Enter to Quit>: "))
      );while
      );progn
);if
(setvar "orthomode" OTM)
(setvar "clayer" c_layer)
(princ)
);defun
页: [1] 2
查看完整版本: 需要线型和/或LISP