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

  1. 'Script to create CoordText Turbo Shape and add it to a TurboCAD drawing
  2. Global Const gkGRAPHIC = &H0B
  3. Global Const cartesian = 2
  4. sub Main()
  5.     Dim g As Long
  6.     Dim r As Long
  7.     Dim v As Long
  8.     
  9.     Dim e As String    
  10.  
  11.     'Create a graphic with kind = gkGraphic and Regen Method
  12.     'CoordText.TCWCoordText.  TCWGraphicCreate will cause OnNewGraphic
  13.     'to be called
  14.     g = TCWGraphicCreate(gkGraphic, "CoordText.TCWCoordText")
  15.  
  16.     'if we got an error, display error message and stop
  17.     if (TCWLastErrorGet(e) <> 0) Then
  18.         msgbox e
  19.         stop
  20.     end if
  21.  
  22.     'Need up update properties to get RegenGraphic to be called
  23.     e = TCWGraphicPropertySet(g, "CoordType", cartesian)    
  24.     
  25.     if (TCWLastErrorGet(e) <> 0) Then
  26.         msgbox e
  27.     end if
  28.  
  29.     'Let's change the color of our CoordText shape as well
  30.     e = TCWGraphicPropertySet(g, "PenColor", &H000000FF)
  31.  
  32.     if (TCWLastErrorGet(e) <> 0) Then
  33.         msgbox e
  34.     end if
  35.  
  36.     'Add the graphic to the drawing    
  37.     TCWGraphicAppend 0, g
  38.  
  39.     if (TCWLastErrorGet(e) <> 0) Then
  40.         msgbox e
  41.     end if
  42.  
  43.     'Force the graphic to be drawn on the drawing
  44.     TCWGraphicDraw g, 0
  45.     if (TCWLastErrorGet(e) <> 0) Then
  46.         msgbox e
  47.     end if
  48. end Sub
  49.  
  50.