DTEXT Lisp Comments & Suggestions

TJARONIK

Usenet Archive
Joined
Jul 25, 2003
Messages
18
Reaction score
0
Hello All,

I must start by telling you that I am no programmer. I just know enough to be dangerous. So please don't laugh at my coding.

I have made a set of DTEXT routines to make the entering of DTEXT with a set justification much easier. Please see the attatched lisp file. I have added comments so that you can see what each line does. I have only added the comments to each line of the first routine. I would like to ask if anyone could give me comments, ideas, suggestions...etc. as to what might make this better or run mo betta. :-) Please understand this is rough. It works as it is now. I am just wanting to see what I might do to make it better.

Thanks in advance !

"Catch" Ya Later
Tim
 
Small Comment: Regards the following

(setq SP "") ; Clear the getpoint variable because this routine is only one of the routines for the dtext command

(setq DIMS "") ; Clear the dimscale variable

 

if you ad declared them Earlier in the:

(defun C:DTC( / )

like

(defun C:DTC( /  sp dims)

They would be local Variables and not need to be cleaned up.

AND OTHER POINT IS THAT (SETQ SP "") DOES NOT ACTUALLY SET THE VARIBLE TO NIL BUT A STRING ZERO LENGTH

TYPE : (TYPE "")

RETURNS : STR

TYPE: (SETQ SP "")

RETURNS: ""

TYPE: (SETQ SP 'NIL)

RETURNS: nil

I have not actually test the routine as yet.

The other thing which is a matter of my own preference is to name the variables with more recognisable names

like when you had:

(setq OSM(getvar "OSMODE"))

(setq ECHO(getvar "cmdecho"))

(setq DTBCL(getvar "CLAYER"))

(setq DTBCS(getvar "TEXTSTYLE"))

(setq DIMS(getvar "DIMSCALE"))

I would use

(setq V:OSMODE(getvar "OSMODE"))

(setq V:CMDECHO(getvar "cmdecho"))

(setq V:CLAYER(getvar "CLAYER"))

(setq V:TEXTSTYLE(getvar "TEXTSTYLE"))

(setq V:DIMSCALE(getvar "DIMSCALE"))

FOR GLOBAL VARIABLES OR

 (setq L:OSMODE(getvar "OSMODE"))

(setq L:CMDECHO(getvar "cmdecho"))

(setq L:CLAYER(getvar "CLAYER"))

(setq L:TEXTSTYLE(getvar "TEXTSTYLE"))

(setq L:DIMSCALE(getvar "DIMSCALE"))

FOR LOCAL VARIABLES AND DECLARE THEM IN THE DEFUN STATEMENT.

 

HOPE MY COMMENTS HELP....

 

MICK,

 

 

 

"TJARONIK" <> wrote:

Hello All,

I must start by telling you that I am no programmer. I just know enough to be dangerous. So please don't laugh at my coding.

I have made a set of DTEXT routines to make the entering of DTEXT with a set justification much easier. Please see the attatched lisp file. I have added comments so that you can see what each line does. I have only added the comments to each line of the first routine. I would like to ask if anyone could give me comments, ideas, suggestions...etc. as to what might make this better or run mo betta. :-) Please understand this is rough. It works as it is now. I am just wanting to see what I might do to make it better.

Thanks in advance !

"Catch" Ya Later
Tim
 
Mick,

Thanks for your comments. I have taken your suggestions and applied them to my routine. What I think I need now is an error trapping routine to reset everything to it's state before running the routine in case someone cancels out of the routine or it crashes for some reason. Any ideas? I am also going to see if I can obtain an error trapping routine with a new thread to the group.

Again, thanks for your input. Greatly appreciated.

"Catch" Ya Later,
Tim
 

Latest threads

Back
Top