找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 2573|回复: 2

[求助] [求助]:LWPOLYLINE与POLYLINE的区别

[复制链接]
发表于 2004-11-16 19:51:52 | 显示全部楼层 |阅读模式

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

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

×
我要ENTMAKE一条LWPOLYLINE,该怎么写?
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
发表于 2004-11-16 20:40:45 | 显示全部楼层
帮助文件
A lightweight polyline (lwpolyline) is defined in the drawing database as a single graphic entity. The lwpolyline differs from the old-style polyline, which is defined as a group of subentities. Lwpolylines display faster and consume less disk space and RAM.

As of Release 14 of AutoCAD, 3D polylines are always created as old-style polyline entities, and 2D polylines are created as lwpolyline entities, unless they are curved or fitted with the PEDIT command. When a drawing from an earlier release is opened in Release 14 or a later release, all 2D polylines convert to lwpolylines automatically, unless they have been curved or fitted or contain xdata.
参考下面这段生成型钢截面的程序
;;;;;;;;;;;;;;;;;;;; Draw_Cl.LSP ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Purpose: entmake structural steel C sections as LWPOLYLINE
;; Author : Herman Mayfarth
;; Date : February 14, 2001
;; Version: 0.95 Beta Test Version
;; Copyright(c) 2001 Herman Mayfarth
;; All rights reserved.
;; Supplied "as is," and without warranty, express or implied.
;; NO redistribution without author's express WRITTEN permission.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;

;-------------------------tktn_csect1--------------------------------- ----
;;function to entmake C section using lightweight polyline
(defun tktn_csect1 (
shapename ;string describing section
data ;list containing section constants
ilayer ;insertion layer
insp ;point of insertion
ip ;string determines point on section for insertion
rot ;rotation angle
toe ;R or L

/
a ;1/2 (bf-tw)
d ;AISC section constants
tw ;read from data list
bf ;in this order
tf
k
r ;k-tf
d1 ;toe side
d2 ;web side
delta ;projection of flgbev
flgbev ;bevel angle
Pline ;entity assoc list for LWPOLYLINE
pt1 ;definition points of section
pt2
pt3
pt4
pt5
pt6
pt7
pt8
pt9
pt10
pt2a ;work points
pt4a
pt6a
pt8a
shapedata ;xdata string
ta ;turned angle = 80.5 degrees
ta4 ;turned angle/4
tan20 ;tangent of 20.125 degrees
xdata
)
(setq d (nth 0 data)
tw (nth 1 data)
bf (nth 2 data)
tf (nth 3 data)
k (nth 4 data)
r (- k tf)
a (/ (- bf tw) 2)
)
(setq shapedata shapename)
(setq ta (* PI (/ 80.5 180.0)) ; 80.5 degrees
ta4 (/ ta 4) ;1/4 turned angle of 80.5 degrees
tan20 (/ (sin ta4) (cos ta4));use for bulge specification
)
(setq flgbev (* PI (/ 9.5 180.0))) ;flange slope = 9.5 degrees
(setq delta (* a (sin flgbev))
d1 (- tf delta)
d2 (- k tf delta))
;;define upper left point relative to insertion point
(cond
((= ip "FT") (setq pt1 insp))
((= ip "TT") (setq pt1 (polar insp (+ rot pi) bf)))
((= ip "FB") (setq pt1 (polar insp (+ rot (/ pi 2)) d)))
((= ip "C") (setq pt1 (polar insp (+ rot (/ pi 2)) (/ d 2))))
((= ip "TB") (setq pt1 (polar (polar insp (+ rot (/ pi 2)) d)(+ rot pi) bf)))
(T (setq pt1 insp ));defaults to top left
);cond
;;define points clockwise from upper left
(setq pt2 (polar pt1 rot bf)
pt2a (polar pt2 (+ rot (* pi 1.5)) d1)
pt3 (polar pt2a (+ rot (+ pi flgbev)) d1)
pt4a (polar (polar pt1 rot tw) (+ rot (* pi 1.5)) (- k d2))
pt4 (polar pt4a (+ rot flgbev) d2)
pt5 (polar (polar pt1 rot tw) (+ rot (* pi 1.5)) k)
pt6 (polar pt5 (+ rot (* pi 1.5)) (- d (* 2 k)))
pt6a (polar pt6 (+ rot (* pi 1.5)) d2)
pt7 (polar pt6a (+ rot (* pi 1.5) ta) d2)
pt10 (polar pt1 (+ rot (* pi 1.5)) d)
pt9 (polar pt10 rot bf)
pt8a (polar pt9 (+ rot (/ pi 2)) d1)
pt8 (polar pt8a (+ rot (- pi flgbev)) d1)
)
;;entmake LWPLINE
(setq Pline (list '(0 . "LWPOLYLINE")
'(100 . "AcDbEntity")
(cons 6 (getvar "CELTYPE"))
(cons 8 ilayer)
'(100 . "AcDbPolyline")
'(90 . 10)
(cons 10 pt1)
(cons 10 pt2) (cons 42 (- tan20))
(cons 10 pt3)
(cons 10 pt4) (cons 42 tan20)
(cons 10 pt5)
(cons 10 pt6) (cons 42 tan20)
(cons 10 pt7)
(cons 10 pt8) (cons 42 (- tan20))
(cons 10 pt9)
(cons 10 pt10)
(cons 62
(cond ((= (getvar "CECOLOR") "BYLAYER") 256)
((= (getvar "CECOLOR") "BYBLOCK") 0)
(t (atoi (getvar "CECOLOR")))
);cond
);cons
'(70 . 1);closed PLINE
);list
);setq
(entmake Pline)
;;attach xdata to identify the shape
(if (not (tblsearch "APPID" "TKTN_STEEL")) (regapp "TKTN_STEEL"))
(setq xdata (list (list -3 (list "TKTN_STEEL" (cons 1000 shapedata)))))
(entmod (append (entget (entlast)) xdata))
;;mirror the section if toe is Left
(tktn_sleep_osnap)
(if (= (strcase toe) "L")
(if (or (= ip "FT") (= ip "FB") (= ip "C"))
(command "_.MIRROR" (entlast) "" (trans pt1 0 1) (trans pt10 0 1) "Y")
(command "_.MIRROR" (entlast) "" (trans pt2 0 1) (trans pt9 0 1) "Y")
)
)
(tktn_wake_osnap)
(princ)
);end tktn_csect1
(princ)

;;;Puckett, Michael有这么一个简洁的
(defun entmakelwpline (plist width)
(entmake
(append
(list
'(0 . "LWPOLYLINE")
'(100 . "AcDbEntity")
'(100 . "AcDbPolyline")
(cons 90 (length plist))
(cons 43 width)
)
(mapcar '(lambda (x) (cons 10 x)) plist)
)
)
)
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

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

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-9-27 15:22 , Processed in 0.266995 second(s), 36 queries , Gzip On.

Powered by Discuz! X3.5

© 2001-2025 Discuz! Team.

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