TurboCAD Pro v8 was released near the end of 2001. There have been a few changes in the SDK since v7. Most of the changes in v8 appear to me to be the same as were incorporated into the v7 Beta SDK. In fact, the SDK documentation that comes with v8, tcsdk.cfm, is basically the content of the Beta SDK site. (Note that recently – May 2002 – work has resumed on the SDK site).
I am not aware of any official document that outlines the changes in the SDK
from TurboCAD v7 to TurboCAD v8, so as I find them I will add them to this
page.
Changed library reference for 3D Boolean operations.
Changes in TCLight extended properties.
ReferencePoint - New graphic property.
Features previously not implemented.
The 3D Boolean operations are not contained in the libraries
that are references by default when you start the VBA editor. In v7, you had to
reference IMSIGXEX.dll, as shown below. Though the Booleans work about the same
way in v8, they are now contained in a different library; GXExt80.dll. This
means that macros using 3D Booleans in v7 will not run in v8, and vice-versa.
Multi3DBoolAdd.tcm is an
example of a v7 macro using 3D Boolean Add, while v8-MultiBooleanAdd.tcm is the v8
version of the same macro.
(Back to top.)
There are new extended properties for many objects in v8, and in some cases this will prevent v7 macros from working properly in v8. Look at this comparison of extended properties for a graphic object. This table is output from the ExtProps.tcm macro, which I use to study the extended properties of TurboCAD objects. The properties shown in the table happen to be for a text object, but they would look similar for many basic graphic objects, such as lines or circles. Notice that in v7, there were 46 extended properties. In v8, sixteen new extended properties were added, indexed from 46 through 61.
Now look at this comparison of TCLight extended properties. You will see that the same new properties, indexed 46 through 61, were added to TCLights. Except in this case, previously existing properties with the same indices were displaced, and re-indexed. Now let's look at some code to see how this causes problems. The following code is from v7, and would add a Directional light to the active drawing, and change the color to sky blue:
Sub AddDirLight()
Dim tcApp As Application
Dim dr As Drawing
Dim grs As Graphics
Dim gr As Graphic
Set tcApp = IMSIGX.Application
Set dr = tcApp.ActiveDrawing
Set grs = dr.Graphics
Set gr = grs.add(, "TCLight")
gr.Properties(56) = 2 'Property 56 for WTYPE
gr.Vertices.add 0, 0, 10 'first vertex light location
gr.Vertices.add 10, 10, 0 'second vertex light direction
gr.Properties(55) = tcApp.NamedColors("sky blue") 'change light color
End
Notice the lines where the property indices are used to change specific properties. Because of the changes in the indices assignments in v8, this code will cause an error. In order to accomplish the same task in v8, the code must be modified, as shown below:
Sub AddDirLight()
Dim tcApp As Application
Dim dr As Drawing
Dim grs As Graphics
Dim gr As Graphic
Set tcApp = IMSIGX.Application
Set dr = tcApp.ActiveDrawing
Set grs = dr.Graphics
Set gr = grs.add(, "TCLight")
gr.Properties(72) = 2 'Property 72 for WTYPE
gr.Vertices.add 0, 0, 10 'first vertex light location
gr.Vertices.add 10, 10, 0 'second vertex light direction
gr.Properties(71) = tcApp.NamedColors("sky blue") 'change light color
End
This code is identical to the first, except for the changed property indices. In this specific case, if you wanted to write a macro to add a light such as this, and want it to work in both v7 and v8, you need to add a routine to check which version of the program was running, and run the appropriate code. LightArray.tcm is an example of such a macro.
Note that in the case of TCLight objects, you must use the numerical index to specify the property. In order words, to change light type in v8, you must use code like "grLT.Properties(56)" (assuming grLT is a TCLight); using "grLT.Properties("WTYPE") does not work. This is not true of extended properties for all graphic objects. For example, to change the font of a text object, you could refer to the font property of grTXT as either "grTXT.Properties(12)", or "grTXT.Properties("TextFont").
One more comment about the extended properties of TCLight objects. Look at the property comparison table again. Notice that in v7 the properties XPOS, YPOS, ZPOS, XDIR, YDIR, and ZDIR have no value. They seem to have no function in v7. In v8, the values of these properties represent the location and direction of the directional light. This added functionality makes it easy to determine, or change, these light properties.
The ReferencePoint property has been added to Graphic objects in the v8 SDK. In v7, I believe it was possible to get the coordinates of a graphic's reference point, but it required an API declaration.
In v8, it is a simple matter to get the reference point. The ReferencePoint property of a Graphic will return a Vertex object corresponding to the current reference point of the graphic. In the following code sample, a vertex object named "verRefPt" is set equal to the reference point of graphic "grs(0)":
Set verRefPt = grs(0).ReferencePoint
Note that if the reference point of grs(0) is subsequently relocated, the coordinates of verRefPt will also change to match. You may want to use a vertex object to store the coordinates of a graphic's reference point. In that case, you create the vertex first, and then set the coordinates of the vertex equal to those of the reference point, as in the following lines:
Set verRefPt = New Vertex
verRefPt.X = grs(0).ReferencePoint.X
verRefPt.Y = grs(0).ReferencePoint.Y
verRefPt.X = grs(0).ReferencePoint.Z
Now, if the reference point of the graphic grs(0) is moved, its original coordinate values will be stored in vertex verRefPt.
Although the object browser indicates that the ReferencePoint property is "read only", I tried editing the reference points of graphics by assigning new values to ReferencePoint. As far as I can tell, it works fine. For example, this line of code would move the reference point of graphic grs(0) to X = 2 (without changing the Y and Z values):
grs(0).ReferencePoint.X = 2
The macro ScaleMutipleWithMatrix.tcm shows a use of the reference point. The macro scales copies of graphic objects, and leaves the scaled objects with the same reference points as the originals. In the macro, a vertex object is assigned the same coordinate values as the reference point of a graphic object. The vertex object is used in this manner to store the original coordinates of the graphic's reference point. Then the graphic is moved to the USC origin, and then scaled. Finally, the graphic is moved back to the original reference point location, using the coordinates stored in the vertex object.
Anyone who has programmed with VBA in TurboCAD v6 or v7 has surely seen the "Not Implemented" error message. There are many object, methods, and properties that show up in the object browser that are not actually available for use. It looks as if a great effort was made to correct this situation for v8. However, most of the correction was to remove many "not implemented" elements from the object listing. Some, though were implemented.
At this time I'm creating a table of features that were not implemented in v7, and reporting what change was made for v8. This work is going slowly, but I'll probably start posting the table when I have a significant portion of it completed.