/
// 实用工具扩展程序
// 开发者:
// 2007年11月
//
***MENUGROUP=实用工具
***POP12
**实用工具
[实用工具(&D)]
[--]
ID_dm [->地亩工具(&L)]
ID_TEST_A [多义线方向修改]^C^C_DRev
ID_TEST_B [多义线标注折点号]^C^C_BZ
ID_TEST_C [多义线折点号坐标输出]^C^C_CXY
***HELPSTRINGS
ID_TEST_A [可以修改多义线起终点的前进方向:DREV]
ID_TEST_B [沿多义线方向标注折点号:BZ]
然后在CAD里面用menuload命令加载这个菜单文件就行了,具体的还是自己多试几次就明白了
//// AutoCAD menu file - C:\Program Files\AutoCAD 2012\AC_WEI_2012\ac_WEI.mns
//
***MENUGROUP=AC_wei
***POP1
[AC_wei]
ID_WeiTktb [标准图框(&K)]^C^C^Ctktb
[--]
ID_WeiText [->&Text]
ID_Wei35 [&3.5mm]^C^C^Ctext \(* 3.5 (getvar "USERI1"))
ID_Wei50 [&5.0mm]^C^C^Ctext \(* 5.0 (getvar "USERI1"))
ID_Wei70 [&7.0mm]^C^C^Ctext \(* 7.0 (getvar "USERI1"))
ID_WeiDtext [T&ext]^C^C^Ctext
[--]
ID_WeiTextp [多行文本(&P)]^C^C^Ctextp
ID_WeiAsctext[输入文本(&I)]^C^C^C(if ( null C:asctext ) ( load "asctext" )) asctext
ID_WeiOuttext[输出文本(&O)]^C^C^Couttext
[--]
ID_WeiNumb [序号(&N)]^C^C^Cnumb
ID_WeiSign [<-编号(&S)]^C^C^Csign
ID_WeiDim [->&Dimension]
ID_WeiLarge [大尺寸(&L)]^C^C^Cdim dimasz (* 3.0 (getvar "USERI1")) dimexe (* 3 (getvar "USERI1")) dimtxt (* 4.2 (getvar "USERI1"))
ID_WeiMedium [中尺寸(&M)]^C^C^Cdim dimasz (* 2.5 (getvar "USERI1")) dimexe (* 2 (getvar "USERI1")) dimtxt (* 3.5 (getvar "USERI1"))
ID_WeiSmall [小尺寸(&S)]^C^C^Cdim dimasz (* 2.0 (getvar "USERI1")) dimexe (* 1 (getvar "USERI1")) dimtxt (* 2.8 (getvar "USERI1"))
[--]
ID_WeiDimTick[斜线式样(&T)]^C^C^Cdim dimasz (* 2.5 (getvar "USERI1")) dimblk tickm dimexe (* 2 (getvar "USERI1")) dimtxt (* 3.5 (getvar "USERI1"))
ID_WeiDimArrow [箭头式样(&A)]^C^C^Cdim dimasz (* 2.5 (getvar "USERI1")) dimblk . dimexe (* 2 (getvar "USERI1")) dimtxt (* 3.5 (getvar "USERI1"))
ID_WeiDimDot [圆点式样(&O)]^C^C^Cdim dimasz (* 1.0 (getvar "USERI1")) dimblk dot dimexe (* 1 (getvar "USERI1")) dimtxt (* 2.8 (getvar "USERI1"))
[--]
ID_1_______0 [&1位小数]^C^C^CDIMDEC 1
ID_0_______0 [&0位小数]^C^C^CDIMDEC 0
ID_WeiScale [<-尺寸比例(&C)]^C^C^Cdim dimlfac
ID_WeiTable[->T&able]
ID_WeiIndex [卷册目录(&I)]^C^C^Climits 0,0 430,297 zoom a (setvar "USERI1" 1) insert *index 0,0 1.0
ID_WeiHq [会签图标(&H)]^C^C^C-insert *sign \(getvar "USERI1")
ID_WeiCurve [安装曲线表(&C)]^C^C^C(if ( null C:curve ) ( load "curve" )) curve
ID_WeiFortz [拉力计算表(&T)]^C^C^C(if ( null C:fortz ) ( load "fortz" )) fortz
[--]
ID_WeiMate [材料表(&M)]^C^C^Cmtable \0
ID_WeiMatel [照明表(&L)]^C^C^Cmtable \1
ID_WeiFrame [材料方框(&F)]^C^C^Cframe
[--]
ID_WeiMates [小材料表(&S)]^C^C^Cmtable \2
ID_WeiMatels [小照明表(&Z)]^C^C^Cmtable \3
[--]
ID_WeiTableB [<-表格材料表(&B)]^C^C^C-insert *table \(getvar "USERI1")
ID_WeiPower[->&Power]
ID_WeiCline [导线(&C)]^C^C^Ccline
ID_WeiTube [埋管(&T)]^C^C^Ctube
ID_WeiScdzp [端子排(&D)]^C^C^Cscdzp
ID_WeiZH [组合导线(&Z)]*^C^C^Cmeasure \bzh2000
ID_Weiground [接地母线(&G)]^C^C^Cground
ID_WeiSafe [安全净距(&S)]^C^C^Csafe
[--]
ID_WeiMain [->主接线(&M)]
ID_______________0 [双母线 下出线]^C^C(if (null c:abD) (LOAD"ab")) abD
ID_______________1 [<-<-双母线 上出线]^C^C(if (null c:abU) (LOAD"ab")) abU
ID_WeiRod [->&Rod]
ID__________F__0 [数据文件(&F)]^C^C(if (null c:rod) (load "rod" )) (Findrod)
ID__________N__0 [工程名 (&N)]^C^C( rodName rodFile )
ID__________C__0 [座标高度(&C)]^C^C( rodCoord rodFile rodOrg )
ID__________D__0 [单针绘图(&D)]^C^C( rodDist rodFile rodOrg )
ID__________E__0 [多针外围(&E)]^C^C( rodExt rodFile rodOrg )
ID__________I__0 [多针内部(&I)]^C^C( rodIn rodFile rodOrg )
ID__________S__0 [单针填表(&S)]^C^C( rodSingle rodFile )
ID__________M__0 [多针填表(&M)]^C^C( rodMulti rodFile )
[--]
ID________A__0 [<-全部 (&A)]^C^C(if (null c:rod) ( load "rod" )) rod
ID_WeiCivil[->&Civil]
ID_WeiWall [围墙(&W)]^C^C^Cwall
ID_WeiRoad [道路(&R)]^C^C^Croad
ID_WeiHeight [标高(&H)]^C^C^Cheight
ID_WeiEarth [地坪(&E)]^C^C^C-insert earth \(getvar "USERI1")
ID_WeiHf [焊缝(&F)]^C^C^Chf
ID_WeiDaxis [轴线网(&D)]^C^C^C(if (null c:daxis) (load "daxis")) daxis
ID_WeiNorth [指北针(&N)]^C^C^Cnorth
ID_WeiCrect [<-中心矩形(&C)]^C^C^Ccrect
ID_WeiTools[->T&ools]
ID_WEiLtygen [线型化(&L)]*^C^Cpedit \LON
ID_WeiCut[断面线(&C)]^C^C^Ccut
ID_WeiMateId [标注材料(&M)]^C^C^CMateId
ID_WeiRewid [更改线宽(&R)]^C^C^Crewid
ID_WeiSsx[分类选择(&S)]^C^C^Cssx
ID_WeiLeng [多义线长(&P)]^C^C^CLeng
ID_WeiDellayer [删除某层(&D)]^C^C^Cdellayer
ID_WeiArrow [<-剖面符号(&A)]^C^C^Carrow
[--]
ID_WeiDevelop [->二次开发(&E)]
ID_tktb___0 [Frame ]^C^C^C(load "frame.lsp") frame
[--]
ID_Entget___0[E&ntget ]^C^C(entget (car (entsel)))
ID_Entnext__0[<-Entne&xt ]^C^C(entget (entnext (car (entsel))))
//
// End of AutoCAD menu file - C:\Program Files\AutoCAD 2012\AC_WEI_2012\AC_wei.mns
//
参照上例,编写你自己的菜单文件,然后执行命令:menuload。
所有的自编lisp命令,放到文件ac_wei.mnl里,即*.mns与*.mnl要有相同的文件名。
可以用反应器实现,前提是画线和输入文字必须用定义的函数一次性 *** 作完成.LISP代码如下:(VL-Load-Com)
(defun c:Line_Txt(/ Pt Pt1 Pt2 EntLine HandTxt VlaObj Tmp)
(setq Pt1 (getpoint "\n指定第一点:"))
(setq Pt2 (getpoint "\n指定下一点:"))
(setq Pt (list (/ (+ (car Pt1) (car Pt2)) 2) (/ (+ (cadr Pt1) (cadr Pt2)) 2) (/ (+ (caddr Pt1) (caddr Pt2)) 2)))
(command "._Line" Pt1 Pt2 "")
(setq EntLine (entlast))
(setq VlaObj (cons (VLAX-EName->VLA-Object EntLine) '()))将直线转换为VLA对象
(setq HandTxt '((0 . "TEXT"))
HandTxt (append HandTxt (list (append '(10) Pt1)))
HandTxt (append HandTxt (list (append '(11) Pt)))
HandTxt (append HandTxt (list (cons 40 (getdist "\n指定高度:"))))
HandTxt (append HandTxt (list (cons 72 1)))
HandTxt (append HandTxt (list (cons 73 0)))
HandTxt (append HandTxt (list (cons 50 (angle pt1 Pt2))))
HandTxt (append HandTxt (list (cons 1 (getstring "\n输入文字:>")))))
(entmake HandTxt)
(setq HandTxt (cdr (Assoc 5 (entget (entlast)))))
(VLR-Pers (VLR-Object-Reactor vlaObj HandTxt '((:vlr-modified . LineModefy))))
)
(defun LineModefy(EntLine EntTxt parameter-list / Pt Pt1 Pt2)
(setq EntTxt (entget (HandEnt (VLR-Data EntTxt))))
(setq EntLine (entget (VLAX-VLA-Object->EName EntLine)))
(setq Pt1 (cdr (assoc 10 EntLine)) Pt2 (cdr (assoc 11 EntLine)))
(setq Pt (list (/ (+ (car Pt1) (car Pt2)) 2) (/ (+ (cadr Pt1) (cadr Pt2)) 2) (/ (+ (caddr Pt1) (caddr Pt2)) 2)))
(setq EntTxt (subst (cons 50 (angle Pt1 Pt2)) (assoc 50 EntTxt) EntTxt)
EntTxt (subst (append '(10) Pt1) (assoc 10 EntTxt) EntTxt)
EntTxt (subst (append '(11) Pt) (assoc 11 EntTxt) EntTxt))
(entmod EntTxt)
)
也可以用属性块实现,将文字与直线定义成属性块,打开块编辑器,在参数选项板中设定点参数和旋转参数,在动作选项板中定义要执行的动作,……,具体的自己参照属性块的做吧。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)