home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
BUG 11
/
BUGCD1998_02.ISO
/
aplic
/
turbocad
/
tcw.z
/
getpoint.bas
< prev
next >
Wrap
BASIC Source File
|
1997-05-05
|
2KB
|
68 lines
'Program that shows how to use TCWGetPoint, TCWVertexFindVertex
'The program will create a dimension
sub main()
Dim v1 As Long
Dim v2 As Long
Dim v3 As Long
Dim res as long
Dim s as String
Dim g As Long
Dim vd As Long
'Create three vertices with 0 XYZ values
v1 = TCWVertexCreate(0,0,0)
v2 = TCWVertexCreate(0,0,0)
v3 = TCWVertexCreate(0,0,0)
'Get user to input first end point
'we are using snap mode SNAP_ANYPOINT, and a cross cursor
res = tcwgetpoint(v1, "Dimension : First End Point", NULL, NULL, &h00FC, 2)
'if success then continue
if (res = 0) Then
' snap to the nearest point
res = TCWVertexFindVertex(v1, &h00FC)
' create a line for dragging
g = TCWLineSingle(TCWGetX(v1), TCWGetY(v1), TCWGetZ(v1), _
TCWGetX(v1), TCWGetY(v1), TCWGetZ(v1))
' flush the redraw que to force the above line to draw
vd = TCWVertexAt(g, 1)
res = tcwgetpoint(v2, "Dimension : Second End Point", g, vd, &h00FC, 2)
' remove the TCWLineSingle
TCWUndo 1
if (res = 0) Then
' snap to the nearest point
res = TCWVertexFindVertex(v2, &h00FC)
TCWSetXYZ v3, TCWGetX(v2), TCWGetY(v2), TCWGetZ(v2)
g = TCWDimensionHorizontal(TCWGetX(v1), TCWGetY(v1), TCWGetZ(v1), _
TCWGetX(v2), TCWGetY(v2), TCWGetZ(v2), _
TCWGetX(v3), TCWGetY(v3), TCWGetZ(v3))
' the fourth vertex in a linear dimension is the one which
' defines the position of the dimension line
vd = TCWVertexAt(g, 3)
res = tcwgetpoint(v3, "Dimension : Dimension Line Point", g, vd, 2)
if (res = 0) Then
TCWGraphicDraw g, 0
Else
TCWGraphicDispose g
End If
end if
end if
'Delete the vertices that didn't get added to any graphics or drawing
TCWVertexDispose v1
TCWVertexDispose v2
TCWVertexDispose v3
end sub