The line command is terminated with the empty quote. The easy way to draw lines in lisp is with the command function. That gives us tools to make attractive graph presentations.Īn Axis is a collection of lines. The screen background can be changed to any gray value from white to black by inputting a value between 0-255. In addition there are some simple routines for loading layers and textstyles. Circles instead of lines work well for the Z axis tick marks. The user inputs values for min, max, tick length and tick increment. Here is a lisp DCL program primarily to draw XY Axis or XYZ Axis. This entry was posted in autocad graphing calculator, Autocad VBA Parametrics, AutoLISP, Excel, VBA and tagged Autocad, AutoLISP, parametrics, VBA on Januby frfly. You will be able to read that next year if you remember that xy data starts at the origin. Sub draw_notch_box(W As Double, L As Double, A As Double, B As Double) Interface is top down thinking, but geometry is bottom up. Pass the actual parameters if possible, do not develop them. Make the geometry creation as simple as possible. Put those upstream of the actual sub-routine that draws the geometry. For instance in this example, the parameters A and B, L and W may need to have complicated formulas behind them. Just about every autocad parametric program I have seen or written has been a mess at the actual geometry creation level. In programming 101 they strongly suggest that your subroutines be simple and single purpose. If you have a lot of sub-routines, just declare your x1, x2, etc as public to avoid re-declaring. Subroutines can be written so declared point variables are not required, or required. In VBA we would probably draw in counterclockwise order. Sometimes its convenient to also label points, sometimes its not required, but the xy data must always be figured from the parameters as the first step. This is how you organize your xy data without duplication in a straightforward way. Just label xy coordinates as needed in order from the origin. You can turn this box around any way you wish, move the notch to the middle, put a hole in the middle. There are 3 X coordinates and 3 Y coordinates. Our notched box is L X W with an A X B notch, drawn with the lower left corner at 0,0. This makes no sense without a sketch but the sub p6_box can draw any closed polyline with 6 points configured any way you need it. P7 As Double, p8 As Double, p9 As Double, p10 As Double, p11 As Double, p12 As Double) Sub p6_box(p1 As Double, p2 As Double, p3 As Double, p4 As Double, p5 As Double, p6 As Double, _
After setting the xy data coordinates, any six vertex closed polyline can be drawn withĬall p6_box(x1, y1, x2, y1, x2, y2, x3, y2, x3, 圓, x1, 圓) You make a sub specifically for this purpose. Assume you want to draw a notched rectangle and make it a polyline.
In VBA every variable has to be declared previous to use, so you might lean towards passing xy data. (defun line (x1 y1 x2 y2 obj lyr / pt1 pt2 lineobj) (setq pt1 (pt 0 0) pt2 (pt L 0) pt3 (pt L W) pt4 (pt 0 W)) In a very simple box example this gets called as It requires a point object, but that can be created and passed as a parameter or the xy data can be passed and the point created in the subroutine.įor lisp I made a point creation routine and passed points to the subroutine which runs the Addline method. The object method can draw directly in to a block definition, and it can directly change the layer property. In Lisp I use Visual Lisp objects rather than the “command” method. There are two basic ways to manage your drawing subroutine. This is a special theory for creating the xy data but not a general theory for the entire program. There is no one right way but I have recently worked on both lisp and vba programs and have some specific but not comprehensive suggestions. It won’t be obvious how the points are calculated or why lines are drawn from pt7 to pt21 to pt3. It all might make sense during the coding, but probably won’t a few weeks later when a change has to be made even if the sketch(s) is found. A sketch has to be made with points labeled and equations or formulas entered. The program turns into many lines of hard to read data apparently randomly named. The hard part of coding parametric drawing program whether in lisp or VBA is managing the large number of points.