Cmray.jpg (3339 bytes) Power Tip

From CADD Master Ray

Linking External Functions

GenericCADD.com          Home     Discussion    Legal Disclaimer    

From the July 1993 issue of Autodesk Retail Software News

When Generic CADD 6.0's most recent award, the PC Magazine Editor's Choice, came out,   I scanned the comparison charts to see what features they felt might be even further improved. I was surprised to see one item in particular that was found to be lacking, the ability to link external routines into the macro programming language. I was surprised because I've done it.

Why link to external programs?

One might want to use an external program within a macro for a number of reasons. One is that you might already have a program that you want to use. Another is that the task that you want to accomplish is simpler or more efficient in, say, Quick Basic or Turbo Pascal. Finally, the task that you are trying to automate may be impossible with the macro language, such as a task which requires recursion.

As noted, the external program may be written in your favorite programming language. For smoothest operation, it should have no interface, but simply do its job when executed. This will typically involve reading information from a file, modifying the data or creating new data, then writing it back into the same or a new file.

Many times, this new data will take the form of a list of points, to be read by Generic CADD as end points of lines, or points on a curve, for example.

Steps to link external Programs

This following steps are typically used to link an external program:
   1. Acquire parameters into variables with the /PROMPT and standard Generic CADD user input macro commands, @ and -.
   2. Open and write these variables into a file. Be sure to use a format that your external program will understand.
   3. Run the external program. This program should read the file, perform whatever functions are required, and write the modified or new data back into the same or a new file.
   4. Back in Generic CADD, open and read the file into Your variables.
   5. Perform whatever functions Generic CADD needs to perform, using the modified variables. As noted above, this might take the form of drawing lines between all the points. The functions can be interwoven with the reading of the file to Process lots of data.

How can this be used ?

I have used this technique to create parameterized fractal trees requiring recursion in Generic CADD 6 through a Turbo Pascal program. The trees became part of the background scenery in a rendering created in Autodesk 3D Studio, using objects created in both Generic CADD 6 and Generic 3D.