- 积分
- 1147
- 明经币
- 个
- 注册时间
- 2002-7-17
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
发表于 2003-5-29 16:33:00
|
显示全部楼层
是不是这样可以帮你
是不是这样的,我这个程序在标序号是可以对较形进行缩放,拖动等透明命令
(因为有个窗口没有传上来,所以你不能进行设置)
Sub bxh()
On Error Resume Next
'*********定义变量***********
Dim textCon As String
Dim varPnt As Variant
Dim keywd As String
Dim textobj As Object
Dim Found As Boolean
Dim layerObj As AcadLayer
Dim currLayer, newlayer As AcadLayer
Static textH As Single
Static textXh As Integer
Static textPre As String
Static textSuf As String
'********选择图层***********
Found = False
For Each layerObj In ThisDrawing.Layers
If StrComp(layerObj.Name, "序号", 1) = 0 Then
Found = True
End If
Next
If Not Found Then
Set newlayer = ThisDrawing.Layers.add("序号")
newlayer.color = acMagenta
End If
Set newlayer = ThisDrawing.Layers("序号")
currLayer = ThisDrawing.ActiveLayer
ThisDrawing.ActiveLayer = newlayer
'*******主程序***********
bzxh:
If textH = 0 Then
pubTexth = 1: textH = 1: PubtextPre = "(": PubtextSuf = ")"
textSuf = ")": textPre = "("
textXh = 1
Else:
PubtextPre = textPre
PubtextSuf = textSuf
pubTexth = textH
End If
youForm1.TextBox4.text = pubTexth
youForm1.TextBox1.text = PubtextXh
youForm1.TextBox2.text = PubtextPre
youForm1.TextBox3.text = PubtextSuf
Err.Clear
ThisDrawing.Utility.InitializeUserInput 128, "E S"
varPnt = ThisDrawing.Utility.GetPoint(, "输入点(右键或 E 结束)/S(设置):")
'**************出错设置**************
If Err <> 0 Then
If Err.Number = -2147352567 Then keywd = "": Err.Clear: GoTo bzxh
Err.Clear
keywd = ""
ThisDrawing.Utility.InitializeUserInput 0, "E S"
keywd = ThisDrawing.Utility.GetInput
If keywd = "s" Or keywd = "S" Then '进入窗口设置
youForm1.TextBox1.text = textXh
youForm1.TextBox4.text = textH
youForm1.TextBox2.text = textPre
youForm1.TextBox3.text = textSuf
youForm1.Show
textH = pubTexth
textXh = PubtextXh
textPre = PubtextPre
textSuf = PubtextSuf
GoTo bzxh
End If
If keywd = "e" Or keywd = "E" Or keywd = "" Then
GoTo en
End If
Err.Clear
GoTo bzxh
End If
'****************进行标注*************
youForm1.TextBox1.text = textXh
textCon = textPre + youForm1.TextBox1.text + textSuf
Set textobj = ThisDrawing.ModelSpace.AddText(textCon, varPnt, textH)
textobj.Alignment = acAlignmentMiddleCenter
textobj.TextAlignmentPoint = varPnt
textXh = textXh + 1
GoTo bzxh
'*************end************
en:
End Sub |
|