I had to correct the line indicated in RED for the error trap. See below. I must have been in a hurry.
Sorry about that.
The Buzzard
[code];//////////////////////////////////////////////////////////////////////////; Start-Up Function(defun C:GL () ;Define function (GL_MF) ;Go to GL_MF ~ Main Function (princ) ;Exit quietly) ;End defun(princ "\nGL.lsp Loaded....") ;print message to command line(princ "\nType GL to start program.") ;print message to command line;;;//////////////////////////////////////////////////////////////////////////; Main Function(defun GL_MF (/ SUCE SUOM SUSM SUAB SUAD MIDPT PLEN PT01 PT02) ;Define function, Declare local variables (setq SUCE (getvar "cmdecho")) ;Save User Command Echo (setq SUOM (getvar "orthomode")) ;Save User Orthomode (setq SUSM (getvar "osmode")) ;Save User Object Snapmode (setq SUAB (getvar "angbase")) ;Save User Angle Base (setq SUAD (getvar "angdir")) ;Save User Angle Direction (setq SUCL (getvar "clayer")) ;Save User Current Layer (setq temperr *error*) ;Save Temporary Error (setq *error* GL_ET) ;Go to GL_ET ~ Error Trap Function (GL_LC "GAS LINE" "3" "GAS_LINE" "") ;Go to GL_LC Layer Function, Layer Name, Color, Linetype & Lineweight (setvar "cmdecho" 0) ;Set Command Echo to 0 (setvar "angbase" 0.0000) ;Set Angle Base to 0 (setvar "angdir" 0) ;Set Angle Direction to 0 (setvar "orthomode" 1) ;Turn on Orthomode (setvar "osmode" SUSM) ;Turn on User Object Snaps (setq PT01 (getpoint "\nEnter the line start point:")) ;Get the first point of line (while ;Evaluate expression till nill (/= nil ;If not = (setq PT02 (getpoint PT01 "\nEnter the line end point:")) ;Set point 2 ) ;End if not (setvar "osmode" 0) ;Turn off all Object Snaps (progn ;Then do the following (command "._pline" PT01 PT02 "") ;Pline command (setq RADIANS (angle PT01 PT02)) ;Get line angle in radians (setq DEGREES (GL_RTD RADIANS)) ;Convert radians to degrees (setq PLEN (distance PT01 PT02)) ;Get the line distance (setq MIDPT (polar PT01 (GL_DTR DEGREES)(/ PLEN 2.0))) ;Set the midpoint of the line (setq PT01 PT02) ;Set point 1 from point 2 (setvar "osmode" SUSM) ;Turn on User Object Snaps (if ;If the following returns true (and ;Return the logical AND of the supplied arguments (> DEGREES 90.0) ;Degrees is greater than 90 (
That does not seem like a bad idea, But in some instance I may want to use the old settings somewhere within the program. I set the program up to use the Users own object snaps when called for. Thats not flexible enough for me if I place all settings under one variable.
See below:
[code] (while ;Evaluate expression till nill (/= nil ;If not = (setq PT02 (getpoint PT01 "\nEnter the line end point:")) ;Set point 2 ) ;End if not (setvar "osmode" 0) ;Turn off all Object Snaps (progn ;Then do the following (command "_.pline" PT01 PT02 "") ;Pline command (setq RADIANS (angle PT01 PT02)) ;Get line angle in radians (setq DEGREES (GL_RTD RADIANS)) ;Convert radians to degrees (setq PLEN (distance PT01 PT02)) ;Get the line distance (setq MIDPT (polar PT01 (GL_DTR DEGREES)(/ PLEN 2.0))) ;Set the midpoint of the line (setq PT01 PT02) ;Set point 1 from point 2 (setvar "osmode" SUSM) ;Turn on User Object Snaps (if ;If the following returns true (and ;Return the logical AND of the supplied arguments (> DEGREES 90.0) ;Degrees is greater than 90 (