- UID
- 777355
- 积分
- 180
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2018-7-10
- 最后登录
- 1970-1-1
|
楼主 |
发表于 2019-1-2 15:34:48
|
显示全部楼层
为什么不是高亮显示
- ' 在模型空间中创建坐标标注。
- Public Sub pc_zb()
- On Error Resume Next
-
- Dim dimObj As AcadDimOrdinate
- Dim pT0 As Variant
- Dim pT As Variant
- Dim pTyd(0 To 2) As Double
- Dim pTs(0 To 2) As Double
- Dim pTe(0 To 2) As Double
- Dim fx As Boolean
-
- fx = True
- pTyd(0) = 0: pTyd(1) = 0: pTyd(2) = 0
- pT0 = ThisDrawing.Utility.GetPoint(, "坐标起点: ")
-
- Dim j_xxs As Double, j_yxs As Double, j_wzxs As Boolean
- j_wzxs = True
- '获取标注的全局比例
- Dim RetVal As Variant
- RetVal = ThisDrawing.GetVariable("dimscale")
- j_xxs = 0: j_yxs = RetVal * 10
-
- ' 在模型空间中创建起点坐标标注
- pTs(0) = 0: pTs(1) = 0: pTs(2) = 0
- pTe(0) = j_xxs: pTe(1) = j_yxs: pTe(2) = 0
- Set dimObj = ThisDrawing.ModelSpace.AddDimOrdinate(pTs, pTe, fx)
- dimObj.Layer = "标注"
- dimObj.Move pTyd, pT0
-
- '设置关键字
- ThisDrawing.Utility.InitializeUserInput 1, "X Y T"
- Do
- pT = ThisDrawing.Utility.GetPoint(pT0, "[X]标注X坐标,[Y]标注Y坐标,[T]变换文字位置,选取下一点: ")
- If Err Then
- If InStr(1, Err.Description, "关键字", vbTextCompare) > 0 Or _
- InStr(1, Err.Description, "keyword", vbTextCompare) > 0 Then '输入了一个关键字
- Dim inputString As String
- Err.Clear
- inputString = ThisDrawing.Utility.GetInput
- Select Case inputString
- Case "X"
- fx = True
- If j_wzxs Then
- j_xxs = 0: j_yxs = RetVal * 10
- Else
- j_xxs = 0: j_yxs = 0 - RetVal * 10
- End If
- Case "Y"
- fx = False
- If j_wzxs Then
- j_xxs = RetVal * 10: j_yxs = 0
- Else
- j_xxs = 0 - RetVal * 10: j_yxs = 0
- End If
- Case "T"
- j_wzxs = Not j_wzxs
- j_xxs = 0 - j_xxs: j_yxs = 0 - j_yxs
- End Select
- Else
- Err.Clear
- Exit Sub '错误退出
- End If
- Else
- pTs(0) = pT(0) - pT0(0): pTs(1) = pT(1) - pT0(1): pTs(2) = 0
- pTe(0) = pTs(0) + j_xxs: pTe(1) = pTs(1) + j_yxs: pTe(2) = 0
- Set dimObj = ThisDrawing.ModelSpace.AddDimOrdinate(pTs, pTe, fx)
- dimObj.Layer = "标注"
- dimObj.Move pTyd, pT0
- End If
- Loop
- End Sub
|
|