通过选定整个目录中的图形文件插入到图形中的过程(zt)

通过选定整个目录中的图形文件插入到图形中的过程
Sub IntBlkByDirDwg()
On Error GoTo Err_Control
Dim BlkFile As Variant
Dim i As Integer
Dim InstPnt As Variant
Dim BlkRefObj As AcadBlockReference
Dim varCancel As Variant

BlkFile = GetDir("选择要插入图形所在的目录:", "*.dwg")

If IsArray(BlkFile) Then
    ThisDrawing.Utility.Prompt vbCrLf & " 你选定了" & Str(UBound(BlkFile) + 1) & "个图形"
    For i = 0 To UBound(BlkFile)
        
        InstPnt = ThisDrawing.Utility.GetPoint(, vbCrLf & " 请选择图形 " & JustFileName(BlkFile(i)) & " 的插入点:")
        Set BlkRefObj = ThisDrawing.ModelSpace.InsertBlock(InstPnt, _
                        BlkFile(i), 1#, 1#, 1#, 0#)
    Next

End If

Exit_Here:
  Exit Sub
Err_Control:
  Select Case Err.Number
    Case -2147352567
      varCancel = ThisDrawing.GetVariable("LASTPROMPT")
      If InStr(1, varCancel, "*Cancel*") <> 0 And InStr(1, varCancel, "*取消*") <> 0 Then
        Err.Clear
        Resume Exit_Here
      Else
        Err.Clear
        Resume
      End If
    Case -2145320928
      Err.Clear
      Resume Exit_Here
    Case Else
      Resume Exit_Here
  End Select

End Sub

'返回指定目录下指定名称所有文件的函数
Function GetFileListByPath(Path As String, FileName As String) As Variant

    Dim s As String
    Dim sFiles() As String
    Dim i As Integer
    s = Dir(Path & FileName)
    If s <> "" Then
     ReDim sFiles(i) As String
     sFiles(i) = Path & s
     i = 1
     s = Dir()
     While s <> ""
        ReDim Preserve sFiles(i) As String
        sFiles(i) = Path & s
        i = i + 1
        s = Dir()
     Wend
     GetFileListByPath = sFiles
    End If
    
End Function

'选定目录的函数,使用了commonDialog类
Public Function GetDir(DialogTitle As String, FileName As String) As Variant

Dim dlg As CommonDialog
Dim Path As String
Dim FileList As Variant

Set dlg = New CommonDialog
    dlg.DialogTitle = DialogTitle
    If dlg.Browse Then
        Path = dlg.Path
        If Path <> "" Then
            Path = Left$(Path, InStr(Path, vbNullChar) - 1)
            If Right$(Path, 1) <> "/" Then Path = Path & "/"
            FileList = GetFileListByPath(Path, "*.dwg")
            GetDir = FileList
        End If
    End If
        

End Function

'由文件全路径名称返回文件的函数
Public Function JustFileName(FileName) As String
On Error Resume Next
Dim count As Integer
For count = Len(FileName) - 1 To 1 Step -1
    If Mid(FileName, count, 1) = "/" Or Mid(FileName, count, 1) = "/" Then
        JustFileName = Right(FileName, Len(FileName) - count)
        Exit For
    End If
Next
End Function

内容概要:本文档是一份计算机软考初级程序员的经典面试题汇编,涵盖了面向对象编程的四大特征(抽象、继承、封装、多态),并详细探讨了Java编程中的诸多核心概念,如基本数据类型与引用类型的区别、StringStringBuffer的差异、异常处理机制、Servlet的生命周期及其与CGI的区别、集合框架中ArrayList、Vector和LinkedList的特性对比、EJB的实现技术及其不同Bean类型的区别、Collection和Collections的差异、final、finally和finalize的作用、线程同步与异步的区别、抽象类和接口的区别、垃圾回收机制、JSP和Servlet的工作原理及其异同等。此外,还介绍了WebLogic服务器的相关配置、EJB的激活机制、J2EE平台的构成和服务、常见的设计模式(如工厂模式)、Web容器和EJB容器的功能、JNDI、JMS、JTA等J2EE核心技术的概念。 适合人群:正在备考计算机软考初级程序员的考生,或希望加深对Java编程及Web开发理解的初、中级开发人员。 使用场景及目标:①帮助考生系统复习Java编程语言的基础知识和高级特性;②为实际项目开发提供理论指导,提升编程技能;③为面试准备提供参考,帮助求职者更好地应对技术面试。 其他说明:文档不仅涉及Java编程语言的核心知识点,还包括了Web开发、企业级应用开发等方面的技术要点,旨在全面提高读者的专业素养和技术水平。文档内容详实,适合有一定编程基础的学习者深入学习和研究。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值