明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1393|回复: 4

[求助]请高手帮忙调试一下

[复制链接]
发表于 2006-12-14 09:28:00 | 显示全部楼层 |阅读模式
提示: 作者被禁止或删除 内容自动屏蔽
发表于 2006-12-14 11:40:00 | 显示全部楼层
没看到程序啊
 楼主| 发表于 2006-12-14 14:38:00 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
发表于 2006-12-15 09:23:00 | 显示全部楼层
本帖最后由 作者 于 2006-12-15 9:35:54 编辑

为什么我看不到啊。呵呵

要引用了下再看的到啊。

你的程序好像只能生成单张的啊。没有写循环啊。

 可以看下我的程序,写的比较乱啊

根据图中图块名存成不同的文件

Sub Example_Select_text()
   
    Dim ssetObj As AcadSelectionSet
    Dim CONUT As Integer
    CONUT = 0
    Count = ThisDrawing.SelectionSets.Count
     For I = 0 To Count - 1 '删除所有的选择集
    Set ssetObj = ThisDrawing.SelectionSets.Item(0)
      ssetObj.Delete
    Next I
  
   Dim sjx, dmx As AcadSelectionSet
 
   
   Dim FilterType(1) As Integer
   Dim FilterData(1) As Variant
   Set sjx = ThisDrawing.SelectionSets.Add("sjx")
   Set dmx = ThisDrawing.SelectionSets.Add("dmx")

   FilterType(0) = 2
   FilterData(0) = "TK" '是块名

   'FilterType(1) = 62
   'FilterData(1) = 10  '颜色是3

   FilterType(1) = 8
   FilterData(1) = "0"  '图层是0
  
   Dim mode As Integer
  Dim doc2 As AcadDocument
 Set doc2 = ThisDrawing.ModelSpace.Document
 
 mode = acSelectionSetAll
 'sjx.Select mode, , , FilterType, FilterData
  sjx.SelectOnScreen FilterType, FilterData '得到图框
    Dim newvarAttributes, inpoint, entry1 As Variant
    Dim ss, sss, ssss As String
    Dim sjxcount As Integer
    sjxcount = sjx.Count
    
     Dim templateFileName As String
   Dim DOC1 As AcadDocument
    ReDim objects(sjxcount - 1) As AcadEntity
      Dim retObjects As Variant
    Dim minExt As Variant
     Dim maxExt As Variant

  
 
     For Each ENTRY In sjx

     newvarAttributes = ENTRY.GetAttributes '得到图框块的属性,即图名图号页码
   
     ENTRY.GetBoundingBox minExt, maxExt '得到图框的最大最小坐标
     mode = acSelectionSetWindow 'acSelectionSetPrevious 'acSelectionSetCrossing
     ThisDrawing.Application.ZoomWindow minExt, maxExt
    
     dmx.Select mode, minExt, maxExt '选择图框内的对象
    
     ReDim objects(dmx.Count - 1) As AcadEntity
        I = 0
      For Each entry1 In dmx
      Set objects(I) = entry1
      I = I + 1
      Next entry1
      Set DOC1 = Documents.Add
     doc2.CopyObjects objects, DOC1.ModelSpace '拷贝对象到新文件中
     ThisDrawing.Application.ZoomWindow minExt, maxExt
   
   DOC1.SaveAs doc2.Path & "\" & newvarAttributes(1).TextString & "(" & newvarAttributes(2).TextString & ")" & newvarAttributes(0).TextString
     DOC1.Close
    
     dmx.Clear
     Next ENTRY
   

 
 
End Sub

 楼主| 发表于 2006-12-15 17:46:00 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-11-26 22:49 , Processed in 0.192414 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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