TurboCAD 4.0 Scripting API


APPLICATION

Miscellaneous Functions

TCWAppExit

TCWActiveWindow

TCWBasicRun

TCWBasicDebug

Error Functions

TCWLastErrorGet

TCWClearError

Get and Set Property Functions

TCWAppPropertyGet

TCWAppPropertySet

Drawing Management Functions

TCWDrawingNew

TCWDrawingOpen

TCWDrawingClose

TCWDrawingSave

TCWDrawingSaveAs

TCWDrawingName

TCWDrawingAt

TCWDrawingCount

TCWDrawingPrint

TCWDrawingActive

Undo and Redo Functions

TCWUndoClear

TCWUndo

TCWRedo


DRAWING

Selection Functions

TCWSelectAll

TCWDeselectAll

TCWClearSelection

TCWClearAll

TCWClearAllConstructions

TCWSelectByQuery

TCWSelectionCount

TCWSelectionAt

Construction Line Creation Functions

TCWConstructionAngularLine

TCWConstructionHorizontalLine

TCWConstructionVerticalLine

TCWConstructionCenterAndPointCircle

TCWConstructionDoublePointCircle

TCWConstructionTriplePointCircle

Point Creation Functions

TCWDot

TCWStar

TCWSquare

TCWCross

TCWCircle

Line Creation Functions

TCWLineSingle

TCWLinePolygon

TCWLineRectangle

TCWLineRotatedRectangle

TCWLinePerpendicular

TCWLineParallel

Multi-line Creation Functions

TCWLineMultiline

TCWLineIrregularPolygon

TCWDoubleLineMultiline

TCWDoubleLineIrregularPolygon

TCWCurveBezier

TCWCurveSpline

Double Line Creation Functions

TCWDoubleLineSingle

TCWDoubleLinePolygon

TCWDoubleLineRectangle

TCWDoubleLineRotatedRectangle

TCWDoubleLinePerpendicular

TCWDoubleLineParallel

Circle and Ellipse Creation Functions

TCWCircleCenterAndPoint

TCWCircleDoublePoint

TCWCircleTriplePoint

TCWEllipse

TCWEllipseRotatedEllipse

TCWEllipseFixedRatio

Arc Creation Functions

TCWArcCenterAndPoint

TCWArcDoublePoint

TCWArcTriplePoint

TCWArcElliptical

TCWArcRotatedElliptical

TCWArcEllipticalFixedRatio

Text Creation Function

TCWText

Dimension Creation Functions

TCWDimensionHorizontal

TCWDimensionHorizontalEntity

TCWDimensionVertical

TCWDimensionVerticalEntity

TCWDimensionParallel

TCWDimensionParallelEntity

Undo Record Functions

TCWUndoRecordStart

TCWUndoRecordAddGraphic

TCWUndoRecordEnd

Block Functions

TCWBlockGet

TCWBlockCreate

TCWBlockInsert

Get and Set Property Functions

TCWDrawingPropertyGet

TCWDrawingPropertySet


GRAPHICS

Graphic Functions

TCWGraphicCount

TCWGraphicAt

TCWGraphicAppend

TCWGraphicXYZAdd

TCWGraphicClose

TCWGraphicVertexAdd

TCWVertexAppend

TCWGraphicCopy

TCWGraphicDispose

TCWGraphicCreate

TCWGraphicDraw

TCWGraphicHandleFromID

TCWGraphicReferencePointSet

TCWGraphicReferencePointGet

Selection Manipulation Functions

TCWSelectionScale

TCWSelectionMove

TCWSelectionRotate

TCWCreateHatch

TCWGroupCreate

TCWExplode

TCWBringtoFront

TCWSendtoBack

TCWAlignBottom

TCWAlignTop

TCWAlignMiddle

TCWAlignLeft

TCWAlignRight

TCWAlignCenter

Get and Set Property Functions

TCWGraphicPropertyGet

TCWGraphicPropertySet

Vertex Functions

TCWVertexCount

TCWVertexAt

TCWVertexCreate

TCWVertexZero

TCWVertexCopy

TCWVertexDispose

TCWGetX

TCWSetX

TCWGetY

TCWSetY

TCWGetZ

TCWSetZ

TCWSetXY

TCWSetXYZ

TCWPenDown


VIEW

Functions

TCWViewAt

TCWViewCount

TCWViewActive

TCWViewRedraw

TCWViewUpdateWindow

TCWViewZoom

TCWViewZoomIn

TCWViewZoomOut

TCWViewZoomPage

TCWViewZoomExtents

TCWViewZoomWindow

TCWViewExtentsGetX1

TCWViewExtentsGetY1

TCWViewExtentsGetZ1

TCWViewExtentsGetX2

TCWViewExtentsGetY2

TCWViewExtentsGetZ2


LAYERS

Management Functions

TCWLayersCount

TCWLayersAt

TCWLayerCreate

TCWLayerDispose

Get and Set Property Functions

TCWLayerPropertyGet

TCWLayerPropertySet


FILE I/O

Functions

TCWOpenInput

TCWReadInputToken

TCWReadInput

TCWCloseInput

TCWOpenOutput

TCWWriteOutput

TCWCloseOutput


SCREEN

Mouse to Point Functions

TCWGetPoint

TCWVertexFindVertex

TCWVertexFindGraphic



APPLICATION - Miscellaneous Functions


TCWAppExit

This function will shutdown the application and exit. All open drawings
will be closed before exiting. If any drawings have been changed, you will
be prompted to save them before exiting.

Input Parameters

None

Return Value

None

See Also

Example

TCWAppExit


TCWActiveWindow

This function will return the active window handle. The active window is
the currently active drawing window.

Input Parameters

None

Return Value

The handle of window as a long.

See Also

Example

Dim hWindow As Long
hWindow = TCWActiveWindow()
...


TCWBasicRun

This function will launch an Enable Basic statement (passed as a String)
or load and execute an Enable basic file (if the string ends with ".bas").

Input Parameters

String scriptA statement in Enable Basic or the name of an Enable Basic file

Return Value

None

See Also

TCWBasicDebug

Example

TCWBasicRun "MsgBox" + Chr(34) + "Hello World!" + Chr(34)
TCWBasicRun "test.bas"


TCWBasicDebug

This function will launch the Enable debugger with an Enable Basic statement
(passed as a String) or load an Enable basic file (if the string ends with ".bas") into
the debugger.

Input Parameters

String script A statement in Enable Basic or the name of an Enable Basic file

Return Value

None

See Also

TCWBasicRun

Example

TCWBasicDebug "MsgBox" + Chr(34) + "Hello World!" + Chr(34)
TCWBasicDebug "test.bas"


APPLICATION - Error Functions


TCWLastErrorGet

This function will return a string for the last error that occurred in the script.

The script is responsible for checking for errors after making TCADAPI calls.
If the API call was supposed to return a handle to drawing, graphic, ...
you should check for NULL and call TCWLastErrorGet if true. If a non-null handle
was returned, then the call succeeded and you don't need to check for errors.
For Api calls that return status, 0 signifies success. Non-zero status signifies failure
and you should call TCWLastErrorGet to get the error text.

Input Parameters

String errorstringBuffer to return error string in

Return Value

Error string in string passed to the function. Function returns 0 is successful and non-zero if
their was no error to retrieve.

See Also

TCWClearError

Example

Dim result As Long
Dim errtext As String
Dim gCircle As Long
...
gCircle = TCWCircleCenterAndPoint(xc, yc, zc, xp, yp, zp)
if (gCircle = NULL) then
result = TCWLastErrorGet (errtext)
MsgBox errtext
'Terminate the program
Stop
end if
...


TCWClearError

This function will clear the error info in TCADAPI. You can use this function after
you've checked the previous TCADAPI function status. TCADAPI will clear
the error information structure at the beginning of each API function so previous
errors will be lost if you don't use TCWLastErrorGet.

Input Parameters

None

Return Value

None

See Also

Example

...
TCWClearError


APPLICATION - Get and Set Property Functions


TCWAppPropertyGet

This function will return the value of the property that has been
requested. This function is written in Basic due to problems with Enable
not supporting Variants with DLLs.

Input Parameters

String propertyname name of property look up
AVAILABLE PROPERTIES: DESCRIPTION:
"ColorButtons" buttons are color or black and white
"EditBar" viewing of the EditBar
"LargeButtons" buttons are large or small
"Organization" organization name
"OpenReadOnly" open files as read only
"PromptForSummaryInfo" promptingfor summary information on save
"Rulers" viewing of Rulers
"ScrollBars" viewing of Scroll Bars
"StatusBar" viewing of Status Bar
"ShowTooltips" show tool tips
"SaveDesktopOnExit" save desktop settings on exit
"UserName" username
"ZoomFactor" what factor to zoom when zooming in/out

Return Value

Value of property requested.
AVAILABLE PROPERTIES: VALUE RETURNED:
"ColorButtons" -1 if color buttons set, 0 if not set
"EditBar" -1 if displayed, 0 if not displayed
"LargeButtons" -1 large buttons is set, 0 if not set
"Organization" organization name as a string
"OpenReadOnly" -1 if set, 0 if not set
"PromptForSummaryInfo" -1if set, 0 if not set
"Rulers" -1 if displayed, 0 if not displayed
"ScrollBars" -1 if displayed, 0 if not displayed
"StatusBar" -1 if displayed, 0 if not displayed
"ShowTooltips" -1 if displayed, 0 if not displayed
"SaveDesktopOnExit" -1 if set, 0 if not set
"UserName" username as a string
"ZoomFactor" the zoom factor as a double

See Also

TCWAppPropertySet

Example


zoomValue = TCWAppPropertyGet("ZoomFactor")


TCWAppPropertySet

This function will set the property with the specified value.

Input Parameters

String propertyname name of property to modify
Variant value value to set to
AVAILABLE PROPERTIES: VALUE:
"ColorButtons" 1 if color, 0 if black and white (Integer)
"EditBar" 1 if displayed, 0 if not displayed (Integer)
"LargeButtons" 1 if large buttons, 0 if small (Integer)
"Organization" organization name (String)
"OpenReadOnly" 1 if read only, 0 if not (Integer)
"PromptForSummaryInfo" 1if prompt, 0 if no prompt (Integer)
"Rulers" 1 if displayed, 0 if not (Integer)
"ScrollBars" 1 if displayed, 0 if not (Integer)
"StatusBar" 1 if displayed, 0 if not (Integer)
"ShowTooltips" 1 if show tips, 0 if not (Integer)
"SaveDesktopOnExit" 1 if save on exit, 0 if not (Integer)
"UserName" username (String)
"ZoomFactor" zoom factor (Double)

Return Value

0 if no errors
non-zero if errors, use TCWLastErrorGet to retrieve error string

See Also

TCWAppPropertyGet

Example


result = TCWAppPropertySet("ZoomFactor",10.0)


APPLICATION - Drawing Management Functions


TCWDrawingNew

This function will create a new TurboCAD drawing.

Input Parameters

None

Return Value

The handle to the new drawing as a long. If return value is NULL, then the
drawing was not created. Use TCWLastErrorGet to retrieve the error string.

See Also

Example

Dim hDrawing As Long
hDrawing = TCWDrawingNew()
if (hDrawing = NULL) then
'check error
...
end if
...


TCWDrawingOpen

This function will open a drawing in any TurboCAD supported format. The format
is based on the file extension (.tcw, .dxf, .dwg...).

Input Parameters

String drawingname name of drawing to open

Return Value

The handle to the opened drawing as a long. If return value is NULL, then the
drawing was not opened. Use TCWLastErrorGet to retrieve the error string.

See Also

Example

Dim hDrawing As Long
hDrawing = TCWDrawingOpen("c:\mydrawings\pipes.tcw")
if (hDrawing = NULL) then
'check error
...


TCWDrawingClose

This function will close the current drawing. If the file has changed since
it was last saved, the value of savechanges will determine if the file is saved
first before closing.

Input Parameters

Long savechanges 1 if save changes before closing, 0 to not save changes

Return Value

0 if no errors. Non-zero if an error occurred. Use TCWLastErrorGet to retrieve
error string.

See Also

Example

...
result = TCWDrawingClose(1)
if (result <> 0) then
'check error
...


TCWDrawingSave

This function will save the current drawing to disk using the file and folder
name that was previously used. If this is the first time the file has been
saved, you will be prompted with the SaveAs dialog, prompting you for a name
and location to save the file. If you have Prompt for Summary Info in the
Options|Program Setup|General property sheet selected, you will be prompted to
input summary information.

Input Parameters

None

Return Value

0 if no errors. Non-zero if an error occurred. Use TCWLastErrorGet to retrieve
error string.

See Also

TCWDrawingSaveAs

Example

...
result = TCWDrawingSave()
if (result <> 0)
'check error
...


TCWDrawingSaveAs

This function will save the current drawing to disk using a file name and folder
you specify. The SaveAs dialog box will be displayed and you can input name,
location, etc. If you have Prompt for Summary Info in the
Options|Program Setup|General property sheet selected, you will be prompted to
input summary information. Set saveselection to True if you only want to save
the current selection to the file.

Input Parameters

String drawingname new name of drawing
Integer saveselection True if you want to save selection, false for drawing

Return Value

0 if no errors. Non-zero if an error occurred. Use TCWLastErrorGet to retrieve
error string.

See Also

TCWDrawingSave

Example

...
result = TCWDrawingSaveAs("newdrawing.tcw")
if (result <> 0) then
'check error
...


TCWDrawingName

This function will return the name of the drawing associated with the active
drawing. If the drawing is a new drawing that has not been saved, this function
will return the drawing title (e.g. Drawing1). This function can be used with TCWDrawingAt and TCWDrawingCount.
If you have only one drawing open, you can use TCWDrawingName(name) and it will
return the name of the current drawing. If you have multiple drawings open,
use TCWDrawingCount to find out how many are open, then use TCWDrawingAt and TCWDrawingName
to cycle through the drawings to get the name of each.

Input Parameters

String drawingname buffer for drawing name

Return Value

0 if no errors. Non-zero if an error occurred. Use TCWLastErrorGet to retrieve
error string.

See Also

TCWDrawingCount, TCWDrawingAt

Example

Dim dCount As Long
Dim hDrawing As Long
Dim i As Long
Dim dName As String
dCount = TCWDrawingCount()
if (dCount = 0) then
MsgBox "No drawings open."
Stop
end if
for i = 0 to dCount - 1
hDrawing = TCWDrawingAt(i)
TCWDrawingName dName
MsgBox dName
next i
...


TCWDrawingAt

This function will activate the drawing specified. This function is used
with TCWDrawingCount to get the number of drawings open in the application.
If you have multiple drawings open, you can use TCWDrawingCount to get the
number of drawings, then use TCWDrawingAt to change the active drawing. The
index is 0 based, so you can cycle through 0 to count-1 drawings.

Input Parameters

Long index number associated with the open drawing

Return Value

The handle to the drawing as a long.

See Also

TCWDrawingName, TCWDrawingCount

Example

Dim dCount As Long
Dim i As Long
Dim hDrawing As Long
dCount = TCWDrawingCount()
for i = 0 to dCount - 1
hDrawing = TCWDrawingAt(i)
...
next i
...


TCWDrawingCount

This function will return the number of open drawings. Used with
TCWDrawingName and TCWDrawingAt to cycle through the open drawings.

Input Parameters

None

Return Value

Number of open drawings in TurboCAD as a long.

See Also

TCWDrawingName, TCWDrawingAt

Example

Dim dCount As Long
Dim i As Long
Dim hDrawing As Long
dCount = TCWDrawingCount()
for i = 0 to dCount - 1
hDrawing = TCWDrawingAt(i)
...
next i
...


TCWDrawingPrint

This function will print the current drawing. Set showdialog to TRUE if
you want to see the print dialog box and have access to the page setup
parameters.

Input Parameters

Long showdialog 1 to show print dialog box, 0 if no print dialog box

Return Value

0 if no errors. Non-zero if an error occurred. Use TCWLastErrorGet to retrieve
error string.

See Also

Example

...
result = TCWDrawingPrint(0)
...


TCWDrawingActive

This function will return the handle of the active drawing.

Input Parameters

None

Return Value

Handle of active drawing as a Long. If NULL, then no active drawing. If you
believe this should have returned a drawing handle, use TCWLastErrorGet to
retrieve the error string.

See Also

Example

Dim hDrawing As Long
hDrawing = TCWDrawingActive()
if (hDrawing = NULL) then
Msgbox "No active drawing".
...


APPLICATION - Undo and Redo Functions


TCWUndoClear

This function will delete all the undo records in the current drawing. You will
not be able to Redo any previous actions after making this call.

Input Parameters

None

Return Value

0 if no errors. Non-zero if an error occurred. Use TCWLastErrorGet to retrieve
error string.

See Also

TCWUndo, TCWRedo

Example

...
result = TCWUndoClear()
...


TCWUndo

This function will reverse the last n changes in the current drawing.

Input Parameters

long n number of changes to undo

Return Value

0 if no errors. Non-zero if an error occurred. Use TCWLastErrorGet to retrieve
error string.

See Also

TCWUndoClear, TCWRedo

Example

...
result = TCWUndo(2) 'undo last 2 operations


TCWRedo

This function will reverse the effect of the last undo.

Input Parameters

None

Return Value

0 if no errors. Non-zero if an error occurred. Use TCWLastErrorGet to retrieve
error string.

See Also

TCWUndoClear, TCWUndo

Example

...
result = TCWRedo() 'oops - get it back!


DRAWING - Selection Functions


TCWSelectAll

This function selects the all graphics in the drawing.

Input Parameters

None

Return Value

0 if no errors. There was at least one graphic to select.
Non-zero if errors or no graphics to select. Use TCWLastErrorGet to see if there
was an error.

See Also

TCWDeselectAll

Example

...
result = TCWSelectAll()
if (result = 0) then
'change all graphics to have PenColor Red
...


TCWDeselectAll

This function will deselect all selected graphics.

Input Parameters

None

Return Value

0 if no errors. At least one graphic was deselected.
Non-zero if errors or no graphics to deselect. Use TCWLastErrorGet see if there was
an error.

See Also

TCWSelectAll

Example

...
result = TCWDeselectAll()
...


TCWClearSelection

This function will delete all selected graphics.

Input Parameters

None

Return Value

0 if no errors. At least one graphic was deleted.
Non-zero if errors or no graphics to delete. Use TCWLastErrorGet to see if there was
an error.

See Also

TCWClearAll

Example

select all graphics with type = circle
g = TCWSelectByQuery("Type = Circle/Ellipse")
result = TCWClearSelection()
...


TCWClearAll

This function will delete all graphics in the current drawing.

This deletes every graphic, not just what is selected. To only delete
selected graphics, see TCWClearSelection.

Input Parameters

None

Return Value

0 if no errors. At least one graphic was deleted.
Non-zero if errors or no graphics to delete. Use TCWLastErrorGet to see if there was
an error.

See Also

TCWClearSelection

Example

...
result = TCWClearAll()
...


TCWClearAllConstructions

This function will delete all construction graphics in the current drawing.

Input Parameters

None

Return Value

0 if no errors. At least one graphic was deleted.
Non-zero if errors or no graphics to delete. Use TCWLastErrorGet to see if there was
an error.

See Also

Example

...
result = TCWClearAllConstructions()
...


TCWSelectByQuery

This function will select graphics in the drawing based on specified criteria.
An empty query is equivalent to SELECTED. Use TCWSelectionCount and TCWSelectionAt
to cycle through the selected graphics.

The query language is defined as follows:

"query" -> "expr"
"expr" -> "expr" OR "expr" | "expr" AND "expr" | ("expr") | NOT "expr" | "atom"
"atom" -> ALL | SELECTED | "field_name" "relation" "value"
"rel" -> = | <> | < | <= | > | >=
"field_name" -> "string" | "any_string"
"value" -> "string" | "any_string"
"string" -> string without spaces which is not a keyword and doesn't have any reserved characters
"any_string" -> string without any double quote marks, may have spaces

Keywords for query are:
ALL, SELECTED, OR, AND, NOT

Reserved characters are:
=, <, >, ", (, )

Precedence (in descending order):
()
NOT
AND
OR

Input Parameters

String s string for search

Return Value

First graphic in the selection as a Long.

See Also

Example

Dim g As Long
'This query adds all elements from the electrical layer to the current selection
g = TCWSelectByQuery("SELECTED OR Layer = electrical")
if (g = NULL) then
MsgBox "No graphics met criteria".
Stop
...


TCWSelectionCount

This function will return a count of the number of graphics currently
selected in the drawing.

Input Parameters

None

Return Value

The number of graphics that are currently selected as a Long.

See Also

TCWSelection, TCWSelectByQuery

Example



TCWSelectionAt

This function will return the handle of the requested graphic in the drawing. The index
should be a number from 0 to the value-1 returned by TCWSelectionCount.

Input Parameters

Long index requested select graphic index

Return Value

The handle of the graphic as a Long.

See Also

TCWSelectionCount

Example



DRAWING - Construction Line Creation Functions

These graphic creation functions add the graphic to the drawing. Do not use the graphic handle returned from these functions with TCWGraphicAppend to append to the drawing or another graphic. All construction lines and circles are put on a CONSTRUCTION layer.


TCWConstructionAngularLine

This function will draw a construction line at the specified angle.

Input Parameters

Double x0 X coordinate of the first point
Double y0 Y coordinate of the first point
Double z0 Z coordinate of the first point
Double x1 X coordinate of the second point
Double y1 Y coordinate of the second point
Double z1 Z coordinate of the second point

Return Value

Returns the handle to the construction line as a long.

See Also

Example

Dim hConstr As Long
...
hConstr = TCWConstructionAngularLine(x1, y1, z1, x2, y2, z2)
if (hConstr = NULL) then
'check error
...


TCWConstructionHorizontalLine

This function will draw a horizontal construction line.

Input Parameters

Double x0 X coordinate of point on the line
Double y0 Y coordinate of point on the line
Double z0 Z coordinate of point on the line

Return Value

Returns the handle to the construction line as a Long.

See Also

Example

Dim hConstr As Long
Dim xc As Double
Dim yc As Double
'get center of view for construction line placement
xc = (TCWViewExtentsGetX1() + TCWViewExtentsGetX2())/2
yc = (TCWViewExtentsGetY1() + TCWViewExtentsGetY2())/2
hConstr = TCWConstructionHorizontalLine(xc, yc, 0.0)
if (hConstr = NULL) then
'check error
...


TCWConstructionVerticalLine

This function will draw a vertical construction line.

Input Parameters

Double x0 X coordinate of point on the line
Double y0 Y coordinate of point on the line
Double z0 Z coordinate of point on the line

Return Value

Returns the handle to the construction line as a Long.

See Also

Example

Dim hConstr As Long
Dim xc As Double
Dim yc As Double
'get center of view for construction line placement
xc = (TCWViewExtentsGetX1() + TCWViewExtentsGetX2())/2
yc = (TCWViewExtentsGetY1() + TCWViewExtentsGetY2())/2
hConstr = TCWConstructionVerticalLine(xc, yc, 0.0)
if (hConstr = NULL) then
'check error
...


TCWConstructionCenterAndPointCircle

This function will draw a construction circle defined by its center point
and a point on its perimeter.

Input Parameters

Double x0 X coordinate of the center point
Double y0 Y coordinate of the center point
Double z0 Z coordinate of the center point
Double x1 X coordinate of the perimeter point
Double y1 Y coordinate of the perimeter point
Double z1 Z coordinate of the perimeter point

Return Value

Returns the handle to the construction line as a Long.

See Also

Example

Dim hConstr As Long
Dim xc As Double
Dim yc As Double
'get center of view for construction circle placement
xc = (TCWViewExtentsGetX1() + TCWViewExtentsGetX2())/2
yc = (TCWViewExtentsGetY1() + TCWViewExtentsGetY2())/2
hConstr = TCWConstructionCenterAndPointCircle(xc, yc, 0.0, xc+2#, yc+2#, 0.0)
if (hConstr = NULL) then
'check error
...


TCWConstructionDoublePointCircle

This function will draw a construction circle that passes through two defined
points 180 degrees apart.

Input Parameters

Double x0 X coordinate of the first point
Double y0 Y coordinate of the first point
Double z0 Z coordinate of the first point
Double x1 X coordinate of the second point
Double y1 Y coordinate of the second point
Double z1 Z coordinate of the second point

Return Value

Returns the handle to the construction line as a Long.

See Also

Example

Dim hConstr As Long
Dim xc As Double
Dim yc As Double
'get center of view for construction circle placement
xc = (TCWViewExtentsGetX1() + TCWViewExtentsGetX2())/2
yc = (TCWViewExtentsGetY1() + TCWViewExtentsGetY2())/2
hConstr = TCWConstructionDoublePointCircle(xc-2#, yc-2#, 0.0, xc+2#, yc+2#, 0.0)
if (hConstr = NULL) then
'check error
...


TCWConstructionTriplePointCircle

This function will draw a construction circle that passes through three
defined points.

Input Parameters

Double x0 X coordinate of the first point
Double y0 Y coordinate of the first point
Double z0 Z coordinate of the first point
Double x1 X coordinate of the second point
Double y1 Y coordinate of the second point
Double z1 Z coordinate of the second point
Double x2 X coordinate of the third point
Double y2 Y coordinate of the third point
Double z2 Z coordinate of the third point

Return Value

Returns the handle to the construction line as a Long.

See Also

Example

Dim hConstr As Long
Dim xc As Double
Dim yc As Double
'get center of view for construction circle placement
hConstr = TCWConstructionTriplePointCircle(1#, 1#, 0.0, 2#, 2#, 0.0, 3#,3#, 0.0)
if (hConstr = NULL) then
'check error
...


DRAWING - Point Creation Functions

These graphic creation functions add the graphic to the drawing. Do not use the graphic handle returned from these functions with TCWGraphicAppend to append to the drawing or another graphic.


TCWDot

This function will create a point that is a "dot".

Input Parameters

Double x0 X coordinate for the point
Double y0 Y coordinate for the point
Double z0 Z coordinate for the point

Return Value

Returns the handle to the point graphic as a Long.

See Also

TCWStar, TCWSquare, TCWCross, TCWCircle

Example

Dim g As Long
g = TCWDot(2.0, 3.0, 0.0)
if (g = NULL)
'check error
...


TCWStar

This function will create a point that is a "star".

Input Parameters

Double x0 X coordinate for the point
Double y0 Y coordinate for the point
Double z0 Z coordinate for the point

Return Value

Returns the handle to the point graphic as a Long.

See Also

TCWDot, TCWSquare, TCWCross, TCWCircle

Example

Dim g As Long
g = TCWStar(2.0, 3.0, 0.0)
if (g = NULL)
'check error
...


TCWSquare

This function will create a point that is a "square".

Input Parameters

Double x0 X coordinate for the point
Double y0 Y coordinate for the point
Double z0 Z coordinate for the point

Return Value

Returns the handle to the point graphic as a Long.

See Also

TCWDot, TCWStar, TCWCross, TCWCircle

Example

Dim g As Long
g = TCWSquare(2.0, 3.0, 0.0)
if (g = NULL)
'check error
...


TCWCross

This function will create a point that is a "cross".

Input Parameters

Double x0 X coordinate for the point
Double y0 Y coordinate for the point
Double z0 Z coordinate for the point

Return Value

Returns the handle to the point graphic as a Long.

See Also

TCWDot, TCWStar, TCWSquare, TCWCircle

Example

Dim g As Long
g = TCWCross(2.0, 3.0, 0.0)
if (g = NULL)
'check error
...


TCWCircle

This function will create a point that is a "circle".

Input Parameters

Double x0 X coordinate for the point
Double y0 Y coordinate for the point
Double z0 Z coordinate for the point

Return Value

Returns the handle to the point graphic as a Long.

See Also

TCWDot, TCWStar, TCWSquare, TCWCross

Example

Dim g As Long
g = TCWCircle(2.0, 3.0, 0.0)
if (g = NULL)
'check error
...


DRAWING - Line Creation Functions

These graphic creation functions add the graphic to the drawing. Do not use the graphic handle returned from these functions with TCWGraphicAppend to append to the drawing or another graphic.


TCWLineSingle

This function will draw a single line segment from two specified end points.

Input Parameters

Double x0 X coordinate for the first point
Double y0 Y coordinate for the first point
Double z0 Z coordinate for the first point
Double x1 X coordinate for the second point
Double y1 Y coordinate for the second point
Double z1 Z coordinate for the second point

Return Value

Returns the handle to the line graphic as a Long.

See Also

Example



TCWLinePolygon

This function will draw a regular polygon with the specified number
of sides.

Input Parameters

Double x0 X coordinate for the center point
Double y0 Y coordinate for the center point
Double z0 Z coordinate for the center point
Double x1 X coordinate for the corner point
Double y1 Y coordinate for the corner point
Double z1 Z coordinate for the corner point
Long nsides number of sides

Return Value

Returns the handle of the polygon graphic as a Long. The polygon is
constructed such that it would fit exactly inside a circle with
the same center and radius.

See Also

Example



TCWLineRectangle

This function will draw an orthogonal rectangle.

Input Parameters

Double x0 X coordinate of the upper left corner
Double y0 Y coordinate of the upper left corner
Double z0 Z coordinate of the upper left corner
Double x1 X coordinate of the lower right corner
Double y1 Y coordinate of the lower right corner
Double z1 Z coordinate of the lower right corner

Return Value

Returns the handle of a Graphic as a Long with contains 5 vertices.

See Also

Example



TCWLineRotatedRectangle

This function will draw a rectangle oriented at the specified angle.

Input Parameters

Double x0 X coordinate of the upper left corner
Double y0 Y coordinate of the upper left corner
Double z0 Z coordinate of the upper left corner
Double x1 X coordinate of the lower right corner
Double y1 Y coordinate of the lower right corner
Double z1 Z coordinate of the lower right corner
Double height angle of rotation in radians

Return Value

Returns a handle to a graphic with 5 vertices in the shape of a rectangle. The
return value is a long. The fifth vertex is equal to the first. The two points
are the ends of the base edge. The height of the rectangle is drawn in the direction
that would be a "right turn" when traveling from the first point to the second.

See Also

Example



TCWLinePerpendicular

This function will draw a line perpendicular to an existing line.

Input Parameters

Long g handle of line to make new line perpendicular to
Double x0 X coordinate of the point on the existing line
Double y0 Y coordinate of the point on the existing line
Double z0 Z coordinate of the point on the existing line

Return Value

Returns the handle of the perpendicular line as a Long.

See Also

Example



TCWLineParallel

This function will draw a line parallel to an existing line, at a
specified distance from the line.

Input Parameters

Long g handle of line to make new line parallel to
Double x0 X coordinate of the new line
Double y0 Y coordinate of the new line
Double z0 Z coordinate of the new line

Return Value

Returns the handle to the new parallel line as a Long.

See Also

Example



DRAWING - Multi-line Creation Functions

These graphic creation functions add the graphic to the drawing. Do not use the graphic handle returned from these functions with TCWGraphicAppend to append to the drawing or another graphic.


TCWLineMultiline

This function will start the creation of a series of connected segments.

Use TCWGraphicXYZAdd or TCWGraphicVertexAdd to define the next segment.
Use TCWGraphicClose to close the multi-line into a polygon.

Input Parameters

Double x0 X coordinate of first end point
Double y0 Y coordinate of first end point
Double z0 Z coordinate of first end point

Return Value

Returns the handle to the graphic as a Long.

See Also

TCWGraphicClose, TCWGraphicXYZAdd, TCWGraphicVertexAdd

Example



TCWLineIrregularPolygon

This function will start the creation of an irregular polygon.

Use TCWGraphicXYZAdd or TCWGraphicVertexAdd to define the next point of the polygon.
Use TCWGraphicClose to close the multi-line into the polygon.

Input Parameters

Double x0 X coordinate of first end point
Double y0 Y coordinate of first end point
Double z0 Z coordinate of first end point

Return Value

Returns the handle to the first segment as a Long.

See Also

TCWGraphicClose, TCWGraphicXYZAdd, TCWGraphicVertexAdd

Example



TCWDoubleLineMultiline

This function will start the creation of a series of connected double lines.

Use TCWGraphicXYZAdd or TCWGraphicVertexAdd to define the next point of the segment.
Use TCWGraphicClose to close the multi-double line into a polygon.

Input Parameters

Double x0 X coordinate of first end point
Double y0 Y coordinate of first end point
Double z0 Z coordinate of first end point

Return Value

Returns the handle to the graphic as a Long.

See Also

TCWGraphicClose, TCWGraphicXYZAdd, TCWGraphicVertexAdd

Example



TCWDoubleLineIrregularPolygon

This function will start the creation of a double line polygon with an
arbitrary number of sides.

Use TCWGraphicXYZAdd or TCWGraphicVertexAdd to define the next segment.
Use TCWGraphicClose to close the multi-line into a polygon.

Input Parameters

Double x0 X coordinate of first end point
Double y0 Y coordinate of first end point
Double z0 Z coordinate of first end point

Return Value

Returns the handle to the graphic as a long.

See Also

TCWGraphicClose, TCWGraphicXYZAdd, TCWGraphicVertexAdd

Example



TCWCurveBezier

This function will start the creation of a bezier curve, connecting
two end points that will gravitate toward control points along the path.

Use TCWGraphicClose to close the bezier curve, matching the last end point
with the first end point.

Input Parameters

Double x0 X coordinate of the first end point
Double y0 Y coordinate of the first end point
Double z0 Z coordinate of the first end point

Return Value

Returns the handle to the graphic as a Long.

See Also

TCWGraphicClose, TCWGraphicXYZAdd, TCWGraphicVertexAdd

Example



TCWCurveSpline

This function will start the creation of a spline curve, connecting
a series of points into a continuous curve.

Use TCWGraphicClose to close the spline curve, matching the last end point
with the first end point.

Input Parameters

Double x0 X coordinate of the first end point
Double y0 Y coordinate of the first end point
Double z0 Z coordinate of the first end point

Return Value

Returns the handle to the graphic as a Long.

See Also

TCWGraphicClose, TCWGraphicXYZAdd, TCWGraphicVertexAdd

Example



DRAWING - Double Line Creation Functions

These graphic creation functions add the graphic to the drawing. Do not use the graphic handle returned from these functions with TCWGraphicAppend to append to the drawing or another graphic.


TCWDoubleLineSingle

This function will draw a double line segment from two specified end points.

Input Parameters

Double x0 X coordinate for the first point
Double y0 Y coordinate for the first point
Double z0 Z coordinate for the first point
Double x1 X coordinate for the second point
Double y1 Y coordinate for the second point
Double z1 Z coordinate for the second point

Return Value

Returns the handle to the double line as a Long.

See Also

Example



TCWDoubleLinePolygon

This function will draw a regular double line polygon with the specified
number of sides.

Input Parameters

Double x0 X coordinate for the center point
Double y0 Y coordinate for the center point
Double z0 Z coordinate for the center point
Double x1 X coordinate for the corner point
Double y1 Y coordinate for the corner point
Double z1 Z coordinate for the corner point
Long nsides number of sides

Return Value

Returns the handle of the polygon graphic as a Long. The polygon is
constructed such that it would fit exactly inside a circle with the same
center and radius.

See Also

Example



TCWDoubleLineRectangle

This function will draw an orthogonal double line rectangle.

Input Parameters

Double x0 X coordinate of the upper left corner
Double y0 Y coordinate of the upper left corner
Double z0 Z coordinate of the upper left corner
Double x1 X coordinate of the lower right corner
Double y1 Y coordinate of the lower right corner
Double z1 Z coordinate of the lower right corner

Return Value

Returns the handle of a graphic with 5 vertices. The return value is a Long.

See Also

Example



TCWDoubleLineRotatedRectangle

This function will draw a double line rectangle oriented at the specified angle.

Input Parameters

Double x0 X coordinate of the upper left corner
Double y0 Y coordinate of the upper left corner
Double z0 Z coordinate of the upper left corner
Double x1 X coordinate of the lower right corner
Double y1 Y coordinate of the lower right corner
Double z1 Z coordinate of the lower right corner
Double height angle of rotation in radians

Return Value

Returns a handle to a graphic with 5 vertices in the shape of a rectangle.
The fifth vertex is equal to the first. The two points are the ends of the
base edge. The height of the rectangle is drawn in the direction that would
be a "right turn" when traveling from the first point to the second.

See Also

Example



TCWDoubleLinePerpendicular

This function will draw a double line perpendicular to an existing line.

Input Parameters

Long g handle of line to make new line perpendicular to
Double x0 X coordinate of the point on the existing line
Double y0 Y coordinate of the point on the existing line
Double z0 Z coordinate of the point on the existing line
Double x1 X coordinate of the second point on the new line
Double y1 Y coordinate of the second point on the new line
Double z1 Z coordinate of the second point on the new line

Return Value

Returns the handle of the perpendicular double line as a Long.

See Also

Example



TCWDoubleLineParallel

This function will draw a double line parallel to an existing line, at a
specified distance from the line.

Input Parameters

Long g handle of line to make new line parallel to
Double x0 X coordinate of the new line
Double y0 Y coordinate of the new line
Double z0 Z coordinate of the new line

Return Value

Returns the handle to the new parallel line as a Long.

See Also

Example



DRAWING - Circle and Ellipse Creation Functions

These graphic creation functions add the graphic to the drawing. Do not use the graphic handle returned from these functions with TCWGraphicAppend to append to the drawing or another graphic.


TCWCircleCenterAndPoint

This function will draw a circle from the specified center point and radius.

Input Parameters

Double x0 X coordinate of the center point
Double y0 Y coordinate of the center point
Double z0 Z coordinate of the center point
Double x1 X coordinate of the radius point
Double y1 Y coordinate of the radius point
Double z1 Z coordinate of the radius point

Return Value

Returns the handle to the circle as a Long.

See Also

Example



TCWCircleDoublePoint

This function will draw a circle using two opposite points on its perimeter.

Input Parameters

Double x0 X coordinate of the first point
Double y0 Y coordinate of the first point
Double z0 Z coordinate of the first point
Double x1 X coordinate of the second point
Double y1 Y coordinate of the second point
Double z1 Z coordinate of the second point

Return Value

Returns the handle to the circle as a Long.

See Also

Example



TCWCircleTriplePoint

This function will draw a circle by defining three point on the circle's
perimeter.

Input Parameters

Double x0 X coordinate of the first point
Double y0 Y coordinate of the first point
Double z0 Z coordinate of the first point
Double x1 X coordinate of the second point
Double y1 Y coordinate of the second point
Double z1 Z coordinate of the second point
Double x2 X coordinate of the third point
Double y2 Y coordinate of the third point
Double z2 Z coordinate of the third point

Return Value

Returns the handle to the circle as a Long.

See Also

Example



TCWEllipse

This function will draw an ellipse by defining its bounding rectangle.

Input Parameters

Double x0 X coordinate of bounding rectangle's upper left corner
Double y0 Y coordinate of bounding rectangle's upper left corner
Double z0 Z coordinate of bounding rectangle's upper left corner
Double x1 X coordinate of bounding rectangle's lower right corner
Double y1 Y coordinate of bounding rectangle's lower right corner
Double z1 Z coordinate of bounding rectangle's lower right corner

Return Value

Returns the handle to the ellipse as a Long.

See Also

Example



TCWEllipseRotatedEllipse

This function will draw an ellipse rotated by specifying the ellipse's
center point, and major and minor axis radius points.

Input Parameters

Double x0 X coordinate of ellipse's center point
Double y0 Y coordinate of ellipse's center point
Double z0 Z coordinate of ellipse's center point
Double x1 X coordinate of major axis radius point
Double y1 Y coordinate of major axis radius point
Double z1 Z coordinate of major axis radius point
Double x2 X coordinate of minor axis radius point
Double y2 Y coordinate of minor axis radius point
Double z2 Z coordinate of minor axis radius point

Return Value

Returns the handle of the rotated ellipse as a Long.

See Also

Example



TCWEllipseFixedRatio

This function will draw an ellipse, specified by the ratio of the
major axis length to the minor axis length.

Input Parameters

Double x0 X coordinate of ellipse's center point
Double y0 Y coordinate of ellipse's center point
Double z0 Z coordinate of ellipse's center point
Double x1 X coordinate of radius in Y direction
Double y1 Y coordinate of radius in Y direction
Double z1 Z coordinate of radius in Y direction
Double xyratioratio of Rx/Ry

Return Value

Returns the handle to the ellipse as a Long.

See Also

Example



DRAWING - Arc Creation Functions

These graphic creation functions add the graphic to the drawing. Do not use the graphic handle returned from these functions with TCWGraphicAppend to append to the drawing or another graphic.


TCWArcCenterAndPoint

This function will draw a circular arc specified by it's center point,
point on it's circumference and a start and end angle.

Input Parameters

Double x0 X coordinate of arc's center point
Double y0 Y coordinate of arc's center point
Double z0 Z coordinate of arc's center point
Double x1 X coordinate of the radius point
Double y1 Y coordinate of the radius point
Double z1 Z coordinate of the radius point
Double startanglestarting angle in radians
Double endangleending angle in radians

Return Value

Returns the handle of the arc as a Long.

See Also

Example



TCWArcDoublePoint

This function will draw a circular arc from specified end points
of its diameter.

Input Parameters

Double x0 X coordinate of first end point
Double y0 Y coordinate of first end point
Double z0 Z coordinate of first end point
Double x1 X coordinate of second end point
Double y1 Y coordinate of second end point
Double z1 Z coordinate of second end point
Double startanglestarting angle in radians
Double endangleending angle in radians

Return Value

Returns the handle to the arc as a Long.

See Also

Example



TCWArcTriplePoint

This function will draw a circular arc by defining (1) its starting
point, (2) a point on its perimeter and (3) its ending point.

Input Parameters

Double x0 X coordinate of starting point
Double y0 Y coordinate of starting point
Double z0 Z coordinate of starting point
Double x1 X coordinate of point on perimeter
Double y1 Y coordinate of point on perimeter
Double z1 Z coordinate of point on perimeter
Double x2 X coordinate of ending point
Double y2 Y coordinate of ending point
Double z2 Z coordinate of ending point

Return Value

Returns the handle to the arc as a Long.

See Also

Example



TCWArcElliptical

This function will draw an elliptical arc specified by its bounding
rectangle, starting and ending angles.

Input Parameters

Double x0 X coordinate of bounding rectangle's upper left corner
Double y0 Y coordinate of bounding rectangle's upper left corner
Double z0 Z coordinate of bounding rectangle's upper left corner
Double x1 X coordinate of bounding rectangle's lower right corner
Double y1 Y coordinate of bounding rectangle's lower right corner
Double z1 Z coordinate of bounding rectangle's lower right corner
Double startanglestarting angle in radians
Double endangleending angle in radians

Return Value

Returns a handle to the elliptical arc as a Long.

See Also

Example



TCWArcRotatedElliptical

This function will draw an elliptical arc rotated by specifying the ellipse's
center point, and major and minor axis radius points, start and end angles.

Input Parameters

Double x0 X coordinate of elliptical arc's center point
Double y0 Y coordinate of elliptical arc's center point
Double z0 Z coordinate of elliptical arc's center point
Double x1 X coordinate of major axis radius point
Double y1 Y coordinate of major axis radius point
Double z1 Z coordinate of major axis radius point
Double x2 X coordinate of minor axis radius point
Double y2 Y coordinate of minor axis radius point
Double z2 Z coordinate of minor axis radius point
Double startanglestarting angle in radians
Double endangleending angle in radians

Return Value

Returns the handle of the rotated elliptical arc as a Long.

See Also

Example



TCWArcEllipticalFixedRatio

This function will draw an elliptical arc, specified by the ratio of the
major axis length to the minor axis length.

Input Parameters

Double x0 X coordinate of ellipse's center point
Double y0 Y coordinate of ellipse's center point
Double z0 Z coordinate of ellipse's center point
Double x1 X coordinate of radius in Y direction
Double y1 Y coordinate of radius in Y direction
Double z1 Z coordinate of radius in Y direction
Double xyratioratio of Rx/Ry
Double startanglestarting angle in radians
Double endangleending angle in radians

Return Value

Returns the handle to the ellipse as a Long.

See Also

Example



DRAWING - Text Creation Function

This graphic creation function adds the graphic to the drawing. Do not use the graphic handle returned from this function with TCWGraphicAppend to append to the drawing or another graphic.


TCWText

This function will create text starting at the point specified.

Input Parameters

Double x0 X coordinate of text's starting point
Double y0 Y coordinate of text's starting point
Double z0 Z coordinate of text's starting point
String textstrtext string
Double size font size
Double angle angle of text

Return Value

Returns a handle to the text.

See Also

Example



DRAWING - Dimension Creation Functions

These graphic creation functions add the graphic to the drawing. Do not use the graphic handle returned from these functions with TCWGraphicAppend to append to the drawing or another graphic.


TCWDimensionHorizontal

This function will create a linear dimension showing horizontal distance.

Input Parameters

Double x0 X coordinate of first extension line
Double y0 Y coordinate of first extension line
Double z0 Z coordinate of first extension line
Double x1 X coordinate of second extension line
Double y1 Y coordinate of second extension line
Double z1 Z coordinate of second extension line
Double x2 X coordinate of dimension
Double y2 Y coordinate of dimension
Double z2 Z coordinate of dimension

Return Value

Returns the handle to the dimension as a Long.

See Also

Example



TCWDimensionHorizontalEntity

This function will create a linear dimension showing horizontal distance.

Input Parameters

Long g entity to horizontally dimension
Double x0 X coordinate for dimension line location
Double y0 Y coordinate for dimension line location
Double z0 Z coordinate for dimension line location

Return Value

Returns the handle to the dimension as a Long.

See Also

Example



TCWDimensionVertical

This function will create a linear dimension showing vertical distance.

Input Parameters

Double x0 X coordinate of first extension line
Double y0 Y coordinate of first extension line
Double z0 Z coordinate of first extension line
Double x1 X coordinate of second extension line
Double y1 Y coordinate of second extension line
Double z1 Z coordinate of second extension line
Double x2 X coordinate of dimension
Double y2 Y coordinate of dimension
Double z2 Z coordinate of dimension

Return Value

Returns the handle to the dimension as a Long.

See Also

Example



TCWDimensionVerticalEntity

This function will create a linear dimension showing vertical distance.

Input Parameters

Long g entity to vertically dimension
Double x0 X coordinate for dimension line location
Double y0 Y coordinate for dimension line location
Double z0 Z coordinate for dimension line location

Return Value

Returns the handle to the dimension as a Long.

See Also

Example



TCWDimensionParallel

This function will create a linear dimension showing absolute distance
between two points.

Input Parameters

Double x0 X coordinate of first extension line
Double y0 Y coordinate of first extension line
Double z0 Z coordinate of first extension line
Double x1 X coordinate of second extension line
Double y1 Y coordinate of second extension line
Double z1 Z coordinate of second extension line
Double x2 X coordinate of dimension
Double y2 Y coordinate of dimension
Double z2 Z coordinate of dimension

Return Value

Returns the handle to the dimension as a Long.

See Also

Example



TCWDimensionParallelEntity

This function will create a linear dimension showing parallel distance.

Input Parameters

Long g entity to dimension
Double x0 X coordinate for dimension line location
Double y0 Y coordinate for dimension line location
Double z0 Z coordinate for dimension line location

Return Value

Returns the handle to the dimension as a Long.

See Also

Example



DRAWING - Undo Record Functions

Use these functions to create your own kind of undo which includes one or more operations. Then, with one undo you can get back to the beginning. TCADAPI will create undo records for all align functions, graphic creation and deletion, selection deletion, selection scaling, rotating and moving, explode, and group.


TCWUndoRecordStart

This function will start an undo record. NOTE: a start record MUST be matched
with an end record.

Input Parameters

Long d handle of a drawing
String title string to associate with undo record

Return Value

0 if no errors. Non-zero if an error occurred. Use TCWLastErrorGet to retrieve
error string.

See Also

TCWUndoRecordAddGraphic, TCWUndoRecordEnd

Example



TCWUndoRecordAddGraphic

This function will add graphics to the undo record. Use this
function to accumulate graphics that you may want to undo.

Input Parameters

Long d handle of a drawing
Long g graphic to add to undo record

Return Value

0 if no errors. Non-zero if an error occurred. Use TCWLastErrorGet to retrieve
error string.

See Also

TCWUndoRecordStart, TCWUndoRecordEnd

Example



TCWUndoRecordEnd

This function will close an opened undo record.

Input Parameters

Long d handle of a drawing

Return Value

0 if no errors. Non-zero if an error occurred. Use TCWLastErrorGet to retrieve
error string.

See Also

TCWUndoRecordStart, TCWUndoRecordAddGraphic

Example



DRAWING - Block Functions


TCWBlockGet

This function will return the handle of a block with the specified
block name.

Input Parameters

String blockname name of block to return

Return Value

Handle of the block as a Long.

See Also

Example



TCWBlockCreate

This function will create a block from the selected graphics. The block
will be named from the name specified.

Input Parameters

String blocknamestring for block name

Return Value

0 if no errors. Non-zero if an error occurred. Use TCWLastErrorGet to retrieve
error string.

See Also

Example



TCWBlockInsert

This function will insert a block into the drawing.

Input Parameters

String blocknameblock name to insert
Double x0 x coordinate for where to insert block
Double y0 y coordinate for where to insert block
Double z0 z coordinate for where to insert block

Return Value

Returns the handle to the new instance of the block as a Long.

See Also

Example



DRAWING - Get and Set Property Functions


TCWDrawingPropertyGet

This function will return the value of the property that has been
requested. This function is written in Basic due to problems with Enable
not supporting Variants with DLLs.

Input Parameters

String propertyname name of property look up
AVAILABLE PROPERTIES: DESCRIPTION:
"PenColor" pen color as &H00bbggrr or -3 for by layer, -4 for by block
"PenWidth" pen width as a Double
"PenScale" pen scale as a Double
"PenStyle" pen style as a Integer
"BrushColor" brush color as &H00bbggrr or -3 for by layer, -4 for by block or -5 for by pen
"BrushScale" brush scale as a Double
"BrushAngle" brush angle as a Double
"BrushStyle" brush style as a Double
"TextStyle" flags: &H0000 = regular, &H0001 = italic, &H0002 = bold, &H0004 = strikethru, &H0008 = hidden, &H0040 = allcaps
"ScaleSystem" 0 for world, 1 for paper, 2 for device
"BrushDrawMode" brush drawing mode as n Integer
"PenAlignment" pen alignment as a String
"HatchCross" hatch cross as an Integer
"Layer" layer id as an Integer
"Info" info string as a String
"TextFont" text font as a String
"TextFormat" 0 for left justify, 1 for center, 2 for right justify
"TextSize" text size as a Double

Return Value

Value of property requested.
AVAILABLE PROPERTIES: VALUE RETURNED:
"PenColor" (Long)
"PenWidth" (Double)
"PenScale" (Double)
"PenStyle" (Integer)
"BrushColor" (Long)
"BrushScale" (Double)
"BrushAngle" (Double)
"BrushStyle" (Double)
"TextStyle" (Integer)
"ScaleSystem" (Integer)
"BrushDrawMode" (Integer)
"PenAlignment" (String)
"HatchCross" (Integer)
"Layer" (Integer)
"Info" (String)
"TextFont" (String)
"TextFormat" (Integer)
"TextSize" (Double)

See Also

Example



TCWDrawingPropertySet

This function will set the property with the specified value.

Input Parameters

String propertyname name of property to modify
Variant value value to set to
AVAILABLE PROPERTIES: DESCRIPTION:
"PenColor" pen color as &H00bbggrr or -3 for by layer, -4 for by block
"PenWidth" pen width as a Double
"PenScale" pen scale as a Double
"PenStyle" pen style as a Integer
"BrushColor" brush color as &H00bbggrr or -3 for by layer, -4 for by block or -5 for by pen
"BrushScale" brush scale as a Double
"BrushAngle" brush angle as a Double
"BrushStyle" brush style as a Double
"TextStyle" flags: &H0000 = regular, &H0001 = italic, &H0002 = bold, &H0004 = strikethru, &H0008 = hidden, &H0040 = allcaps
"ScaleSystem" 0 for world, 1 for paper, 2 for device
"BrushDrawMode" brush drawing mode as n Integer
"PenAlignment" pen alignment as a String
"HatchCross" hatch cross as an Integer
"Layer" layer id as an Integer
"Info" info string as a String
"TextFont" text font as a String
"TextFormat" 0 for left justify, 1 for center, 2 for right justify
"TextSize" text size as a Double

Return Value

0 if no errors. Non-zero if errors. Use TCWLastErrorGet to retrieve error string.

See Also

Example



GRAPHICS - Graphic Functions


TCWGraphicCount

This function will return the number of graphics in the drawing or it will return
the number of graphics contained in a graphic. If you supply a drawing handle as
the first parameter to the function, the count will be the number of top level
graphics in the drawing. If you supply a graphic handle as the first parameter to
the function, the count will be the number of graphics contained in the graphic.
This function can be used with TCWGraphicAt to cycle through all the graphics in the
drawing or graphic.

Input Parameters

Long handle handle of the drawing or graphic

Return Value

Number of graphics in the drawing or graphic as a Long.

See Also

TCWGraphicAt

Example



TCWGraphicAt

This function will return the handle to the requested graphic. The index
should be a number from 0 to the value-1 returned by TCWGraphicCount. If you
are cycling through the graphics in the drawing, use the drawing handle you
used with TCWGraphicCount. If you are cycling through the graphics within a
graphic, use the graphic handle you used with TCWGraphicCount.

Input Parameters

Long handle handle to a drawing or a graphic
Long index requested graphic index

Return Value

Handle of the graphic as a Long.

See Also

Example



TCWGraphicAppend

This function will add a graphic to the active drawing.

Input Parameters

Long g1 if NULL, add to drawing, otherwise add graphic to this parent graphic
Long g2 graphic to add to drawing

Return Value

0 if no errors. Non-zero if an error occurred. Use TCWLastErrorGet to retrieve
error string.

See Also

Example



TCWGraphicXYZAdd

This function will add the next segment to the multiline that is in
progress.

Input Parameters

Long g graphic to add next point to
Double x0 X coordinate of point
Double y0 Y coordinate of point
Double z0 Z coordinate of point

Return Value

0 if no errors. Non-zero if an error occurred. Use TCWLastErrorGet to retrieve
error string.

See Also

TCWGraphicClose, TCWGraphicVertexAdd

Example



TCWGraphicClose

This function will close the multiline, making the last point the same
as the first point.

Input Parameters

Long g graphic to close

Return Value

0 if no errors. Non-zero if an error occurred. Use TCWLastErrorGet to retrieve
error string.

See Also

TCWGraphicXYZAdd, TCWGraphicVertexAdd

Example



TCWGraphicVertexAdd

This function will add a vertex to a graphic in the active drawing.

Input Parameters

Long g graphic
Long v vertex to add to graphic

Return Value

0 if no errors. Non-zero if an error occurred. Use TCWLastErrorGet to retrieve
error string.

See Also

Example



TCWVertexAppend

This function will add a vertex to the specified graphic.

Input Parameters

Long g handle of graphic
Double x0 X coordinate of vertex
Double y0 Y coordinate of vertex
Double z0 Z coordinate of vertex

Return Value

0 if no errors. Non-zero if an error occurred. Use TCWLastErrorGet to retrieve
error string.

See Also

Example



TCWGraphicCopy

This function will make a new graphic with the same properties as
the specified graphic. The graphic is not added to the drawing. You
must explicitly do this. Use TCWGraphicAppend with the first parameter
NULL to add the graphic to the drawing. use TCWGraphicApend with the
first parameter being the handle of the graphic that will be the
parent of the appended graphic.

Input Parameters

Long g graphic to copy

Return Value

Returns the handle to the new graphic as a Long.

See Also

Example



TCWGraphicDispose

This function will delete the specified graphic.

Input Parameters

Long g graphic to delete

Return Value

0 if no errors. Non-zero if an error occurred. Use TCWLastErrorGet to retrieve
error string.

See Also

Example



TCWGraphicCreate

This function will create a new graphic with the default drawing setting. TurboCAD internal
types available are GK_GRAPHIC = 11 (polyline) and GK_ARC = 2.

If you create your own Smart Object (TurboCAD v4 custom shapes), then supply the appropriate
regen name for the object (use GK_GRAPHIC for the kind).

Input Parameters

Long kind kind of graphic to make
String regenmethodRegen method if external regenerated graphic, use "" if TurboCAD type

Return Value

Returns the handle to the new graphic as a Long.

See Also

Example



TCWGraphicDraw

This function will draw the graphic on the drawing.

Input Parameters

Long g handle of graphic
Long mode 0 is normal and 1 is inverted

Return Value

0 if no errors. Non-zero if an error occurred. Use TCWLastErrorGet to retrieve
error string.

See Also

Example



TCWGraphicHandleFromID

This function will return the graphic handle from the unique database id.

Input Parameters

Long id unique id of graphic

Return Value

The handle of the graphic. If 0, use TCWLastErrorGet to retrieve error string.

See Also

Example



TCWGraphicReferencePointSet

This function will set the graphic's reference point, using the
vertex supplied.

Input Parameters

Long g graphic handle
Long v vertex for new reference point

Return Value

0 if no errors. Non-zero if an error occurred. Use TCWLastErrorGet to retrieve
error string.

See Also

Example



TCWGraphicReferencePointGet

This function will return the graphic reference point.

Input Parameters

Long g graphic handle

Return Value

The the reference point vertex handle as a long. If 0, use TCWLastErrorGet to
retrieve the error text.

See Also

Example



GRAPHICS - Selection Manipulation Functions

The following group of functions work on the currently selected graphics in the drawing. They can be used in conjunction with TCWSelectionCount and TCWSelectionAt to cycle through all the graphics in the drawing.


TCWSelectionScale

Will scale the selected graphics in the x, y and z direction. A value of 1.0 in
any parameter will not change the scale.

Input Parameters

Double xscale X scale factor
Double yscale Y scale factor
Double zscale Z scale factor
Double x0 x coordinate of reference point
Double y0 y coordinate of reference point
Double z0 z coordinate of reference point

Return Value

0 if no errors. Non-zero if an error occurred. Use TCWLastErrorGet to retrieve
error string.

See Also

Example



TCWSelectionMove

This function will move the selected graphic to the new coordinates.

Input Parameters

Double dx delta x coordinate to move selected graphic
Double dy delta y coordinate to move selected graphic
Double dz delta z coordinate to move selected graphic

Return Value

0 if no errors. Non-zero if an error occurred. Use TCWLastErrorGet to retrieve
error string.

See Also

Example



TCWSelectionRotate

This function will rotate the selected graphics by the rotation angle
supplied.

Input Parameters

String axis "X", "Y", or "Z" where "X" means rotate in the Y-Z plane
Double angle rotation angle in radians
Double x0 x coordinate of reference point
Double y0 y coordinate of reference point
Double z0 z coordinate of reference point

Return Value

0 if no errors. Non-zero if an error occurred. Use TCWLastErrorGet to retrieve
error string.

See Also

Example



TCWCreateHatch

This function will apply a hatch pattern to the selected graphics.

Input Parameters

None

Return Value

0 if no errors. Non-zero if an error occurred. Use TCWLastErrorGet to retrieve
error string.

See Also

Example



TCWGroupCreate

This function will create a group out of the selected graphics.

Input Parameters

String groupnamename of group

Return Value

0 if no errors. Non-zero if an error occurred. Use TCWLastErrorGet to retrieve
error string.

See Also

Example



TCWExplode

This function will explode a selected group or block into its individual
graphics. If the selected graphic is a simple graphic such as a line, the
function has no effect.

Input Parameters

None

Return Value

0 if no errors. Non-zero if an error occurred. Use TCWLastErrorGet to retrieve
error string.

See Also

Example



TCWBringtoFront

This function will move the selected graphics to the front of the drawing.

Input Parameters

None

Return Value

0 if no errors. Non-zero if an error occurred. Use TCWLastErrorGet to retrieve
error string.

See Also

Example



TCWSendtoBack

This function will move the selected graphics to the back of the drawing.

Input Parameters

None

Return Value

0 if no errors. Non-zero if an error occurred. Use TCWLastErrorGet to retrieve
error string.

See Also

Example



TCWAlignBottom

This function will align the bottoms of the selected graphics.

Input Parameters

None

Return Value

Returns the handle of the first selected graphic as a Long.

See Also

Example



TCWAlignTop

This function will align the tops of the selected graphics.

Input Parameters


Return Value

Returns the handle of the first selected graphic as a Long.

See Also

Example



TCWAlignMiddle

This function will align the middles of the selected graphics.

Input Parameters

None

Return Value

Returns the handle of the first selected graphic as a Long.

See Also

Example



TCWAlignLeft

This function will align the left sides of the selected graphics.

Input Parameters

None

Return Value

Returns the handle of the first selected graphic as a Long.

See Also

Example



TCWAlignRight

This function will align the right sides of the selected graphics.

Input Parameters

None

Return Value

Returns the handle of the first selected graphic as a Long.

See Also

Example



TCWAlignCenter

This function will align the centers of the selected graphics.

Input Parameters

None

Return Value

Returns the handle of the first selected graphic as a Long.

See Also

Example



GRAPHICS - Get and Set Property Functions


TCWGraphicPropertyGet

This function will return the value of the property that has been
requested. This function is written in Basic because of limitations
within Enable Basic for Variants and DLLs.

Input Parameters

Long graphic graphic to get property from
String propertynamename of property look up
AVAILABLE PROPERTIES: DESCRIPTION:
"BrushAngle" brush angle as a Double
"BrushColor" brush color as &H00bbggrr or -3 for by layer, -4 for by block or -5 for by pen
"BrushDrawMode" brush drawing mode as n Integer
"BrushScale" brush scale as a Double
"BrushStyle" brush style as a Double
"DatabaseID" unique id for graphic
"HatchCross" hatch cross as an Integer
"Info" info string as a String
"Layer" layer id as an Integer
"LimitVertices" if true, node-edit cannot insert or delete vertices
"PenAlignment" pen alignment as a String
"PenColor" pen color as &H00bbggrr or -3 for by layer, -4 for by block
"PenScale" pen scale as a Double
"PenStyle" pen style as a Integer
"PenWidth" pen width as a Double
"ScaleSystem" 0 for world, 1 for paper, 2 for device
"Selected" selected flag as a Long
"TextFont" text font as a String
"TextFormat" 0 for left justify, 1 for center, 2 for right justify
"TextSize" text size as a Double
"TextStyle" flags: &H0000 = regular, &H0001 = italic, &H0002 = bold, &H0004 = strikethru, &H0008 = hidden, &H0040 = allcaps
"Closed" closed flag as a Long (READ ONLY)
"Kind" graphic type as a Long (READ ONLY)
"RegenMethod" regen method name as a String (READ ONLY)

Return Value

Value of property requested.
AVAILABLE PROPERTIES: VALUE RETURNED:
"BrushAngle" (Double)
"BrushColor" (Long)
"BrushDrawMode" (Integer)
"BrushScale" (Double)
"BrushStyle" (Double)
"DatabaseID" (Long)
"HatchCross" (Integer)
"Info" (String)
"Layer" (Integer)
"LimitVertices" (Integer)
"PenAlignment" (String)
"PenColor" (Long)
"PenScale" (Double)
"PenStyle" (Integer)
"PenWidth" (Double)
"ScaleSystem" (Integer)
"Selected" -1 if selected, 0 if not (Long)
"TextFont" (String)
"TextFormat" (Integer)
"TextSize" (Double)
"TextStyle" (Integer)
"Closed" -1 if closed, 0 if not (Long - READ ONLY)
"Kind" GK_nnnnn (Long - READ ONLY)
"RegenMethod" (String - READ ONLY)

See Also

Example



TCWGraphicPropertySet

This function will set the property with the specified value.

Input Parameters

Long graphic graphic to set property for
String propertyname name of property to modify
Variant value value to set to
AVAILABLE PROPERTIES: VALUE:
"BrushAngle" (Double)
"BrushColor" &H00bbggrr or -3 for by layer, -4 for by block or -5 for by pen (Long)
"BrushDrawMode" (Integer)
"BrushScale" (Double)
"BrushStyle" (Integer)
"DatabaseID" (Long)
"HatchCross" (Integer)
"Info" (String)
"Layer" (Integer)
"LimitVertices" (Integer)if true, node-edit cannot insert or delete vertices
"PenAlignment" (String)
"PenColor" &H00bbggrr or -3 for by layer, -4 for by block (Long)
"PenWidth" 1.5 (Double)
"PenScale" 1 (Double)
"PenStyle" (Integer)
"ScaleSystem" 0 for world, 1 for paper, 2 for device (Integer)
"Selected" 1 to select, 0 to deselect (Integer)
"TextStyle" flags: &H0000 = regular, &H0001 = italic, &H0002 = bold, &H0004 = strikethru, &H0008 = hidden, &H0040 = allcaps (Integer)
"TextFont" (String)
"TextFormat" 0 for left justify, 1 for center, 2 for right justify (Integer)
"TextSize" (Double)

Return Value

0 if no errors. Non-zero if errors. Use TCWLastErrorGet to retrieve error string.

See Also

Example



GRAPHICS - Vertex Functions


TCWVertexCount

This function will return the number vertices in the specified graphic.

Input Parameters

Long g graphic to count vertices in

Return Value

Number of vertices as a Long.

See Also

Example



TCWVertexAt

This function will return the handle to the vertex requested. Valid index
numbers are 0 to the number-1 returned by VertexCount.

Input Parameters

Long g graphic to get vertex from
Long index vertex to return

Return Value

Handle to vertex as a Long.

See Also

Example



TCWVertexCreate

This function will create a new vertex at the specified coordinates.

Caller is responsible for disposing of this object unless it is added to a graphic.

Input Parameters

Double x0 X coordinate of vertex
Double y0 Y coordinate of vertex
Double z0 Z coordinate of vertex

Return Value

Returns the handle to the new vertex as a Long.

See Also

Example



TCWVertexZero

This function will create a new vertex at the coordinates 0,0,0.

Caller is responsible for disposing of this object unless it is added to a graphic.

Input Parameters

None

Return Value

Returns the handle to the new vertex as a Long.

See Also

Example



TCWVertexCopy

This function will create a new vertex that is initialized to the
same coordinates as the vertex specified.

Input Parameters

Long v handle of a vertex to copy

Return Value

Returns the handle to the new vertex as a Long.

See Also

Example



TCWVertexDispose

This function will delete the specified vertex.

Input Parameters

Long v handle of a vertex to delete

Return Value

0 if no errors. Non-zero if an error occurred. Use TCWLastErrorGet to retrieve
error string.

See Also

Example



TCWGetX

This function will return the X coordinate of a vertex.

Input Parameters

Long v handle of a vertex

Return Value

X coordinate as a Double.

See Also

Example



TCWSetX

This function will set the X coordinate of a vertex.

Input Parameters

Long v handle of a vertex
Double x0 coordinate value

Return Value

0 if no errors. Non-zero if an error occurred. Use TCWLastErrorGet to retrieve
error string.

See Also

Example



TCWGetY

This function will return the Y coordinate of a vertex.

Input Parameters

Long v handle of a vertex

Return Value

Y coordinate as a Double.

See Also

Example



TCWSetY

This function will set the Y coordinate of a vertex.

Input Parameters

Long v handle of a vertex
Double y0 coordinate value

Return Value

0 if no errors. Non-zero if an error occurred. Use TCWLastErrorGet to retrieve
error string.

See Also

Example



TCWGetZ

This function will return the Z coordinate of a vertex.

Input Parameters

Long v handle of a vertex

Return Value

Z coordinate as a Double.

See Also

Example



TCWSetZ

This function will set the Z coordinate of a vertex.

Input Parameters

Long v handle of a vertex
Double z0 coordinate value

Return Value

0 if no errors. Non-zero if an error occurred. Use TCWLastErrorGet to retrieve
error string.

See Also

Example



TCWSetXY

This function will set the X and Y coordinates of a vertex.

Input Parameters

Long v handle of a vertex
Double x0 x coordinate value
Double y0 y coordinate value

Return Value

0 if no errors. Non-zero if an error occurred. Use TCWLastErrorGet to retrieve
error string.

See Also

Example



TCWSetXYZ

This function will set the X, Y and Z coordinates of a vertex.

Input Parameters

Long v handle of a vertex
Double x0 x coordinate value
Double y0 y coordinate value
Double z0 z coordinate value

Return Value

0 if no errors. Non-zero if an error occurred. Use TCWLastErrorGet to retrieve
error string.

See Also

Example



TCWPenDown

This function will set the state for the pen. Sets the up or down
state of the pen at the specified vertex.

Input Parameters

Long v handle of a vertex
Long state TRUE if pen should be down

Return Value

0 if no errors. Non-zero if an error occurred. Use TCWLastErrorGet to retrieve
error string.

See Also

Example



VIEW - Functions


TCWViewAt

This function will activate the specified view.

Input Parameters

Long index view number

Return Value

Returns the handle to the view as a Long.

See Also

TCWViewCount, TCWViewActive

Example



TCWViewCount

This function will return the number of views that are open.

Input Parameters

None

Return Value

Count of the number of open views as a Long.

See Also

TCWViewAt, TCWViewActive

Example



TCWViewActive

This function will return the handle to the active view.

Input Parameters

None

Return Value

Handle to view as a Long.

See Also

TCWViewAt, TCWViewCount

Example



TCWViewRedraw

This function will force a redraw on the current view.

Input Parameters

None

Return Value

0 if no errors. Non-zero if an error occurred. Use TCWLastErrorGet to retrieve
error string.

See Also

Example



TCWViewUpdateWindow

This function will flush any remaining paint messages to the view.

Input Parameters

None

Return Value

0 if no errors. Non-zero if an error occurred. Use TCWLastErrorGet to retrieve
error string.

See Also

Example



TCWViewZoom

This function will zoom the current view to full view.

Input Parameters

None

Return Value

0 if no errors. Non-zero if an error occurred. Use TCWLastErrorGet to retrieve
error string.

See Also

Example



TCWViewZoomIn

This function will zoom in the current view. The amount of zoom is
determined by the zoom factor setting on the Options|Program Setup|General
property page.

Input Parameters

None

Return Value

0 if no errors. Non-zero if an error occurred. Use TCWLastErrorGet to retrieve
error string.

See Also

Example



TCWViewZoomOut

This function will zoom out the current view. The amount of zoom is
determined by the zoom factor setting on the Options|Program Setup|General
property page.

Input Parameters

None

Return Value

0 if no errors. Non-zero if an error occurred. Use TCWLastErrorGet to retrieve
error string.

See Also

Example



TCWViewZoomPage

This function will zoom to the printed page size.

Input Parameters

None

Return Value

0 if no errors. Non-zero if an error occurred. Use TCWLastErrorGet to retrieve
error string.

See Also

Example



TCWViewZoomExtents

This function will zoom to a view that contains all of the objects in the drawing.

Input Parameters

None

Return Value

0 if no errors. Non-zero if an error occurred. Use TCWLastErrorGet to retrieve
error string.

See Also

Example



TCWViewZoomWindow

This function will zoom to a view that is bounded by the rectangle points
specified.

Input Parameters

Double x0 X coordinate of top left corner of rectangle
Double y0 Y coordinate of top left corner of rectangle
Double z0 Z coordinate of top left corner of rectangle
Double x1 X coordinate of lower right corner of rectangle
Double y1 Y coordinate of lower right corner of rectangle
Double z1 Z coordinate of lower right corner of rectangle

Return Value

0 if no errors. Non-zero if an error occurred. Use TCWLastErrorGet to retrieve
error string.

See Also

Example



TCWViewExtentsGetX1

This function will return x coordinate which represents the bottom left
corner of the view.

Input Parameters

None

Return Value

x coordinate as a Double.

See Also

TCWViewExtentsGetY1, TCWViewExtentsGetZ1, TCWViewExtentsGetX2, TCWViewExtentsGetY2,

Example

Find center of screen
xc = (TCWViewExtentsGetX1() + TCWViewExtentsGetX2())/2
yc = (TCWViewExtentsGetY1() + TCWViewExtentsGetY2())/2

' Create the empty circle graphic
g = TCWCircleCenterAndPoint(xc, yc, 0.0, xc, yc+3, 0.0)


TCWViewExtentsGetY1

This function will return y coordinate which represents the bottom left
corner of the view.

Input Parameters

None

Return Value

y coordinate as a Double.

See Also

TCWViewExtentsGetX1, TCWViewExtentsGetZ1, TCWViewExtentsGetX2, TCWViewExtentsGetY2,

Example

Find center of screen
xc = (TCWViewExtentsGetX1() + TCWViewExtentsGetX2())/2
yc = (TCWViewExtentsGetY1() + TCWViewExtentsGetY2())/2

' Create the empty circle graphic
g = TCWCircleCenterAndPoint(xc, yc, 0.0, xc, yc+3, 0.0)


TCWViewExtentsGetZ1

This function will return z coordinate which represents the bottom left
corner of the view.

Input Parameters

None

Return Value

z coordinate as a Double.

See Also

TCWViewExtentsGetX1, TCWViewExtentsGetY1, TCWViewExtentsGetX2, TCWViewExtentsGetY2,

Example

Find center of screen
xc = (TCWViewExtentsGetX1() + TCWViewExtentsGetX2())/2
yc = (TCWViewExtentsGetY1() + TCWViewExtentsGetY2())/2

' Create the empty circle graphic
g = TCWCircleCenterAndPoint(xc, yc, 0.0, xc, yc+3, 0.0)


TCWViewExtentsGetX2

This function will return x coordinate which represents the top right
corner of the view.

Input Parameters

None

Return Value

x coordinate as a Double.

See Also

TCWViewExtentsGetX1, TCWViewExtentsGetY1, TCWViewExtentsGetZ1, TCWViewExtentsGetY2,

Example

Find center of screen
xc = (TCWViewExtentsGetX1() + TCWViewExtentsGetX2())/2
yc = (TCWViewExtentsGetY1() + TCWViewExtentsGetY2())/2

' Create the empty circle graphic
g = TCWCircleCenterAndPoint(xc, yc, 0.0, xc, yc+3, 0.0)


TCWViewExtentsGetY2

This function will return y coordinate which represents the top right
corner of the view.

Input Parameters

None

Return Value

y coordinate as a Double.

See Also

TCWViewExtentsGetX1, TCWViewExtentsGetY1, TCWViewExtentsGetZ1, TCWViewExtentsGetX2,

Example

Find center of screen
xc = (TCWViewExtentsGetX1() + TCWViewExtentsGetX2())/2
yc = (TCWViewExtentsGetY1() + TCWViewExtentsGetY2())/2

' Create the empty circle graphic
g = TCWCircleCenterAndPoint(xc, yc, 0.0, xc, yc+3, 0.0)


TCWViewExtentsGetZ2

This function will return z coordinate which represents the top right
corner of the view.

Input Parameters

None

Return Value

z coordinate as a Double.

See Also

TCWViewExtentsGetX1, TCWViewExtentsGetY1, TCWViewExtentsGetZ1, TCWViewExtentsGetX2,

Example

Find center of screen
xc = (TCWViewExtentsGetX1() + TCWViewExtentsGetX2())/2
yc = (TCWViewExtentsGetY1() + TCWViewExtentsGetY2())/2

' Create the empty circle graphic
g = TCWCircleCenterAndPoint(xc, yc, 0.0, xc, yc+3, 0.0)


LAYERS - Management Functions


TCWLayersCount

This function will return the number of layers in the active drawing.

Input Parameters

None

Return Value

Count of the number of layers as a Long.

See Also

Example



TCWLayersAt

This function will return the layer in the active drawing, requested by the index.

Input Parameters

None

Return Value

Handle to the layer as a Long.

See Also

Example



TCWLayerCreate

This function will create a new layer in the active drawing. If the layer
already exits, the settings are overwritten.

Input Parameters

String lName name of layer
Integer visibleTRUE if visible
Integer frozenTRUE if graphics on layer cannot be edited or selected
Integer ReadOnlyTRUE if graphics on layer cannot be edited
Long lColor color as &H00bbggrr
Long lLineStyleline style

Return Value

Layer ID or 0 if layer could not be created. Use TCWLastErrorGet to
retrieve error string.

See Also

TCWLayerDispose

Example



TCWLayerDispose

This function will delete the layer in the active drawing, requested by the index.

Input Parameters

Long Index layer to delete

Return Value

0 if no errors. Non-zero if an error occurred. Use TCWLastErrorGet to retrieve
error string.

See Also

Example



LAYERS - Get and Set Property Functions


TCWLayerPropertyGet

This function will return the value of the property that has been
requested. This mechanism is being used to get around Enable 3.0
non-support for Variants in DLLs.

Input Parameters

Long layer layer id returned from LayerAt
String propertyname name of property look up
AVAILABLE PROPERTIES: DESCRIPTION:
"Color" layer color
"Frozen" graphics on layer are non editable and non selectable
"LineStyle" layer line style
"Name" layer name
"Readonly" graphics on layer are read only
"Visible" is layer visible in drawing

Return Value

Value of property requested
AVAILABLE PROPERTIES: VALUE RETURNED:
"Color" &H00bbggrr as a Long
"Frozen" -1 if frozen, 0 if not
"LineStyle" layer line style as a Long
"Name" layer name as a String
"Readonly" -1 if read only, 0 if not
"Visible" -1 if visible, 0 if not

See Also

Example

Dim dActive As Long
Dim count As Long
Dim i As Long
Dim LayerID As Long
Dim LayVar As String
Dim Result As Variant
Sub Main
LayVar = "c:\imsi\tcw40\Samples\mouse.tcw"
TCWDrawingOpen "c:\imsi\tcw40\Samples\mouse.tcw"

count = TCWLayersCount()
MsgBox count
i = 1
LayVar = "Name"
Do While (i <> count)
LayerID = TCWLayersAt(i)
Result = TCWLayerPropertyGet(LayerID, LayVar)
MsgBox Result
i = i + 1
Loop
MsgBox "Finished"

End Sub


TCWLayerPropertySet

This function will set the property with the specified value.

Input Parameters

Long layer layer id
String propertyname name of property to modify
Variant value value to set to
AVAILABLE PROPERTIES: VALUES:
"Color" &H00bbggrr
"Frozen" 1 to set frozen, 0 to unset
"Linestyle" Long
"Name" String
"Readonly" 1 to set readonly, 0 to unset
"Visible" 1 to set visible, 0 to unset

Return Value

0 if no errors. Non-zero if errors. Use TCWLastErrorGet to retrieve error string.

See Also

Example



FILE I/O - Functions


TCWOpenInput

This function will open a text file for input.

Input Parameters

String filename name of file to open for reading.

Return Value

Handle to the file as a Long. If return value is 0, use TCWLastErrorGet to
retrieve error string.

See Also

TCWCloseInput, TCWReadInput, TCWReadInputToken

Example



TCWReadInputToken

This function reads characters from the input file (fd) until it reaches a:
space, next line, of eof or the max number of characters has been read (256).

Input Parameters

Long fd file descriptor returned by TCWOpenInput
String strtext buffer for data to be read into

Return Value

0 if no errors
-1 if EOF seen
Non-zero (not -1) if errors. Use TCWLastErrorGet to retrieve error string.

See Also

TCWOpenInput, TCWCloseInput, TCWReadInput

Example



TCWReadInput

This function reads the entire line from the input file (fd) into the buffer pbstrBuffer.
The line separator character is '\n'. '\r' is ignored.

Input Parameters

Long fd file descriptor returned by TCWOpenInput
String strtextbuffer for data to be read into

Return Value

0 if no errors
-1 if EOF seen
Non-zero (not -1) if errors. Use TCWLastErrorGet to retrieve error string.

See Also

TCWCloseInput, TCWOpenInput, TCWReadInputToken

Example



TCWCloseInput

This function closes the input file.

Input Parameters

Long fd file descriptor returned by TCWOpenInput

Return Value

0 if no errors. Non-zero if an error occurred. Use TCWLastErrorGet to retrieve
error string.

See Also

TCWOpenInput, TCWReadInput, TCWReadInputToken

Example



TCWOpenOutput

This function will open a text file for output.

Input Parameters

String filename name of file to open for writing.

Return Value

Handle to the file as a Long. If return value is 0, use TCWLastErrorGet to
retrieve error string.

See Also

TCWCloseOutput, TCWWriteOutput

Example



TCWWriteOutput

This function writes the buffer bstrBuffer to the file (fd).

Input Parameters

Long fd file descriptor returned by TCWOpenOutput
String strtext buffer for data to be read into
Note thatmax number of bytes you can write is 0xFFFE (65534).

Return Value

0 if no errors. Non-zero if an error occurred. Use TCWLastErrorGet to retrieve
error string.

See Also

TCWCloseOutput, TCWOpenOutput

Example



TCWCloseOutput

This function closes the output file.

Input Parameters

Long fd file descriptor returned by TCWOpenOutput

Return Value

0 if no errors. Non-zero if an error occurred. Use TCWLastErrorGet to retrieve
error string.

See Also

TCWOpenOutput, TCWWriteOutput

Example



SCREEN - Mouse to Point Functions


TCWGetPoint

This function will set the vertex to the value of the next mouse pick in the
active viewport. The user should use the left mouse button. A value will not be
returned until the mouse button is released.

Input Parameters

Long v handle to a vertex
String prompt prompt for user
Long g handle of a graphic to drag (or NULL)
Long vd reference to a vertex in the drag graphic (or NULL)
Long os snap modes which give "magnetic: functionality
Long cursor 1 for arrow, 2 for cross, 3 for ibeam

Return Value

0 if no errors. Non-zero if an error occurred. Use TCWLastErrorGet to retrieve
error string.

See Also

TCWVertexFindVertex, TCWVertexFindGraphic

Example



TCWVertexFindVertex

This function will update the supplied vertex's X, Y, and Z coordinates with the
X, Y, and Z coordinates of the closest vertex based on the snap mode used.

Input Parameters

Long v handle to a vertex
Long os snap modes which are active combination of the following values:
. . SNAP_NEARESTPOINT 0x0008
. . SNAP_MIDPOINT 0x0020
. . SNAP_CENTER 0x0040
. . SNAP_QUADRANTPOINT 0x0080
. . SNAP_ANYPOINT 0x00FC
. . SNAP_NEARESTENTITY 0x0100 (overrides other snaps)

Return Value

0 if no errors. Non-zero if an error occurred. Use TCWLastErrorGet to retrieve
error string. Input parameter is updated to reflect closest vertex.

See Also

TCWVertexFindGraphic

Example



TCWVertexFindGraphic

This function with return the handle to the graphic that is closest to the
supplied vertex.

Input Parameters

Long v handle to a vertex

Return Value

0 if no errors. Non-zero if an error occurred. Use TCWLastErrorGet to retrieve
error string.

See Also

TCWVertexFindVertex

Example


Copyright ©1997 IMSI --All Rights Reserved.