找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 921|回复: 2

[文章]:entmake lwpolyline的方法...

[复制链接]

已领礼包: 145个

财富等级: 日进斗金

发表于 2002-1-30 00:16:23 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?立即注册

×
This code is compatible with:
Version: R14.01, 2000

Here are some group codes which can be used in the polyline's data to specify
its properties:

8 specifies the layer
62 specifies the colour
70 specifies whether a polyline is open or closed
40 and 41 need to be set for each polyline vertex, to set the start and end
widths for the segment

Here is some code which can be used to create LWPOLYLINEs from LISP:

  1. (defun c:entmakelwpoly(/ vlist elist lay col wdt pt)
  2.         ;vertex list
  3.         (Setq vlist '( (50 50) (150 50) (150 150) (50 150)  ))
  4.         (setq elist '())
  5.         (setq lay "0")
  6.         (setq col 2)
  7.         (setq wdt 2.0)

  8.         ;build header

  9.         (setq elist (append elist
  10.                                 (list                            
  11.                                         (cons 0  "LWPOLYLINE")
  12.                                         (cons 100  "AcDbEntity")
  13.                                         (cons 67  0)
  14.                                         (cons 62 col)
  15.                                         (cons 410  "Model")
  16.                                         (cons 8 lay)
  17.                                         (cons 100 "AcDbPolyline")
  18.                                         (cons 90 (length vlist))
  19.                                         (cons 70  1)
  20.                                         (cons 43  wdt)
  21.                                         (cons 38  0.0)
  22.                                         (cons 39  0.0)
  23.                                 )
  24.                      )
  25.           );setq                            
  26.        
  27.         ;build vertexes
  28.         (foreach pt vlist
  29.                 (setq elist (append elist
  30.                                 (list       
  31.                                         (cons 10  pt)
  32.                                         (cons 40  2.0)
  33.                                         (cons 41  2.0)
  34.                                         (cons 42  0.0)
  35.                                 )
  36.                             )
  37.                 );setq                     

  38.         );foreach

  39.         (setq elist (append elist (list (list 210 0.0 0.0 1.0)))) ;normal vector

  40.         ;create lwpolyline
  41.         (entmake elist)

  42.         (princ)
  43. )
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
发表于 2002-1-31 19:11:38 | 显示全部楼层

entmake-lwpl

(#m_pl d70 pl_list "0" -1)
(#m_pl2 d70 plw pla pl_list "0" -1)等宽等角pl线

  1. ;;;制造 LWPOLYLINE  input: d70=0开口,1闭合; plist'((p d40 d41 d42)....);
  2. (defun #m_pl (d70 pl_list lay_pl color /)
  3.   (setq        d90 (length pl_list)
  4.         pb  '()
  5.   )
  6.   (foreach x pl_list
  7.     (progn
  8.       (setq pb(append pb
  9.         (list (cons 10 (nth 0 x))
  10.               (cons 40 (nth 1 x))
  11.               (cons 41 (nth 2 x))
  12.               (cons 42 (nth 3 x))
  13.         ) )
  14.     ) )
  15.   )
  16.   (setq        en (append (list
  17.         (cons 0 "LWPOLYLINE")
  18.         (cons 100 "AcDbEntity")
  19.         (cons 8 lay_pl)
  20.         (cons 100 "AcDbPolyline")
  21.         (cons 90 d90)
  22.         (cons 70 d70))
  23.         pb) )
  24.   (if (/= -1 color) (setq en (append en (list (cons 62 color)))))
  25.   (if (= nil (entmake en)) (princ "\n制造 LWPL 制造失败.")  )
  26. )

  27. (defun #m_pl2 (d70 plw pla pl_list lay_pl color / pb)
  28.   (setq        d90 (length pl_list)
  29.         pb  '()
  30.   )
  31.   (foreach x pl_list
  32.     (progn
  33.       (setq pb
  34.              (append pb
  35.                      (list (cons 10 x)
  36.                            (cons 40 plw)
  37.                            (cons 41 plw)
  38.                            (cons 42 pla)
  39.                      )
  40.              )
  41.       )
  42.     )
  43.   )
  44.   (setq        en (append (list
  45.                         (cons 0 "LWPOLYLINE")
  46.                         (cons 100 "AcDbEntity")
  47.                         (cons 8 lay_pl)
  48.                         (cons 100 "AcDbPolyline")
  49.                         (cons 90 d90)
  50.                         (cons 70 d70)
  51.                       )
  52.                       pb
  53.               )
  54.   )
  55.   (if (/= -1 color) (setq en (append en (list (cons 62 color)))))
  56.   (if (= nil (entmake en)) (princ "\n制造 LWPL 制造失败.")  )
  57. )


:9 :9 :9
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

已领礼包: 55个

财富等级: 招财进宝

发表于 2018-10-26 16:46:39 | 显示全部楼层
我好像还没有发帖子的权利!借贵地法个求茄子
今天遇到一个问题,一天也没想出来,郁闷!
我用entmake 创建了一个多段线实体-横断面,想加入一些注释,工程人都知道,比如里程、标高、中心点坐标
程序通过了,看着加进去了,可是再调用实体参数,发现只有标高加进去了,另外两个没进去!
什么原因,谁知道?我也没有交友的权限!
以下是代码:
(defun c:xjty ()
(setq lst '((602070.0 4.45612e+006 0) (602074.0 4.45612e+006 0) (602076.0 4.45612e+006 0) (602079.0 4.45613e+006 0) (602084.0 4.45613e+006 0) (602087.0 4.45613e+006 0) (602089.0 4.45613e+006 0) (602094.0 4.45613e+006 0) (602097.0 4.45614e+006 0) (602101.0 4.45614e+006 0) (602106.0 4.45614e+006 0) (602114.0 4.45614e+006 0) (602116.0 4.45614e+006 0) (602119.0 4.45614e+006 0) (602133.0 4.45614e+006 0) (602138.0 4.45613e+006 0) (602143.0 4.45613e+006 0) (602146.0 4.45613e+006 0) (602148.0 4.45613e+006 0) (602151.0 4.45613e+006 0) (602155.0 4.45612e+006 0) (602158.0 4.45612e+006 0) (602161.0 4.45612e+006 0) (602165.0 4.45612e+006 0) (602166.0 4.45612e+006 0)))
(setq str "licheng" bg 72.0 pt '(602114.0 4.45614e+006 0))
(entmake (append (list '(0 . "LWPOLYLINE") '(100 . "AcDbEntity") '(100 . "AcDbPolyline") (cons 1 str)(cons 38 bg)(cons 12 pt)(cons 90 (length lst)))
      (mapcar '(lambda (pt)(cons 10 pt)) lst ))
  )
);end fun
运行结果如下:
命令: XJTY
((0 . "LWPOLYLINE") (100 . "AcDbEntity") (100 . "AcDbPolyline") (1 . "licheng") (38 . 72.0) (12 602114.0 4.45614e+006 0) (90 . 25) (10 602070.0 4.45612e+006 0)
但我再用参数查看这个出来的图元,却发现,1. 和12.没有聊
STCS
/n make a choice:((-1 . <图元名: 7fffed3bce0>) (0 . "LWPOLYLINE") (330 . <图元名: 7fffed379f0>) (5 . "25E") (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 . "0") (100 . "AcDbPolyline") (90 . 25) (70 . 0) (43 . 0.0) (38 . 72.0) (39 . 0.0) (10 602070.0 4.45612e+006) (40 . 0.0) (41 . 0.0)
谁知道怎么回事啊,我是刚刚出家学习lsp,不要笑我!
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

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

本版积分规则

QQ|申请友链|Archiver|手机版|小黑屋|辽公网安备|晓东CAD家园 ( 辽ICP备15016793号 )

GMT+8, 2024-4-20 07:07 , Processed in 0.337292 second(s), 35 queries , Gzip On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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