andy_lee 发表于 2022-7-5 23:09:37

圆圈标记?帮助

你好
 
如何使用lisp快速圈标记?这样地:
有12种模式选择。
圆圈图纸

ReMark 发表于 2022-7-5 23:13:00

你有一个自定义的lisp例程,但你不知道如何使用它?

Tharwat 发表于 2022-7-5 23:18:37

欢迎来到CADTutor。
 
你能解释一下你想要什么吗?

andy_lee 发表于 2022-7-5 23:19:26

 
不,不是风俗,这是我画的一幅画。

andy_lee 发表于 2022-7-5 23:22:41

 
首先,对不起我的英语。
例如,当我在对话框中选择此模式时

 
接下来,选择绘图中的其他圆。圆圈将填充此图案。

Bhull1985 发表于 2022-7-5 23:28:08

这是一个孵化器还是不同的区块?
因此,听起来您需要一个带有lisp的DCL,该DCL将根据他们在DCL中选择的平铺时间来填充或插入块

Bhull1985 发表于 2022-7-5 23:29:33

这里有一个将根据DCL插入不同的块,好像您需要(如果是不同的块)

(defun c:PIPsmallvalves ( / name a1 a2 a3 insertpt1 Dcl_Id% Folder$ Slides@ Slide1$ Slide2$ Slide3$ Slide4$ Slide5$ Slide6$ Slide7$ Slide8$ Slide9$ Slide10$ Slide11$ Slide12$ Slide13$ Slide14$ Slide15$ Slide16$ Return$ X# Y# ss p2 p3 osm *error* oldlay)
   
(setq oldlay (getvar "clayer"))
   (setq oldecho (getvar "cmdecho"))
   (setvar "cmdecho" 0)
   (command "_.undo" "_begin")

   (defun *error* ( msg )
   (if osm (setvar 'OSMODE osm))
   (if snpm (setvar 'SNAPMODE snpm))
   (if snp (command "snap" snp))
   (if echo (setvar 'CMDECHO echo))
   (if oldlay (setvar "clayer" oldlay))
   (if (not (member msg '("Function cancelled" "quit / exit abort")))
       (princ (strcat "\nError: " msg))
   )
   (princ)
   (command "_.undo" "_end")
   )

(princ "\n")
   ; Set Default Variables
(setq Slides@ (list nil "PVS001" "PVS002" "PVS003" "PVS004" "PVS005" "PVS006" "PVS007" "PVS008" "PVS009" "PVS010" "PVS011" "PVS012" "PVS013" "PVS014" "PVS015" "PVS016")
      Slide1$ (nth 1 Slides@)
       Slide2$ (nth 2 Slides@)
      Slide3$ (nth 3 Slides@)
      Slide4$ (nth 4 Slides@)
      Slide5$ (nth 5 Slides@)
      Slide6$ (nth 6 Slides@)
      Slide7$ (nth 7 Slides@)
      Slide8$ (nth 8 Slides@)
      Slide9$ (nth 9 Slides@)
      Slide10$ (nth 10 Slides@)
      Slide11$ (nth 11 Slides@)
      Slide12$ (nth 12 Slides@)
      Slide13$ (nth 13 Slides@)
      Slide14$ (nth 14 Slides@)
      Slide15$ (nth 15 Slides@)
      Slide16$ (nth 16 Slides@)
      Folder$ ""
      Return$ ""
);setq
   ; Load Dialog
(setq Dcl_Id% (load_dialog "PIPsmallvalves.dcl"))
(new_dialog "PIPsmallvalves" Dcl_Id%)
   ; Set Dialog Initial Settings
(set_tile "Title" "SMALL VALVES")
(set_tile "PVS001" Slide1$)
(set_tile "PVS002" Slide2$)
(set_tile "PVS003" Slide3$)
(set_tile "PVS004" Slide4$)
(set_tile "PVS005" Slide5$)
(set_tile "PVS006" Slide6$)
(set_tile "PVS007" Slide7$)
(set_tile "PVS008" Slide8$)
(set_tile "PVS009" Slide9$)
(set_tile "PVS010" Slide10$)
(set_tile "PVS011" Slide11$)
(set_tile "PVS012" Slide12$)
(set_tile "PVS013" Slide13$)
(set_tile "PVS014" Slide14$)
(set_tile "PVS015" Slide15$)
(set_tile "PVS016" Slide16$)
   ; Adjust X# and Y# per image_buttom outline to fit slide_image
(start_image "Slide1")
(setq X# (- (dimx_tile "Slide1") 2))
(setq Y# (- (dimy_tile "Slide1") 2))
(end_image)
(start_image "Slide1")(slide_image 1 1 X# Y# (strcat Folder$ Slide1$))(end_image)
(start_image "Slide2")(slide_image 1 1 X# Y# (strcat Folder$ Slide2$))(end_image)
(start_image "Slide3")(slide_image 1 1 X# Y# (strcat Folder$ Slide3$))(end_image)
(start_image "Slide4")(slide_image 1 1 X# Y# (strcat Folder$ Slide4$))(end_image)
(start_image "Slide5")(slide_image 1 1 X# Y# (strcat Folder$ Slide5$))(end_image)
(start_image "Slide6")(slide_image 1 1 X# Y# (strcat Folder$ Slide6$))(end_image)
(start_image "Slide7")(slide_image 1 1 X# Y# (strcat Folder$ Slide7$))(end_image)
(start_image "Slide8")(slide_image 1 1 X# Y# (strcat Folder$ Slide8$))(end_image)
(start_image "Slide9")(slide_image 1 1 X# Y# (strcat Folder$ Slide9$))(end_image)
(start_image "Slide10")(slide_image 1 1 X# Y# (strcat Folder$ Slide10$))(end_image)
(start_image "Slide11")(slide_image 1 1 X# Y# (strcat Folder$ Slide11$))(end_image)
(start_image "Slide12")(slide_image 1 1 X# Y# (strcat Folder$ Slide12$))(end_image)
(start_image "Slide13")(slide_image 1 1 X# Y# (strcat Folder$ Slide13$))(end_image)
(start_image "Slide14")(slide_image 1 1 X# Y# (strcat Folder$ Slide14$))(end_image)
(start_image "Slide15")(slide_image 1 1 X# Y# (strcat Folder$ Slide15$))(end_image)
(start_image "Slide16")(slide_image 1 1 X# Y# (strcat Folder$ Slide16$))(end_image)
    ; Dialog Actions
(action_tile "Slide1" "(done_dialog 11)")
(action_tile "Slide2" "(done_dialog 12)")
(action_tile "Slide3" "(done_dialog 13)")
(action_tile "Slide4" "(done_dialog 14)")
(action_tile "Slide5" "(done_dialog 15)")
(action_tile "Slide6" "(done_dialog 16)")
(action_tile "Slide7" "(done_dialog 17)")
(action_tile "Slide8" "(done_dialog 18)")
(action_tile "Slide9" "(done_dialog 19)")
(action_tile "Slide10" "(done_dialog 20)")
(action_tile "Slide11" "(done_dialog 21)")
(action_tile "Slide12" "(done_dialog 22)")
(action_tile "Slide13" "(done_dialog 23)")
(action_tile "Slide14" "(done_dialog 24)")
(action_tile "Slide15" "(done_dialog 25)")
(action_tile "Slide16" "(done_dialog 26)")
(action_tile "cancel" "(done_dialog 0)")

(setq a1 (start_dialog))
(setq osm (getvar "osmode"))
(command "attreq" "0")
(command "snap" "0.0625")
(if (and a1 (> a1 1))
(progn
                     (if (not (tblsearch "layer" "PID"))
                           (entmake
                              (list
                                 (cons 0 "Layer")
                                 (cons 100 "AcDbSymbolTableRecord")
                                 (cons 100 "AcDbLayerTableRecord")
                                 (cons 2 "PID")
                                 (cons 70 0)
                                 (cons 62 2)
                                 (cons 6 "Continuous")
                               )       ;list
                              )       ;entmake
                         )      ;if

(setvar "clayer" "PID")
(if (setq insertpt1 (getpoint "\nPick Insertion Point: "))
(progn
(if (and (setq ntsel (nentselp insertpt1))
   (= (length ntsel) 2)
   (setq name (car ntsel))
   (wcmatch (cdr (assoc 0 (entget name))) "LINE,LWPOLYLINE")
   );; and
   (setq objx 1)
   );; if

   (cond          ;as long as
((= a1 11)(MySub "PVS001" 0.0938 -0.0938 insertpt1))    ;a1 11
((= a1 12)(MySub "PVS002" 0.0938 -0.0938 insertpt1))    ;a1 12
((= a1 13)(MySub "PVS003" 0.0938 -0.0938 insertpt1))    ;a1 13
((= a1 14)(MySub "PVS004" 0.0938 -0.0938 insertpt1))    ;a1 14
((= a1 15)(MySub "PVS005" 0.0938 -0.0938 insertpt1))    ;a1 15
((= a1 16)(MySub "PVS006" 0.0938 -0.0938 insertpt1))    ;a1 16
((= a1 17)(MySub "PVS007" 0.0938 -0.0938 insertpt1))    ;a1 17
((= a1 18)(MySub "PVS008" 0.0625 -0.0625 insertpt1))    ;a1 18
((= a1 19)(MySub "PVS009" 0.0938 -0.0938 insertpt1))    ;a1 19
((= a1 20)(MySub "PVS010" 0.0938 -0.0938 insertpt1))    ;a1 20
((= a1 21)(MySub "PVS011" 0.0938 -0.0938 insertpt1))    ;a1 21
((= a1 22)(MySub "PVS012" 0.0938 -0.0938 insertpt1))    ;a1 22
((= a1 23)(MySub "PVS013" 0.0938 -0.0938 insertpt1))    ;a1 23
((= a1 24)(MySub "PVS014" 0.0000 -0.0000 insertpt1))    ;a1 24
((= a1 25)(MySub "PVS015" 0.0313 -0.0313 insertpt1))    ;a1 25
((= a1 26)(MySub "PVS016" 0.0781 -0.0781 insertpt1))    ;a1 26
       )          ;cond
      )          ;progn
)          ;a1 1 if
))          ;if progn test   
(setvar "osmode" osm)
(setvar "cmdecho" 0)      
(princ)
   (command "_.undo" "_end")
(setvar "clayer" oldlay)
(princ)      
)   

(defun MySub (a1 a2 a3 insertpt1 / OBJ P2 P3 doc)      ;subfunction
(vl-load-com)          ;load vlisp functions
(if (= objx 1)         ;if objx is 1, ent=line or pline
   (progn          ;preform these actions
(setvar "osmode" 0)         ;first turn off osnap
(princ)
(if (> a2 0.0)          ;if trim dist is greater than 0.0 preform
(progn         ;these actions
(setq obj (vlax-ename->vla-object name))      ;get entity object
(if (eq (vla-get-ObjectName obj) "AcDbPolyline")   ;if it is a LwPolyline
    (setq p3 insertpt1         ;get first break point
   p2 (angle insertpt1(vlax-curve-getpointatparam obj
(fix (vlax-curve-getparamatpoint obj
(vlax-curve-getClosestPointTo obj insertpt1 T))))))      
(setq p3 insertpt1         ;and second break point
   p2 (angle (vlax-curve-getStartpoint obj) (vlax-curve-getEndPoint obj)))
)         ;if
(command "break" name (polar p3 p2 a2) (polar p3 p2 a3))
(command "_insert" a1 insertpt1 "" "" pause)      ;insert into space
)         ;progn
(princ "\n......Selected....\n......Breaking Lines....")    ;status
)         ;if
)
(progn
(command "_insert" a1 insertpt1 "" "" pause)      ;insert onto line
(princ)
)
)         ;if
(princ "\n......Insertion Completed!")       ;princ
(princ)
(setq name nil)
)         ;MySub

Bhull1985 发表于 2022-7-5 23:32:02

和DCL

img : image_button
{
height = 6.5;
width = 22.00;
fixed_width = true;
fixed_height = true;
alignment = centered;
color = -2;
}
txt : text {fixed_width = true; alignment = centered; }
col : column {fixed_width = true; width = 45; }
//---------------------------------------------------------------------------------------------------------
//   PIP Small Valves Dialog
// Brandon Hull, Cynthia helms, special thanks to : Lee Mac, Scot65, HmSilva
//---------------------------------------------------------------------------------------------------------
PIPsmallvalves : dialog {
label = "SMALL VALVES"; spacer;
: row
{
   : col
   {
: img { key = "Slide1"; } : txt { label = "Gate Valve"; } spacer_1;
: img { key = "Slide2"; } : txt { label = "Check Valve"; } spacer_1;
: img { key = "Slide3"; } : txt { label = "Stop Check"; } spacer_1;
: img { key = "Slide4"; } : txt { label = "Globe Valve"; }
   }
   : col
   {
: img { key = "Slide5"; } : txt { label = "Butterfly Valve"; } spacer_1;
: img { key = "Slide6"; } : txt { label = "Needle Valve"; } spacer_1;
: img { key = "Slide7"; } : txt { label = "Ball Valve"; } spacer_1;
: img { key = "Slide8"; } : txt { label = "Generic Rotary"; }
   }
   : col
   {
: img { key = "Slide9"; } : txt { label = "Plug Valve"; } spacer_1;
: img { key = "Slide10"; } : txt { label = "Diaphragm Valve"; } spacer_1;
: img { key = "Slide11"; } : txt { label = "Three-Way Valve"; } spacer_1;
: img { key = "Slide12"; } : txt { label = "Four-Way Valve"; }
   }
   : col
   {
: img { key = "Slide13"; } : txt { label = "Pinch Valve"; } spacer_1;
: img { key = "Slide14"; } : txt { label = "Angle Valve"; } spacer_1;
: img { key = "Slide15"; } : txt { label = "Knife Valve"; } spacer_1;
: img { key = "Slide16"; } : txt { label = "Three-Way Ball Valve"; }
   }
}
spacer; cancel_button;
}///generalsymbols

 
 
好吧,那么!那里
 
根据DCL中需要的项目数量,您需要编辑红色的代码,还需要使用命令“MSLIDE”创建幻灯片,这非常简单。
制作幻灯片后,编辑红色代码,使其与块名称相对应(确保幻灯片的名称与其图片中的块名称相同-不是强制性的,但这是该代码的设置方式。)
将存储块和幻灯片的目录添加到autocad支持文件搜索路径中。
 
哦,有一件事。。。。第一个post LISP需要保存为“YOURFILENAME.lsp”,DCL需要为“YOURDCLNAME.DCL”才能工作。然后,您需要匹配代码中的名称,以便它知道要查找打开的文件。谷歌了解更多信息或在这里询问。
哦,还有一件事。此代码包含的代码将围绕插入到该行或LWPOLYLINE上的项目修剪一条直线或LWPOLYLINE。如果你不需要这样的功能,简单地说,它很容易删除。。。
HTH公司

ReMark 发表于 2022-7-5 23:37:14

如果所有需要填充的圆都是不同大小的,该怎么办?

andy_lee 发表于 2022-7-5 23:39:25

 
不幸地我认为我的主题不是关于插入块,而是关于图案填充。
但还是要谢谢你,一个很好的Dcl模板。
页: [1] 2
查看完整版本: 圆圈标记?帮助