home *** CD-ROM | disk | FTP | other *** search
- Attribute VB_Name = "modSelNode"
- '******************************************************************'
- '* *'
- '* TurboCAD for Windows *'
- '* Copyright (c) 1993 - 2001 *'
- '* International Microcomputer Software, Inc. *'
- '* (IMSI) *'
- '* All rights reserved. *'
- '* *'
- '******************************************************************'
-
- Option Explicit
-
- Sub AddDrawingNodes(ByVal tvnodes As MSComctlLib.nodes, ByVal all As Boolean)
- On Error Resume Next
- Dim nod As Node
- Dim sel As Selection
- Dim grs As Graphics
- Dim gfc As Graphic
- Dim nodeName As String
-
- If all Then
- nodeName = "Drawing"
- Else
- nodeName = "Selection"
- End If
- With tvnodes
- .Clear
- Set nod = .Add(, , "R", nodeName)
- End With
- If all Then
- Set grs = ActiveDrawing.Graphics
- For Each gfc In grs
- AddGraphicInfoToNode tvnodes, gfc, "R", 0
- Next gfc
- Else
- Set sel = ActiveDrawing.Selection
- For Each gfc In sel
- AddGraphicInfoToNode tvnodes, gfc, "R", 0
- Next gfc
- End If
- End Sub
-
- Private Sub AddGraphicInfoToNode(ByVal tvnodes As MSComctlLib.nodes, ByVal gfc As Graphic, ByVal par As String, ByVal lvl As Integer)
- On Error Resume Next
- Dim i, count As Integer
- Dim s, n, v As String
- Dim kg, kv, kb, ki, kp As String
- Dim blk As IMSIGX.Block
- Dim nod As Node
-
- With tvnodes
- kg = "G" & gfc.ID
- n = gfc.Name
- If n = "" Then n = "<no name>"
- s = "<Err>"
- s = "Graphic ID " & gfc.ID & ", " & n & ": " & gfc.Type
- If gfc.Cosmetic Then s = s & " [Cosmetic]"
- Set nod = .Add(par, tvwChild, kg, s)
- s = "<Err>"
- s = gfc.RegenType
- Set nod = .Add(kg, tvwChild, , "Regen " & s)
- s = ""
- If gfc.Builtin Then s = s & "Bilt "
- If gfc.Closed Then s = s & "Clsd "
- If gfc.Cosmetic Then s = s & "Cosm "
- If gfc.Deleted Then s = s & "Dele "
- If gfc.Editable Then s = s & "Edit "
- If gfc.Unbounded Then s = s & "Ubnd "
- If gfc.Visible Then s = s & "Vis "
- Set nod = .Add(kg, tvwChild, , "Flags " & s)
-
- count = gfc.Vertices.count
- If count > 0 Then
- kv = kg & "V"
- Set nod = .Add(kg, tvwChild, kv, count & " Vertices")
- Dim vtx As Vertex
- For i = 0 To count - 1
- Set vtx = gfc.Vertices(i)
- ki = kv & i
- v = "Up"
- If vtx.PenDown Then v = "Down"
- Set nod = .Add(kv, tvwChild, ki, "V[" & i & "]: (" & vtx.x & ", " & vtx.y & ", " & vtx.z & ") [" & v & "]")
- s = ""
- If vtx.PenDown Then s = s & "Down " Else s = s & "Up "
- If vtx.Bulge Then s = s & "Blge "
- If vtx.Calculated Then s = s & "Calc "
- If vtx.Editable Then s = s & "Edit "
- If vtx.Linkable Then s = s & "Link "
- If vtx.Selectable Then s = s & "Sel "
- If vtx.Snappable Then s = s & "Snap "
- Set nod = .Add(ki, tvwChild, , "Flags " & s)
- Next i
- End If
-
- count = gfc.Properties.count
- If count > 0 Then
- kp = kg & "P"
- Set nod = .Add(kg, tvwChild, kp, count & " Properties")
- Dim prop As Property
- For i = 0 To count - 1
- Set prop = gfc.Properties(i)
- ki = kp & i
- s = "<Err>"
- s = prop.Name & ": " & PropertyValueAsString(prop)
- Set nod = .Add(kp, tvwChild, ki, s)
- Set nod = .Add(ki, tvwChild, , "Flags " & PropertyFlagsAsString(prop))
- Set nod = .Add(ki, tvwChild, , "Type " & PropertyTypeAsString(prop))
- Next i
- End If
-
- 'Sanity check
- If lvl > 4 Then Exit Sub
-
- Set blk = gfc.Block
- If Not blk Is Nothing Then
- kb = kg & "B"
- s = blk.Name
- Set nod = .Add(kg, tvwChild, kb, "Block: " & s)
- Set vtx = blk.Anchor
- Set nod = .Add(kb, tvwChild, , "Anchor: (" & vtx.x & ", " & vtx.y & ", " & vtx.z & ")")
- count = blk.Graphics.count
- If count > 0 Then
- ki = kg & "B-"
- Set nod = .Add(kb, tvwChild, ki, count & " Children")
- For i = 0 To count - 1
- AddGraphicInfoToNode tvnodes, blk.Graphics(i), ki, lvl + 1
- Next i
- End If
- End If
-
- count = gfc.Graphics.count
- If count > 0 Then
- ki = kg & "-"
- Set nod = .Add(kg, tvwChild, ki, count & " Children")
- For i = 0 To count - 1
- AddGraphicInfoToNode tvnodes, gfc.Graphics(i), ki, lvl + 1
- Next i
- End If
- End With
- End Sub
-
-