Thursday, November 13, 2008

DIECAL - It's DIESEL Enhanced with a Mathematical Engine

In the last post I mentioned that I could come up with some better posts after the vacation, with the help of a refreshed mind. Hope this post justifies my words.

The absence of a strong mathematical engine inside DIESEL has troubled most of us in the past. We are going to overcome this limitation by mixing up DIESEL with the command line calculater. It should work in AutoCAD LT as command line calculator has been included in LT2009.If you compare, DIECAL capabilities are far better than DIESEL. Using DIECAL, you can do vector calculations, access various numeric functions which are not available in DIESEL and can do so many other things. If you are not convinced, here is a sample macro to draw a sphere by placing points across the surface of a sphere.

*^C^Csetvar;userr1;$M=$(+,$(getvar,userr1),$(getvar,userr4));$(if,$(>=,$(getvar,userr1),360),setvar;userr2;$
(+,$(getvar,userr2),$(getvar,userr5));setvar;userr1;0;)_Point;'CAL;[$(getvar,userr3)
<$(+,$(getvar,userr1),$(getvar,userr4))<$(getvar,userr2)];$(if,$(>,$(getvar,userr2),270),^c)


This macro uses USERR1 to USERR5 system variables to store values. The USERR1 and USERR2 system variable values are handled by the above macro. The USERR3 system variable stores the radius of the sphere, USERR4 holds the angle between the horizontal points and USERR5 holds the angle between vertical points. These values can be set/reset using the following macro. When you run this macro, just follow the instructions shown in the status bar.

^C^C_setvar;userr1;0;;userr2;90;_modemacro;Enter sphere radius:;userr3;\_modemacro;Enter angle between horizontal points:;userr4;\_modemacro;Enter angle between vertical points:;userr5;\_modemacro;.;

Please remember to run this macro to set/reset values before using the main macro.The first macro makes use of the Spherical Coordinate System point format entry to place points across the surface of the sphere.Please note that the CAL command has to be invoked transparently ('CAL) in the macro in order to output the result of calculation to the active command. It's my lack of knowledge in mathematics that prevents me from showing off a powerful application to exihibit the true potential of DIECAL. Those who know trigonometry and vector algebra will really enjoy this method. Following are some sample spheres made using different radius and angle values.


Point Sphere - 3D View



Point Sphere - Top View

Due to the presence of 3D elements, I am not quite sure whether the LT people can use the above macro. But they can surely develop a lot of advanced macros using DIECAL. To get an idea of things that can be done using DIECAL, refer to command line calculator section in AutoCAD help. Now even AutoCAD LT seems to be really unlimited. Doesn't it?

No comments: