Author Topic: HPANG variable is taunting me...  (Read 2610 times)

0 Members and 1 Guest are viewing this topic.

Dommy2Hotty

  • Swamp Rat
  • Posts: 1127
HPANG variable is taunting me...
« on: May 14, 2004, 04:46:57 PM »
So I'm making another hatch pattern lisp, this time for a brick soldier course.  Problem is, when I use it, instead of the hatch going to the 90* that I have set in the routine~(setvar "hpang" 90)~it creates the hatch at 116.620156177409*  :shock:  :shock: what the crap is that???

Code: [Select]

;;***********************************************
;;      Hatch_Elevation_Brick_Soldier.lsp       *
;;          Created by Dominic Cesare           *
;;                 05.14.04                     *
;;***********************************************

;;**********************
;;*  Start of Routine  *
;;**********************

;informs user how to run lisp
(prompt "\nType Hatch_Elevation_Brick_Soldier to run.....")

;define function
(defun c:Hatch_Elevation_Brick_Soldier ()
  (setq temperr *error*)
  (setq *error* trap1)
  ;storing current variables
  (setq oldlayer (getvar "clayer"))
  (setq oldecho (getvar "cmdecho"))
  (setq oldhpname (getvar "hpname"))
  (setq oldhpspace (getvar "hpspace"))
  (setq oldhpang (getvar "hpang"))
  ;turning off echo
  (setvar "cmdecho" 0)
  ;creating layer EL-HATCH-BRICK
  (command "-layer" "m" "EL-HATCH-BRICK" "c" "251" "" "")
  ;setting hatch variables
  (setvar "hpname" "_user,_o")
  (setvar "hpspace" 2.666)
  (setvar "hpang" 90)
  ;inform user to change snapbase variable
  (prompt "\nSelect Origin for hatch or ENTER for no change.....")
  ;starting snapbase command
  (command "snapbase")
    (while (eq (logand (getvar "CmdActive") 1) 1)
    ; get user's input
    (command pause)
    ;_ closes while
    )
  ;inform user to select internal point for hatch
  (prompt "\nSelect Internal Point.....")
  ;starting hatch command
  (command "-bhatch")
  (while (eq (logand (getvar "CmdActive") 1) 1)
    ; get user's input
    (command pause)
    ;_ closes while
    )
  ;resetting system variables
  (setvar "hpname" oldhpname)
  (setvar "hpspace" oldhpspace)
  (setvar "hpang" oldhpang)
  (setvar "clayer" oldlayer)
  (setvar "cmdecho" oldecho)
  (setq *error* temperr)
  (princ)
  )

(defun trap1 (errmsg)
  (command "u")
  (setvar "hpname" oldhpname)
  (setvar "hpspace" oldhpspace)
  (setvar "hpang" oldhpang)
  (setvar "clayer" oldlayer)
  (setvar "cmdecho" oldecho)
  (setq *error* temperr)
  (prompt "Resetting System Variables...")
  (princ)
  )

;;**********************
;;*  End of Routine    *
;;**********************

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
HPANG variable is taunting me...
« Reply #1 on: May 14, 2004, 09:31:28 PM »
try setting hpang to:

Code: [Select]

(setvar hpang (angtof "90"))


or
Code: [Select]

(command "hpang" "90")


The reason is that the command line version of HPANG accepts angles in degrees while the lisp version accepts angles in radians.

So the thing is that 90 radians = 116.62 degrees
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

Dommy2Hotty

  • Swamp Rat
  • Posts: 1127
HPANG variable is taunting me...
« Reply #2 on: May 17, 2004, 09:08:28 AM »
ahhhh....I see....thank you...once again, I am humbled by the masters of the LISP universe...:twisted: