- UID
- 8476
- 积分
- 442
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2002-8-4
- 最后登录
- 1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
AutoCAD 2008的一些新特性及与以往Lisp之小联系
qjchen
1)加了一种Annotaion的概念,可以在缩放详图的时候自动调整尺寸,这点对详图设计应该比较有用。所以必须学习一下annotation scale。而annotative object包含了好些实体,比如dimension,text等。2008把它当成第一个新特性,肯定认为是很重要的吧。
Lisp相关:以前有一个叫Detail的程序。
xdcad链接
http://www.xdcad.net/forum/showthread.php?threadid=59789
链接2
附记:下面这个是McNeel公司(doslib公司)很早之前的一个detail程序。郭晨汉化。:)好像郭晨这个网站比xdcad还要早一点一样。记得早期有小宇,王者之剑,谢永忠,尉迟俊岭,Qlin大侠(我们学校bbs的cad版主)等网络知名人士。而国外著名人物有tony tanzillo, bill krammer等。其实在cadalyst还可以找到几个类似的程序。
[php]
;本程序由郭晨汉化
;有任何问题请来信cadking@163.net
;主页http://cadking.yeah.net
;局部放大,绘出详图
;=======================================================================
; Allegro TABLET TOOLS LISP file
; DTL.LSP
;
; Extracts a section of a drawing for a detail.
; Lines, Arcs, & Circles are trimmed to the box boundary.
; P-LINES and equal scale blocks are exploded one level in the detail
; before trimming.
;
; (c) 1988 Robert McNeel & Assoc., 1310 Ward St., Seattle, WA, 98109
; This routine is submitted for private non-resale use by end users.
;=======================================================================
(princ "\nInitial load .. please wait\n")
;=======================================================================
(defun val (x e) (cdr (assoc x e)))
(defun enttype (e) (cdr (assoc 0 e)))
(defun entname (e) (cdr (assoc -1 e)))
(setq >90 (/ pi 2) >270 (* 3 (/ pi 2)))
;=======================================================================
; Find the 'endpoints ' of the LINES, ARCS, & CIRCLES in ss that are
; outside a rectangle described by the opposite corners pll and pur.
; and submits them to the command function.
;-----------------------------------------------------------------------
(defun osends (sss pll pur / z eps xll yll xur yur)
(ends sss) ;this puts the 'endpoints' in a list, eps
(if (< (car pll) (car pur))(setq xll (car pll) xur (car pur))
(setq xll (car pur) xur (car pll)))
(if (< (cadr pll) (cadr pur))(setq yll (cadr pll) yur (cadr pur))
(setq yll (cadr pur) yur (cadr pll)))
(foreach z eps ;this checks if they are outside the rectangle
(if (or (< (caadr z) xll)
(< (cadadr z) yll)
(> (caadr z) xur)
(> (cadadr z) yur)
)
(command z)
)
)
)
;-----------------------------------------------------------------------
; Finds the 'endpoints' of LINES, ARCS, & CIRCLES in ss.
; 'Endpoints' are:
; LINES: endpoints
; ARCS: endpoints and quadrant points
; CIRCLES: quadrant points
; The endpoint lists are consed into the list eps (global).
;-----------------------------------------------------------------------
(defun ends (ss / i ent cen)
(setq len (sslength ss) i 0) ;get number of entities
(princ len)(princ " Entities.")
(while (< i len) ;loop thru them
(princ ".")
(setq ent (entget (ssname ss i))) ;get assoc list
(cond ;Check for LINES, ARCS, & CIRCLES and cons
; the appropriate points into eps.
;Other entity types are ignored.
;LINES
((= (enttype ent) "LINE")
(setq eps (cons (list (entname ent) (val 10 ent)) eps))
(setq eps (cons (list (entname ent) (val 11 ent)) eps)) )
;ARCS
((= (enttype ent) "ARC")
(setq cen (val 10 ent))
(setq eps (cons
(list (entname ent)
(polar cen 0 (val 40 ent))) eps))
(setq eps (cons
(list (entname ent)
(polar cen >90 (val 40 ent))) eps))
(setq eps (cons
(list (entname ent)
(polar cen pi (val 40 ent))) eps))
(setq eps (cons
(list (entname ent)
(polar cen >270 (val 40 ent))) eps))
(setq eps (cons
(list (entname ent)
(polar cen (val 50 ent) (val 40 ent))) eps))
(setq eps (cons
(list (entname ent)
(polar cen (val 51 ent) (val 40 ent))) eps))
(setq eps (cons
(list (entname ent)
(osnap (polar cen (val 51 ent) (val 40 ent)) "mid")) eps)) )
;CIRCLES
((= (enttype ent) "CIRCLE")
(setq cen (val 10 ent))
(setq eps (cons
(list (entname ent)
(polar cen 0 (val 40 ent))) eps))
(setq eps (cons
(list (entname ent)
(polar cen >90 (val 40 ent))) eps))
(setq eps (cons
(list (entname ent)
(polar cen pi (val 40 ent))) eps))
(setq eps (cons
(list (entname ent)
(polar cen >270 (val 40 ent))) eps)) )
)
(setq i (1+ i)) ;Next entity
)
)
;-----------------------------------------------------------------------
;Explodes all p-lines in selection set s
;-----------------------------------------------------------------------
(defun exp_pl (s / i len ent)
(setq i 0 len (sslength s))
(while (< i len)
(setq ent (entget (ssname s i)))
(cond
((= (enttype ent) "POLYLINE")
(command "explode" (entname ent))
)
((= (enttype ent) "INSERT")
(if (= (val 41 ent) (val 42 ent) (val 43 ent)) ;check equal scale
(progn
(command "explode" (entname ent))
(setq blkflag 1) ;found one set flag
)
)
)
)
(setq i (+ 1 i))
)
)
;-----------------------------------------------------------------------
;erases parts of exploded p-lines that are outside target area
;-----------------------------------------------------------------------
(defun era_xtra (e)
(setq ssx (ssadd))
(while (setq e (entnext e))
(if (not (ssmemb e ss))
(ssadd e ssx)
)
)
(command "erase" ssx "")
)
;-----------------------------------------------------------------------
; Gets the geometry and calls routines to do the trimming.
;-----------------------------------------------------------------------
(defun c:dtl (/ px py pxx pyy xs ss b ssx)
(setvar "cmdecho" 0)
(setvar "highlight" 0)
(setq blkflag 1) ;set flag to explode at least once
(if (and
;This defines a rectangle to be copied out to a detail
(setq px (getpoint "\nFirst corner: "))
(setq py (getcorner px "\nOther corner: "))
;This is the position of the lower left corner of the detail
(setq pxx (getpoint px "\nNew first corner position: "))
;This is a size adjust factor for scaling the detail
(setq xs (getreal "\nScale factor for detail: ")) )
(progn
;copy out the stuff selected
(princ "\nCopying Please Stand By..")
(command "copy" "c" px py "" px pxx)
(command "pline" px (list (car px) (cadr py)) ;draw an outline of
py (list (car py) (cadr px)) "c") ; the base area.
;these are the new entities that may need trimming.
(setq last (entlast)) ;save end of database ie. pline
(setq pyy (polar pxx (angle px py) (distance px py)))
(while (= blkflag 1)
(setq blkflag 0) ;set block flag for exit
(command "select" "c" pxx pyy "r" "w" pxx pyy "")
(setq ss (ssget "p"))
(princ "\nExploding..")
(exp_pl ss) ;this explodes them
) ;then get all the new parts into ss
(princ "\nMaking New Selection Set.")
(setq ss (ssget "c" pxx pyy))
;and erase ones that are clear outside rectangle
(princ "\nClearing Excess Stuff..")
(era_xtra last)
(if (/= xs 1.0)(command "scale" ss "" pxx xs)) ;Scale the detail
;new other corner point of detail
(setq pyy (polar pxx (angle px py) (* xs (distance px py))))
(command "pline" pxx (list (car pxx) (cadr pyy)) ;Box around the
pyy (list (car pyy) (cadr pxx)) "c") ;detail
(command "select" "c" pxx pyy "r" "w" pxx pyy "")
(setq ss (ssget "p"))
(princ "\nTrimming ")
(command "trim" (setq b (entlast)) "") ;Last P-line is cutting edge
(osends ss pxx pyy) ;This finds the ends that are outside the box
; and trims them.
(command "") ;Terminate trim
(redraw b)
)
)
(princ "Done!")
(setvar "highlight" 1)
(setvar "cmdecho" 1)
(princ)
)
(prompt "\本程序由郭晨汉化,有任何问题请来信cadking@163.net,主页http://cadking.yeah.net,启动命令:dtl ")
(princ)
[/php]
2)Dimension的一些增强,包括公差的对齐等等,还有给标注加截断线,加了一种叫Inspection Dimension的。给线性标注添加一种叫Jog line来表示尺寸和实际不符的情况(还没有想明白具体的作用)。
Lisp相关:以前有一个弧线长度标注的程序,不过在最近版本的cad中已经自己支持了。
3)自动调整标注之间的间距,使之不重叠,这点倒是比较神奇,莫非有点人工智能的能力了(效果其实还不错,要先选基准线)。multileader会自动增加编号,可以自己定义格式,不过还不够智能的样子。不过它的对齐调整倒是比较有趣。
Lisp相关:探索者有一个多线标注的程序,但是作用不是很类似。
4)可以动态和Excel交换数据,内容包括sheet,range和cell,这个对各种表格软件的打击还是不小的。表格风格也得到了增强。表格中可以象excel一样拖曳来递增数据。可以把一个表格通过简单的点击变成两个(这个功能挺有趣的,以前还没有见过)。可以对图形对象进行数据导出,比如块,属性等。可以导出到excel。这个功能应该也挺不错。比如导出polyline围住的面积等。
Lisp相关:有不少关于Excel和Acad之间互通的程序,包括mmmm的程序和truetable,还有国外一些。
晓东链接1
http://www.xdcad.net/forum/showthread.php?threadid=330995
晓东链接2
http://www.xdcad.net/forum/showthread.php?s=&threadid=468541
5)layer的属性得到了一些增强,在不同的viewport中有不同的设置。
6)一种将选择图层不关闭,但锁住变灰可捕捉的reduce visual complexity的做法。这个Layeriso的命令非常好用,是这个版本的一个亮点了。地位可以和最近几个版本中出现的join和scaletext等小命令相媲美。
Lisp相关:记得xdcad几个版主曾经讨论过这个功能,是不是给了autodesk灵感啊。
链接:http://www.xdcad.net/forum/showthread.php?threadid=14885
7)可以对附加的xref的图层进行更好的控制。Xclip有了新的选项。
Lisp相关:Aeo版主写过自动剪切判断内外的程序。不过不是专门对xref的。
晓东链接1
http://www.xdcad.net/forum/showthread.php?threadid=195090
8)Visual fidelity 的功能用于对新的annotation性质进行控制。Mtext可以写多列文字了。多行块属性。
9)可以导入和导出Microstation的DGN文件。
10)aeo版主提过的substr问题仍然没有改进。看来unicode的问题还得持续一段时间。
http://www.xdcad.net/forum/showthread.php?s=&threadid=622088
所以个人感觉,2008的变化没有2007来的多。更多的细节,应该是小号版本的升级吧。 |
|