CASS屏幕菜单文件(ScreenMenu.def
)存放在CASS安装目录下的SYSTEM文件夹中。格式如下:
红色是我们自定义的屏幕菜单,如果是以“*”打头,那么该子项链接的就是命令,否则是幻灯片。
[文字注记]
注记文字,*wzzj
变换字体,fonts1
定义字型,*style
坐标坪高,zbpg
常用文字,cywz
门牌号录入,*mphlr
mphlr是我们自定义的命令,调用的是VBA编写的pWriteMPH过程,如下:
(defun C:mphlr()
(setq oce (getvar
"cmdecho"))
;存储旧指令响应值
(setvar "cmdecho"
0)
;关闭指令响应
(command "-vbarun" "pWriteMPH")
(setvar "cmdecho"
oce)
;恢复旧的指令响应值
(princ)
;避开程序最后响应
)
pWriteMPH过程如下:
'录入门牌号子过程
Public Sub pWriteMPH()
On Error Resume Next
Dim pMPHTxt As AcadText
Dim pMPHStr As String
pMPHStr = InputBox("请输入门牌号:",
"请输入门牌号", "000")
'得到门牌号的插入点
Dim pBasePt As Variant
pBasePt = ThisDrawing.Utility.GetPoint(,
"请选择插入点")
Dim currentLyr As AcadLayer
Dim newLyr As AcadLayer
Set newLyr = ThisDrawing.Layers.Add("MPH")
'定义层的颜色
Dim corLyr As AcadAcCmColor
Set corLyr =
AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor.16")
Call corLyr.SetRGB(252, 243, 0)
newLyr.TrueColor = corLyr
Set currentLyr =
ThisDrawing.ActiveLayer
'得到当前活动图层
'在图上添加门牌号
ThisDrawing.ActiveLayer = newLyr
Set pMPHTxt =
ThisDrawing.ModelSpace.AddText(pMPHStr, pBasePt, 3)
pMPHTxt.Alignment =
acAlignmentMiddleCenter
pMPHTxt.TextAlignmentPoint = pBasePt
'为门牌号添加编码
Dim pType(1) As Integer
Dim pData(1) As Variant
pType(0) = 1001: pData(0) = "South"
pType(1) = 1000: pData(1) = "111111"
pMPHTxt.SetXData pType, pData
ThisDrawing.ActiveLayer = currentLyr
'返回当前活动图层
ThisDrawing.Application.Update
'刷新
End Sub
我们自己添加的编码为“111111”,此编码必须在图元索引文件INDEX.INI中登记,如下(红色部分就是我们自定义的图元索引):
CASS7.0编码,主参数,附属参数,图元说明,用户编码,GIS表名
1759900,text,0.0000,自然地貌注记,200009,DMZJ
1279900,text,0.0000,水系注记,180009,SXZJ
1829900,text,0,城市绿地注记,210009,ZBZJ
111111,text,0,门牌号注记,111111,MPH
最后的效果如下:

加载中,请稍候......