乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
查看: 102|回复: 5

[求助]请帮我看一下这段程序

[复制链接]

11

主题

39

帖子

8

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
83
发表于 2003-5-18 12:56:00 | 显示全部楼层 |阅读模式
Sub lc()
Dim ss As AcadSelectionSet
Set ss = GetSelSet
Dim ent As AcadEntity
Dim lc As Double
Dim SF As Double
Dim tx As String
Dim sa As Boolean
Dim i As Integer
i = 0
sa = False
Dim Obj As AcadEntity
For Each ent In ss
If TypeOf ent Is AcadEntity Then
i = i + 1
Set Obj = ent
If sa = False Then
SF = Obj.LinetypeScale
On Error GoTo errtap
lc = ThisDrawing.Utility.GetReal("输入新的线型比例:")
If i = 1 Then
ThisDrawing.Utility.InitializeUserInput 0, "Y N"
If Err Or tx = "" Then
tx = "Y"
End If
If tx = "Y" Then
sa = True
End If
End If
End If
ent.LinetypeScale = lc
End If
Next
errtap: Exit Sub
End Sub
Function GetSelSet() As AcadSelectionSet
Dim ss As AcadSelectionSet
Set ss = ThisDrawing.PickfirstSelectionSet
On Error Resume Next
If ss.Count = 0 Then
Dim ssName As String
ssName = "strSSet"
On Error Resume Next
Set ss = ThisDrawing.SelectionSets(ssName)
If Err Then Set ss = ThisDrawing.SelectionSets.add(ssName)
ss.Clear
ss.SelectOnScreen
End If
Set GetSelSet = ss
End Function
问题如下:1.在使用过程中会自动修改filedia的变量值为“0”
2.在使用一定时间后程序就不在起作用,这是最烦人的地方
3.目前只能是先执行程序在选择对象,请问怎样同时做到先选择后执行程序
回复

使用道具 举报

158

主题

2315

帖子

10

银币

顶梁支柱

Rank: 50Rank: 50

铜币
2951
发表于 2003-5-19 19:47:00 | 显示全部楼层
不起作用是指程序不运行还是运行了不起效果,说详细点。
对于先选择后操作,你可以在二次开发栏目中找到答案:
有关PickfirstSelectionSet方法的讨论
http://www.mjtd.com/a2/list.asp?id=434
回复

使用道具 举报

11

主题

39

帖子

8

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
83
发表于 2003-5-19 21:27:00 | 显示全部楼层

是程序运行了不起效果,打开一个文件当执行几次以后就会出现程序仍运行但没有效果的现象。
回复

使用道具 举报

11

主题

39

帖子

8

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
83
发表于 2003-5-20 18:12:00 | 显示全部楼层
今天找到了程序运行中失效的一个问题,就是在一个文档中操作时,如果此时执行open命令,并取消打开文档,然后在运行本程序就会产生只选择而无法执行更改线形比例的程序代码。
回复

使用道具 举报

158

主题

2315

帖子

10

银币

顶梁支柱

Rank: 50Rank: 50

铜币
2951
发表于 2003-5-20 20:08:00 | 显示全部楼层
Function GetSelSet() As AcadSelectionSet
    Dim ss As AcadSelectionSet
    Dim ssName As String
    ssName = &quotICKFIRST"
    On Error Resume Next
    Set ss = ThisDrawing.SelectionSets.Add(ssName)
    If Err Then
        Set ss = ThisDrawing.SelectionSets(ssName)
        ss.Delete
    End If
    Set ss = ThisDrawing.PickfirstSelectionSet
    If ss.Count = 0 Then
        Set ss = ThisDrawing.SelectionSets(ssName)
        If Err Then Set ss = ThisDrawing.SelectionSets.Add(ssName)
        ss.Clear
        ss.SelectOnScreen
    End If
    Set GetSelSet = ss
End Function
回复

使用道具 举报

11

主题

39

帖子

8

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
83
发表于 2003-5-20 22:48:00 | 显示全部楼层
真是太感谢了,明天去办公室调试。
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-3-13 16:43 , Processed in 0.714236 second(s), 75 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表