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

  1. Attribute VB_Name = "modRadDimTie"
  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 RadDiaCon()
  15. Dim ActDr As Drawing
  16. Dim Grs As Graphics
  17. Dim Vi As View
  18. Dim GrDim As Graphic
  19.     
  20.     Set ActDr = ActiveDrawing
  21.     Set Grs = ActDr.Graphics
  22.     Set Vi = ActDr.ActiveView
  23.  
  24. Dim xCl#, yCl#
  25.     Vi.GetMouseClick xCl, yCl
  26. Dim PRes As PickResult
  27.     Set PRes = Vi.PickPoint(xCl, yCl)
  28. Dim PicCount As Long, i As Long
  29.     PicCount = PRes.Count
  30.     If PicCount = 0 Then
  31.         Exit Sub
  32.     End If
  33. Dim GrType$
  34. Dim GrDimExist As Boolean
  35.     GrDimExist = False
  36.     For i = 0 To PicCount - 1
  37.         Set GrDim = PRes(i).Graphic
  38.         GrType = GrDim.Type
  39.         If GrType = "TCW25DimRad" Or GrType = "TCW25DimDia" Then
  40.             GrDimExist = True
  41.             Exit For
  42.         End If
  43.     Next i
  44.     
  45.     If GrDimExist = False Then Exit Sub
  46.     
  47. Dim x1Dim#, y1Dim#
  48.     With GrDim.Vertices
  49.         x1Dim = .Item(1).X
  50.         y1Dim = .Item(1).Y
  51.     End With
  52. Dim x1DimV#, y1DimV#
  53.     Vi.WorldToView x1Dim, y1Dim, 0, x1DimV, y1DimV, 0
  54.     Set PRes = Vi.PickPoint(x1DimV, y1DimV)
  55.     PicCount = PRes.Count
  56.     If PicCount = 0 Then Exit Sub
  57.     
  58. Dim GrCon As Graphic
  59. Dim GrConExist As Boolean
  60.     GrConExist = False
  61.     For i = 0 To PicCount - 1
  62.         Set GrCon = PRes(i).Graphic
  63.         GrType = GrCon.Type
  64.         If GrType = "ARC" Or GrType = "CIRCLE" Or GrType = "TCW50Polyline" Then
  65.             GrConExist = True
  66.             Exit For
  67.         End If
  68.     Next i
  69.     
  70.     If GrConExist = False Then Exit Sub
  71. Dim TSets As TieSets
  72.     Set TSets = ActDr.TieSets
  73.     TSets.Add "RadDia.DimTie", GrCon, GrDim, 0, 0
  74.  
  75. End Sub
  76.