Author Topic: i am trying to make a lisp routine  (Read 6309 times)

0 Members and 1 Guest are viewing this topic.

lupes

  • Guest
i am trying to make a lisp routine
« on: February 02, 2006, 06:08:57 PM »
I am trying to make a lisp routine insert drawings thru a dcl lialog menu.

I have gotten as fasr as making the lisp routine inserting a autocad drawing file and creating the dcl file but everytime i execute the lisp routine the dcl dialog appears for like a second and disapprears

is there something that I am forgetting to put so the dialog pop up stays

thanks

lupe
guadalupestewart@yahoo.com

Dommy2Hotty

  • Swamp Rat
  • Posts: 1127
Re: i am trying to make a lisp routine
« Reply #1 on: February 02, 2006, 06:42:47 PM »
Yes, you're forgetting to post the code!  Hard to diagnose with nothing to see.

uncoolperson

  • Guest
Re: i am trying to make a lisp routine
« Reply #2 on: February 02, 2006, 06:59:37 PM »
could your lisp routine be trying to do something to the drawing area while the dialog is loaded...?

jonesy

  • SuperMod
  • Seagull
  • Posts: 15568
Re: i am trying to make a lisp routine
« Reply #3 on: February 03, 2006, 03:00:32 AM »
Welcome to TheSwamp Lupes

If you were to post the code you had, then one of the experienced people here should be able to help you to sort it out.

Kind regards
Tracey :-)
Thanks for explaining the word "many" to me, it means a lot.

nivuahc

  • Guest
Re: i am trying to make a lisp routine
« Reply #4 on: February 03, 2006, 07:22:53 AM »
Welcome to TheSwamp Lupes

If you were to post the code you had, then one of the experienced people here should be able to help you to sort it out.

Kind regards
Tracey :-)

Only one?!?!?  :ugly:

 :lmao:

I think I'd change that to 'several' as there are a lot of us who really like to see people learning this stuff. And there are some people on this forum who have near encyclopedic knowledge of LISP.

And, as Tracey said already, welcome to TheSwamp Lupes... show us what ya got :)

lupes

  • Guest
Re: i am trying to make a lisp routine
« Reply #5 on: February 03, 2006, 09:35:26 AM »
ok this is what i have so far.  and it is just appearing for like 2 seconds and disappears. I really do not know what I did wrong
please help

thanks
 lupe

;  extra.LSP     LB Industrial Systems Library  (C)2006

  ;extra.LSP Version 0
  ;(C) Copyright 2006 By Guadalupe Stewart
  ;E-mail: lstewart@lbindustrialsystems.com
;;----------------------------------------------------------------------;
  ;Rev. 0                         
;;----------------------------------------------------------------------;   
  ;--------------------------INTERNAL ERROR HANDLER---------------------;
(defun
   extra_ERR (MSG)
  (if (or (/= MSG "Function cancelled")
  ; If an error (such as ESC) occurs
          (= MSG "quit / exit abort")
      ) ;_ end of or
    (princ)
    (princ (strcat "\nError: " MSG))
  ) ; while this command is active...
  (setq *ERROR* OLDERR) ; Restore old *error* handler
  (princ)
) ;end extra_ERR
  ;------------------------------MAIN PROGRAM----------------------------;
(defun DTR (A) (* pi (/ A 180.0)))
  ;----------------------------------------------------------------------;     
(defun RTD (A) (/ (* A 180.0) pi))
  ;--------------------------------------------------------------------;
(setq Path "J:/Drawing Standards/Symbols/"); Path to blocks
; New Functions:
(defun get_block_list ( which )
 (cond
  ((= which 1); title blocks
  (setq block_lst (list
    "lbistb"
    "prestb"
    "block3"
  ));  setq/list
  ); which 1
  ((= which 2); M-shapes
  (setq block_lst (list
    "block1"
    "block2"
    "block3"
  ));  setq/list
  ); which 2
 ); cond
); function
(defun fill_lst ()
(start_list "get_size")
(mapcar 'add_list block_lst)
(end_list)
); function
;-----------------
(defun
   extra_DIALOG ()
  (setq DCL_ID (load_dialog "extra.dcl")) ;load the DCL file
  (if (not (new_dialog "extra" DCL_ID)) ;initialize the DCL file
    (exit) ;exit if this doesn't work
  ) ;end if
  (setq blockname "" Dia_Abort 0)
  (while (/= what_next 4)
   (action_tile "get_size" "(setq blockname (nth (atoi (setq _j $value)) blocks_lst))(done_dialog 4)")
; typical action (action_tile "key_name_of_button_x" "(get_block_list N)(fill_lst)")
   (action_tile "titleblocks" ""(get_block_list 1)(fill_lst)")
   (action_tile "m_shape" ""(get_block_list 2)(fill_lst)")
   (action_tile "accept" "(done_dialog 4)")
   (action_tile "cancel" "(setq Dia_Abort 1)(done_dialog 4)")
   (action_tile "extra_help" "(extra_help)")
   (start_dialog what_next) ;display the dialog box
  ); while
;-----------------
   (unload_dialog DCL_ID) ;unload the DCL file
   (if (and (/= blockname "")(/= Dia_Abort 1))
    (progn
     (if (findfile (strcat Path blockname ".dwg"))
      (progn
         (setvar "attreq" 1)
         (initdia)
         (command "-INSERT" (strcat Path blockname) pause "1" "1" "1") ; insert the block / FILL attrib's
      ); progn
       (alert (strcat "Could not locate Blockname " blockname ".dwg"))
     ); if
    ); progn
   ); if
 (princ)
) ;end extra_DIALOG
 ;--------------------------------------------------------------------;
(defun
   C:extra ()
  (setq
    OLDERR *ERROR*
    *ERROR* extra_ERR
  ) ;_ end of setq
  (extra_DIALOG)
  (setvar "OSMODE" OS)
  (setq *ERROR* OLDERR) ; Restore old *error* handler
  (princ)
) ;end extra
(princ "\nLB Industrial Systems Library Loaded. Type extra to use.")
(princ)

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: i am trying to make a lisp routine
« Reply #6 on: February 03, 2006, 10:02:45 AM »
Can we have the dialog file ?

Just a thought .. can you format the code in Visual Lisp IDE ?

and from a quick scan, check the quotes <"> in the action tile section.
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: i am trying to make a lisp routine
« Reply #7 on: February 03, 2006, 10:46:30 AM »
Try this as a replacement perhaps .

.. a bit tough without the dialog ..

Code: [Select]
;;-----------------
(defun extra_DIALOG ()
  (setq DCL_ID (load_dialog "extra.dcl"))             
  (if (not (new_dialog "extra" DCL_ID))               
    (exit)                                             
  )                                                   
  (setq blockname ""
        Dia_Abort 0
        what_next 0                                                                                        ;; revised kwb
  )
  (while (/= what_next 4)
    (action_tile
      "get_size"
      "(setq blockname (nth (atoi (setq _j $value)) blocks_lst))(done_dialog 4)"
    )
    ;; typical action (action_tile "key_name_of_button_x" "(get_block_list N)(fill_lst)")
    (action_tile "titleblocks" "(get_block_list 1) (fill_lst)")                                     ;; revised kwb
    (action_tile "m_shape" "(get_block_list 2)(fill_lst)")                                       ;; revised kwb
    (action_tile "accept" "(done_dialog 4)")
    (action_tile "cancel" "(setq Dia_Abort 1)(done_dialog 4)")
    (action_tile "extra_help" "(extra_help)")
    (setq what_next (start_dialog ))                          ;display the dialog box       ;; revised kwb
  )                                                   
  ;;-----------------


;; ............>>>> cont
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: i am trying to make a lisp routine
« Reply #8 on: February 03, 2006, 10:54:19 AM »
as a learning exercise,
.. I'll leave it up to you to document in this thread why I changed the things that were revised.

 
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Dommy2Hotty

  • Swamp Rat
  • Posts: 1127
Re: i am trying to make a lisp routine
« Reply #9 on: February 03, 2006, 12:03:42 PM »
Thanks...scalpels in hand...let the dissection begin :twisted:

For future code insertion, use the CODE html tags around your code:

[ code ] before it (no spaces in the html tag)
[ /code ] after it (no spaces in the html tag)

The resulting code will look like this:

Code: [Select]
StJames : dialog {
label = "<*> StJames <*>";

: radio_column { label = "< Kitchen Option >"; key = "KitOpt";
: radio_button { label = "Standard"; key = "KitReg";}
: radio_button { label = "Standard - Boxed Bay"; key = "KitRegBB";}
: radio_button { label = "Extended"; key = "KitExt";}
: radio_button { label = "Extended - Boxed Bay"; key = "KitExtBB";}
}

: row {
ok_cancel;}

         
         
}// Dialog

lupes

  • Guest
Re: i am trying to make a lisp routine
« Reply #10 on: February 03, 2006, 12:07:23 PM »
KEVIN THAT WORKED OUT JUST FINE WHAT YOU HAVE SUGGESTED.  THE DIALOG BOX STAYS THERE.... NOW WHAT IT IS DOING IS... WHEN I SELECT THE TEXT IN THE BLOCK BOX IT JUST DISAPPEARS

BUT THANKS FOR THE HELP

I AM THINKING THAT IT IS LOOKING FOR THE COMMAND TO INSERT THE DRAWING NOW

LUPE

lupes

  • Guest
Re: i am trying to make a lisp routine
« Reply #11 on: February 03, 2006, 12:10:41 PM »
SO THIS PART THAT YOU ARE DISPLAYING I NEED TO PUT THIS IN THE DCL FILE?



Thanks...scalpels in hand...let the dissection begin :twisted:

For future code insertion, use the CODE html tags around your code:

[ code ] before it (no spaces in the html tag)
[ /code ] after it (no spaces in the html tag)

The resulting code will look like this:

Code: [Select]
StJames : dialog {
label = "<*> StJames <*>";

: radio_column { label = "< Kitchen Option >"; key = "KitOpt";
: radio_button { label = "Standard"; key = "KitReg";}
: radio_button { label = "Standard - Boxed Bay"; key = "KitRegBB";}
: radio_button { label = "Extended"; key = "KitExt";}
: radio_button { label = "Extended - Boxed Bay"; key = "KitExtBB";}
}

: row {
ok_cancel;}

         
         
}// Dialog

nivuahc

  • Guest
Re: i am trying to make a lisp routine
« Reply #12 on: February 03, 2006, 12:28:27 PM »
Nah, Dommy was just giving you an example of what your output will look like when you use the

[ c o d e ]this is some code I wrote[ / c o d e ]

formatting (without the obvious spaces)

An easy way to do that, if you are just doing a copy/paste is to just click on the "Insert Code" button when composing your message (looks like ) then do a 'paste' (typing Ctrl-V is the easiest way to 'paste', IMO).

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: i am trying to make a lisp routine
« Reply #13 on: February 03, 2006, 01:09:23 PM »
hmmm .. wonder who kevin is ?


How'd you go with this ?
Quote
as a learning exercise,
.. I'll leave it up to you to document in this thread why I changed the things that were revised.

... and this
Quote
Can we have the dialog file ?
Just a thought .. can you format the code in Visual Lisp IDE ?
and from a quick scan, check the quotes <"> in the action tile section.
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: i am trying to make a lisp routine
« Reply #14 on: February 06, 2006, 10:20:57 AM »
oh, and you're welcome.
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.