I pieced together this routine which draws a line from its midpoint..
I added error handler and echo off...
The LISP executes fine but it gives me an "; error: AutoCAD variable setting rejected: CMDECHO nil" message... not sure how to fix it. It also spits out some coordinates at the end of the routine that I'd like to get rid of (which echo off should take care of right?)
Currently it allows me to pick a point and displays the default dashed rubber band/cursor tracer line. I would like for it to be dynamic where it shows the preview of the actual line in both directions from starting point and the rubber band/tracer line as well... Similar to when you draw a circle and type "D" for diameter: it shows a preview of said circle and the rubber band/tracer line extends past it the length of the radius...
Thanks in advance...
One last thing... I'm super new at LISPing so please be as detailed as possible... Thanks again
MidLine LISP:
Note that the _EndUndoMark subfunction should be wrapped within a while loop, so substitute the if function with while - it was explained somewhere why (so I won't bother).
I guess I don't need CMDECHO for your simplified version since it stopped displaying those weird coordinates... as for error handling: so that it won't display the "error; function cancelled" message if I press escape key mid command..
I was just under the impression that these two elements are standard procedure when LISPing... forgive my ignorance if that's completely false but...
Ultimately the routine works as intended... I'm just trying to fine tune it to my preference and to try to grasp some of the concepts of this awesome programming language
If you add the princ function at the end then this should prevent that to happen.
Yes you can add the error handler but if you want to cancel the command from continuing then a sample hit on the space bar or enter should exit the command quietly and safely.
No worries, you are doing just well with your initial believes & thoughts about programming.
Upon further research I discovered that i need to add GRREAD to my code in order to get a dynamic preview of the line... I just don't have a clue how to incorporate it and have it display the line dynamically in both directions from starting mid-point. Any insight on this would be greatly appreciated.