home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2002 March / PCWMAR02.iso / software / turbocad / v8trial / TurboCADv8ProfessionalNoReg.exe / Data.Cab / F41649_modPS.bas < prev    next >
Encoding:
BASIC Source File  |  2001-10-16  |  3.6 KB  |  127 lines

  1. Attribute VB_Name = "modPS"
  2. '******************************************************************'
  3. '*                                                                *'
  4. '*                      TurboCAD for Windows                      *'
  5. '*                   Copyright (c) 1993 - 2001                    *'
  6. '*             International Microcomputer Software, Inc.         *'
  7. '*                            (IMSI)                              *'
  8. '*                      All rights reserved.                      *'
  9. '*                                                                *'
  10. '******************************************************************'
  11.  
  12. Option Explicit
  13.  
  14. Sub EnumPaperSpaces()
  15.     On Error GoTo PSError
  16.     Dim pss As GXMPSLib.PaperSpaces
  17.     Dim ps As GXMPSLib.PaperSpace
  18.     Dim grs As Graphics
  19.     Dim gr As Graphic
  20.     Dim props As Properties
  21.     Dim prop As Property
  22.     Dim dwg As Drawing
  23.     Dim i, j As Integer
  24.     Dim dumpfile As String
  25.     
  26.     Set dwg = ActiveDrawing
  27.     Set pss = dwg
  28.     Debug.Print pss.count & " PaperSpaces"
  29.     On Error Resume Next
  30.     
  31.     'For Each does an infinite loop
  32.     'For Each ps In pss
  33.     For i = 0 To pss.count - 1
  34.         Set ps = pss(i)
  35.         Debug.Print "Name: " & ps.Name
  36.         With ps.RelativeOrigin
  37.             Debug.Print "RelativeOrigin: (" & .x & ", " & .y & ", " & .z & ")"
  38.         End With
  39.         
  40.         Set grs = ps.Graphics
  41.         Debug.Print grs.count & " Graphics"
  42.         For Each gr In grs
  43.             Debug.Print "Type: " & gr.Type
  44.         Next
  45.         
  46.         dumpfile = "d:\" & ps.Name & "_props.txt"
  47.         Open dumpfile For Output As #1
  48.         
  49.         ps.Activate
  50.         Print #1, "Print Space Properties ----------"
  51.         PrintPropertiesToFile ps.Properties
  52.         Print #1, "Drawing Properties ----------"
  53.         PrintPropertiesToFile ps.Properties
  54.         
  55.         Close #1
  56.         
  57.     Next
  58.     Exit Sub
  59.     
  60. PSError:
  61.     MsgBox "Error: " & Err.Description
  62. End Sub
  63.  
  64. Sub EnumGraphicsInAllSpaces()
  65.     On Error Resume Next
  66.     Dim mode As Integer
  67.     
  68.     mode = ActiveDrawing.Properties("TileMode")
  69.     ActiveDrawing.Properties("TileMode") = 1
  70.     Debug.Print "Model Space"
  71.     EnumGraphicsInCurrentSpace
  72.     ActiveDrawing.Properties("TileMode") = 0
  73.     Debug.Print "Paper Space"
  74.     EnumGraphicsInCurrentSpace
  75.     ActiveDrawing.Properties("TileMode") = mode
  76. End Sub
  77.  
  78. Sub EnumGraphicsInCurrentSpace()
  79.     On Error Resume Next
  80.     Dim m As Matrix
  81.     Dim i As Integer
  82.     Dim gr As Graphic
  83.     Dim grs As Graphics
  84.     Set grs = ActiveDrawing.Graphics
  85.     i = 0
  86.     For Each gr In grs
  87.         i = i + 1
  88.         Debug.Print i
  89.         Debug.Print gr.Type
  90.         Set m = Nothing
  91.         Set m = gr.UCS
  92.         If Not m Is Nothing Then
  93.             Debug.Print m
  94.         Else
  95.             Debug.Print "no UCS"
  96.         End If
  97.     Next
  98. End Sub
  99.  
  100. Sub DumpDrawingPropertiesBothSpaces()
  101.     On Error Resume Next
  102.     Open "J:\dwgprops.txt" For Output As #1
  103.     ActiveDrawing.Properties("TileMode") = 0
  104.     Print #1, "Tile Mode 0 ---------------"
  105.     DumpDrawingProperties
  106.     ActiveDrawing.Properties("TileMode") = 1
  107.     Print #1, "Tile Mode 1 ---------------"
  108.     DumpDrawingProperties
  109.     Close #1
  110. End Sub
  111.  
  112. Sub DumpDrawingProperties()
  113.     On Error Resume Next
  114.     Dim i, count As Integer
  115.     
  116.     count = ActiveDrawing.Properties.count
  117.     Print #1, count & " Properties:"
  118.     Dim prop As Property
  119.     i = 0
  120.     For Each prop In ActiveDrawing.Properties
  121.         i = i + 1
  122.         Print #1, i
  123.         DumpProperty prop
  124.     Next
  125. End Sub
  126.        
  127.