TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: vinnyg on August 10, 2005, 10:39:22 AM

Title: why doesn't my command go away?
Post by: vinnyg on August 10, 2005, 10:39:22 AM
Hi all,

I wrote a lisp routine to draw a box a given width
and length and included a command to hatch the area
within the box......then I revised it to delete the hatch
command. Now when I run the lisp routine, it still is
hatching the area within the box. Why? What's going on?

Any help guys/gals?

vinnyg
Title: why doesn't my command go away?
Post by: daron on August 10, 2005, 10:46:54 AM
You might get more answers, if you showed some code.
Title: deleting hatch command in lisp
Post by: vinnyg on August 10, 2005, 10:56:14 AM
here's the original code:

 

Code: [Select]
 (DEFUN DTR (A) (* PI (/ A 180.0)))
  (DEFUN RTD (A) (/ (* A 180.0) PI))
(DEFUN C:IFPLATE ()    
 (SETVAR "CMDECHO" 0)
 (SETQ Z (GETVAR "CLAYER"))
 (GRAPHSCR)
 (command "osnap" "off" "")

 (SETQ P1  (GETPOINT  "\nLower left corner of plate: "))

  (setq dcl_id (load_dialog "plate.dcl"))
  (if (not (new_dialog "pnl" dcl_id))
  (exit))

  (action_tile "cancel" "(done_dialog 0)")
  (action_tile "accept" "(done_dialog 1)")
  (action_tile "WIDTH" "(setq W  $value)")
  (action_tile "HEIGHT" "(setq H  $value)")
 

  (setq done_dlg_val (start_dialog))
  (unload_dialog dcl_id)

  (if
     (= 1 done_dlg_val)
     ()
  );end if

  (setq W (distof W))
  (setq H (distof H))
  (setq ang 1.5708)

  (setq p2 (polar p1 (-(dtr 90) ang) w)
      p3 (polar p2 (+(dtr 0) ang) h)
      p4 (polar p3 (+(dtr 90) ang) w)
  )    
 
  (setvar "clayer" "3")
  (setvar "cecolor" "7")
  (command "line" p1 p2 p3 p4 "close" "")
  (redraw) ; end of drawing the outline

 
  (command "dimclrt" "1" "")
  (command "dimclre" "1" "")
  (command "dimscale" "6" "")
  (command "lunits" "4" "")
  (command "dimunit" "4" "")
  (command "dimtsz" "1/16" "")
  (command "dimtad" "1" "")
  (command "dimtih" "off" "")
  (command "dimjust" "0" "")
  (command "dimtad" "1" "")

  (setvar "cecolor" "1")
  (setvar "clayer" "defpoints")
  (setq p5 (polar p1 (+(DTR 90) ANG) 2))
  (command "dim" "ver"p1 p4 p5 "")
  (setq p6 (polar p1 (+(dtr 180) ang) 2))
  (command "dim" "hor" p1 p2 p6 "")
  (command "exit" "")
  (command "zoom" "e" "")
  (command "zoom" "0.9x" "")
  (redraw)


  (setvar "cecolor" "7")
  (setvar "clayer" "3")

  (command "hatch" "ansi31" "1.000" "0.0" "all"  "")

 

  (setvar "cecolor" "7")
  (setvar "clayer" "defpoints")

 

     
 
  (PRINC)
) ; end of defun


;NOTE! I DELETED THE COMMAND "HATCH" IN THE REVISED
;LISP ROUTINE
Title: why doesn't my command go away?
Post by: daron on August 10, 2005, 11:08:23 AM
Did you reload it after deleting it?
Title: deleting hatch command in lisp
Post by: vinnyg on August 10, 2005, 11:17:14 AM
Thanks for your help,

Apparently, I did not reload the lisp command. It works fine now. By
the way, I failed to include the dcl code if anyone wants it.

Thanks again for your help

vinnyg
Title: why doesn't my command go away?
Post by: daron on August 10, 2005, 11:53:14 AM
No prob.
Title: why doesn't my command go away?
Post by: TJAM51 on August 10, 2005, 01:18:29 PM
I would like to see the dcl file as well.........thanks.
Title: hatch command won't go away
Post by: vinnyg on August 10, 2005, 01:40:16 PM
here's the DCL file:

pnl : dialog {
  label = "BUILD PLATE Input";

  :  edit_box {
    key = "WIDTH";
    label = "Width of plate:";
    edit_width = 15;
  }
  :  edit_box {
    key = "HEIGHT";
    label = "Height of plate:";
    edit_width = 15;
  }
 

ok_cancel;
}
Title: Re: why doesn't my command go away?
Post by: adalea03 on September 28, 2006, 11:27:24 PM
I have in the past, extended a lisp file with a short little app and then forgot about it.
Upon loading the main routine, the little app was loaded as well.
Later in development of a similar app, I found that I was calling a function or subroutine in a
different manor or for unique results.
However, if the old app was loaded first, it's definition would take precedence.
Check to see if your function is unique to the current Acad session.

Tony.
Title: Re: why doesn't my command go away?
Post by: CAB on September 28, 2006, 11:34:38 PM
Good advice Tony, and welcome to the swamp. :-)