ON DISK
CAD 3D TO DXF CONVERSION
EXTENDING THE GRAPHIC LIMITS
BY DAVE EDWARDS
The Cyber system makes complex object creation amazingly easy, but until now, you couldn't do photo-realistic rendering of CAD-3D objects. With Dave Edwards' CAD-3D-to-DXF Converter, you can translate your CAD-3D files into an AutoCAD-compatible format and have the entire world of PC and high-end graphics systems available to you. The program runs in medium or high resolution and was written in LDW BASIC.
Move CAD-3D objects to super graphics systems with CAD3DDXF.ARC on Side 1 of your START disk.
I have to admit that I've fallen in love with the CAD-3D family of programs. The entire Cyber system is a complete and very useful animation system, but since much of my work requires IBM PCs, there have been many times that I wished I could have used a CAD-3D file in a PC program. There just aren't any programs available on the PC with the kind of power to create the beautiful objects that CAD-3D and CyberSculpt are known for.
Since virtually the entire PC (and Mac) CAD world uses AutoCAD's Drawing Exchange Format (DXF) for file transfer, it was only right that there should be a DXF translator for CAD-3D files. Such a translator would allow CAD-3D files to be brought into AutoCAD--or any other 3D program that uses the DXF format. I found out that no one had written this program, so I did it myself.
The code I wrote is designed to run in many different BASICs without modification. I use it on my PC-clone compiled under MicroSoft QuickBASIC and on my Atari under LDW BASIC. The code should have no problems even on the Macintosh or the Amiga. I normally run it on the fastest machine I have.
Running the Converter
To convert your files you first must know the target AutoCAD version (Version 9 or 10) and the colors of the CAD-3D objects. In Release 10, the edges of 3DFACEs can be hidden so that a series of triangles can appear as a more complicated surface.
To run the Converter, boot this month's START disk; the START menu program runs automatically. At the main screen, click on Prepare, then select "CAD-3D to DXF Converter." The program will un-ARC directly onto the destination disk you specify.
Double-click on CONV2DXF.PRG. Next, type in the names of the CAD-3D and DXF files. You must include the filename extenders, but you can specify different paths for each. You'll then see a chart of the AutoCAD colors and their corresponding number. The program will then check the CAD-3D object, determine which color scheme was used and ask you to key in the appropriate AutoCAD colors. Once this is finished, it will then process the CAD-3D objects. Your DXF file should then be ready to go straight into AutoCAD or other programs. To abort the program operation, press [Control]-[C].
A couple of comments on the DXF file: CAD-3D files can convert to very large DXF files, so be sure to run the Converter on a hard disk or large RAM disk. (This is the main reason I run it on my PC, because some of the files I've created have been 3MB in size! Also, if the file is going to be used on a PC, you might as well create it there.) In order to make changing colors or other properties in AutoCAD easy, I have assigned the CAD-3D Object Name to be the AutoCAD layer name.
This is a "plain vanilla" program without any GEM bells and whistles, but it has the advantage of being compatible with different BASICs on a number of platforms. On the ST, it runs in LDW BASIC and on the PC, it compiles perfectly under MicroSoft QuickBASIC. |
|
As a test of the program, I loaded Darryl Anderson's ANTHROBOT from Antic Software's Microbot Design disk into CAD-3D and saved the complete file to disk. I then ran the CONV2DXF program and loaded the file into AutoCAD. In AutoCAD, I could move my view around and then do a hidden line removal.
So It's DXF--What Now?
Using this translator, the Atari Cyber system makes a great front end processor for three-dimensional CAD files, but that's certainly not all you can use a DXF file for. There are many firms around the country that do "photo-realistic" renderings of AutoCAD 3D files and they normally don't have translators for Atari files.
To see just what these graphics firms are capable of, I contacted John Wright of Viewpoint Animation Engineers. He was very interested in working with me on this project and couldn't have been more helpful. The DXF file I created first had to be translated by them into a format acceptable to their Personal IRIS system. Then they texture-mapped the surfaces. (Texture mapping is where a computer image of a material such as marble, silver or chrome is "wrapped" around each object.) The objects were then placed into "smoothing groups" which tell the computer which sets of 3D triangles are to be smoothly shaded, removing all of the faceted edges. Finally, they added a granite base and a blue sky with clouds.
The object we used was the Safari Tricycle, also from the Microbot library. As you can see from the illustrations, this photo-realistic technique produces some incredible images. John Wright and his crew had a lot of fun with the file and their hard work really shows. Contact Viewpoint if you want to do renderings like this; they can even do animations of your CAD-3D objects in this quality. Check them out; I owe them a great big thank you!
I hope that this will help users to make this type of file transfer. Objects which can be created easily on the ST would be just about impossible in AutoCAD. Perhaps more AutoCAD 3D users will use STs to create their complicated objects and really blow away some of their competition.
It's also fun to have your own CAD-3D objects photo-realistically rendered. This process is by no means perfected, but it certainly adds a lot to CAD-3D rendering. Be sure, however, to ask for prices before giving the go-ahead; photo-realistic rendering takes a lot of CPU time--and money.
Notes and Limitations
As written, the converter program can only handle object groups with fewer than 5,000 total points. This was done to insure that the program did not exceed the 64K array limits in many BASICs. In LDW BASIC, however, arrays may be of any size up to available memory. If you have the LDW Interpreter and Compiler, you may increase the array dimension to the full 15,000 points available in CAD-3D. Simply change the first program statement DIM T(5000,2) to DIM T(15000,2) and recompile.
Dave Edwards runs a CAD consulting service and is START's resident CAD expert. When he's not writing about CAD, you'll find him training others on VersaCAD. He's also a MIDI consultant, professional drummer and managing editor of "The MIDI Insider, The MIDI Power User's Newsource."
PRODUCTS MENTIONED
Cyber Studio (including CAD-3D 2.0), $89.95; Microbot Design Disk, $29.95. Antic Software, 544 Second Street, San Francisco, CA 94107, (800) 234-7001.
Photo-realistic rendering, call for price. Viewpoint Animation Engineering, 140 South Mountain Way, Orem UT 84058, (801) 225-1905.