Chinaunix首页 | 论坛 | 博客
  • 博客访问: 735373
  • 博文数量: 769
  • 博客积分: 6000
  • 博客等级: 准将
  • 技术积分: 4985
  • 用 户 组: 普通用户
  • 注册时间: 2008-10-15 16:37
文章分类

全部博文(769)

文章存档

2011年(1)

2008年(768)

我的朋友

分类:

2008-10-15 16:40:27

    花了一下午完成了一个初步的示范的例子,看来解决图纸统一管理有了解决的办法了.下一步用jacob封装在中调用,在上控制打印管理.做个记号再慢慢完善.

    '取得当前文档对象(vba中的方法,如果是在VB中时需要从顶层对象开始引用取得)
    Dim currentDoc As AcadDocument
    Set currentDoc = ThisDrawing

    '文档的模型空间
    Dim sp As AcadModelSpace
    Set sp = currentDoc.modelspace

    '取得模型空间中的块属性
    Dim index As Integer
    For index = 0 To sp.Count - 1
        Dim name As String
        name = sp.Item(index).ObjectName

        '判断模型空间中的项目是否是一个块引用
        If name Like "*Ac*" Then

            Dim blockRef As AcadBlockReference
            Set blockRef = sp.Item(index)

            '块引用的插入点
            Dim insertPoint As Variant
            insertPoint = blockRef.InsertionPoint

            '放大比例
            Dim xScale, yScale As Integer
            xScale = blockRef.XScaleFactor
            yScale = blockRef.YScaleFactor


            '宽高基数
            Dim width, height As Double
            width = 297
            height = 210

            '打印区域
            Dim UpperRight(0 To 1) As Double, LowerLeft(0 To 1) As Double
            UpperRight(0) = insertPoint(0)
            UpperRight(1) = insertPoint(1)
            LowerLeft(0) = insertPoint(0) + width * xScale
            LowerLeft(1) = insertPoint(1) - height * yScale

 

[1]  

【责编:landy】

--------------------next---------------------

阅读(524) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~