明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 730|回复: 0

程序运行时卡顿现象很严重

[复制链接]
发表于 2019-1-24 12:01 | 显示全部楼层 |阅读模式
以下是程序源码,在执行的时候CAD卡顿现象很严重。比如块(见附件)比较多情况下,选择块进行复制或其他操作是都比较卡顿,选中进行下一步操作都会卡顿几秒,已测试是该程序问题。还有该程序会导致保存卡顿,请大神们看下问题在哪,给修改下 。谢谢!

Private Sub AcadDocument_SelectionChanged()
On Error Resume Next
Dim EqINFO As Variant

Dim xtypeout As Variant
Dim xdataout As Variant


Dim ELE As AcadBlockReference
Dim EQ_BLOCK_DATA As Variant       '¿éÄúêôDÔ¼ˉoÏ
Dim EqName_att As AcadAttributeReference  'êôDÔ
Dim EqId_att As AcadAttributeReference    '
Dim EQ_BLOCK_entity As AcadEntity         '¿éÄúμÄêμìå
Dim pline As AcadLWPolyline            '¿éÄú¶à¶ÎÏß

Set ELE = PickfirstSelectionSet.Item(0)
Dim a(2), b(2) As Variant
Dim c(2), d(2) As Variant

           If ELE.HasAttributes Then EQ_BLOCK_DATA = ELE.GetAttributes
            Set EqName_att = EQ_BLOCK_DATA(1)      'μÃμ½êôDÔ¶ÔÏó
            Set EqId_att = EQ_BLOCK_DATA(0)
            'MsgBox EqName_att.MTextAttribute
            'End If

      With EqName_att
     a(0) = .InsertionPoint(0)      '2åèëμãX×ø±ê
     a(1) = .InsertionPoint(1)      '2åèëμãY×ø±ê
     b(0) = .TextAlignmentPoint(0)  '¶ÔÆëμãX×ø±ê,ÖD¼ä¶ÔÆë
     b(1) = .TextAlignmentPoint(1)  '¶ÔÆëμãY×ø±ê£¬ÖD¼ä¶ÔÆë
     End With

      With EqId_att
     c(0) = .InsertionPoint(0)      '2åèëμãX×ø±ê
     c(1) = .InsertionPoint(1)      '2åèëμãY×ø±ê
     d(0) = .TextAlignmentPoint(0)  '¶ÔÆëμãX×ø±ê,ÖD¼ä¶ÔÆë
     d(1) = .TextAlignmentPoint(1)  '¶ÔÆëμãY×ø±ê£¬ÖD¼ä¶ÔÆë
     End With

     Dim S_DATA, S_data1, S_data2
       S_data1 = (b(0) - a(0)) * 2
        'MsgBox S_DATA
       S_data2 = (d(0) - c(0)) * 2
       'MsgBox S_data1 & "," & S_data2
       If S_data1 < S_data2 Then
         S_DATA = S_data2
    ElseIf S_data1 > S_data2 Then
          S_DATA = S_data1
    End If


Dim dybprop As Variant
Dim i



    If ELE.IsDynamicBlock Then

     dybprop = ELE.GetDynamicBlockProperties

       For i = LBound(dybprop) To UBound(dybprop) 'Goes through Results

                    If dybprop(i).PropertyName = "eqline" Then 'Looks for the PropertyName
                    dybprop(i).Value = S_DATA     'Change the Value of the PropertyName

                    End If

       Next i
       End If



End Sub


本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

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

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-3-29 03:33 , Processed in 0.174190 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表