Author Topic: i am trying to make a lisp routine  (Read 6311 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.

lupes

  • Guest
Re: i am trying to make a lisp routine
« Reply #15 on: February 09, 2006, 03:34:55 PM »
well after messing with this routine I am still in a stump of how to make this thing insert what I want to insert.  I have gotten it a little farther since you guys have helped me but I am still stuck.  Some advice would be most appreciative.

This is what I have so far:

Code: [Select]
;  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   
  ;--------------------------------------------------------------------;
(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
    "LBIS Title Block"
    "Presentation Title Block"
    "8 1/2 x 11 Title Block"
    "8 1/2 x 11 Presentation"
    "LBIS Project Schedule"
  ));  setq/list
  ); which 1
; New Functions:
  ((= which 2); Weldneck Flanges
  (setq block_lst (list
    "1/2 in weldneck"
    "3/4 in weldneck"
    "1 in weldneck"
    "1 1/4 in weldneck"
    "1 1/2 in weldneck"
    "2 in weldneck"
    "2 1/2 in weldneck"
    "3 in weldneck"
    "3 1/2 in weldneck"
    "4 in weldneck"
    "5 in weldneck"
    "6 in weldneck"
    "8 in weldneck"
    "10 in weldneck"
    "12 in weldneck"
    "14 in weldneck"
    "16 in weldneck"
    "18 in weldneck"
    "20 in weldneck"
    "22 in weldneck"
    "24 in weldneck"
  ));  setq/list
  ); which 2
; New Functions:
  ((= which 3); Expansion Joints
  (setq block_lst (list
    "2 in expansion"
    "4 in expansion"
    "6 in expansion"
    "8 in expansion"
    "10 in expansion"
    "12 in expansion"
  ));  setq/list
  ); which 3
 ); cond
); function
(defun fill_lst ()
(start_list "get_size")
(mapcar 'add_list block_lst)
(end_list)
); end function
;;-----------------

(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                                                                                       

  (while (/= what_next 4)
    (action_tile
      "title_block"
      "(setq blockname (nth (atoi (setq _j $key)) 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 "weldneck_flanges" "(get_block_list 2)(fill_lst)")
    (action_tile "Expansion_Joints" "(get_block_list 3)(fill_lst)")
    (action_tile "insert" "(setq Dia_Abort 1)(done_dialog 4)")                                     
    (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       
  ); 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" "0") ; 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)
  (princ)
) ;end extra
(princ "\nLB Industrial Systems Library Loaded. Type extra to use.")
(princ)

Code tags added
« Last Edit: February 09, 2006, 04:31:08 PM by CAB »

Jeff_M

  • King Gator
  • Posts: 4096
  • C3D user & customizer
Re: i am trying to make a lisp routine
« Reply #16 on: February 10, 2006, 09:36:35 AM »
lupes, you've been asked a few times to post the DCL file. Without it we cannot test run the code to see where it's failing.

lupes

  • Guest
Re: i am trying to make a lisp routine
« Reply #17 on: February 16, 2006, 05:22:40 PM »
sorry about that here is the dcl file.
and a revised lisp routine.


//Tip1779:  extra.DCL     LB Library  (C)2006, Guadalupe Stewart

dcl_settings : default_dcl_settings { audit_level = 0; }

extra : dialog {
   label = "LB Industrial Systems Library of Blocks";
   : text {
     label = "Version 0 (C) 2006 by Guadalupe Stewart";
   }
   : row {
      children_alignment = top;
      :column {
      : boxed_column {
         label = "Title Blocks ";
         : button {
         key = "titleblocks";
         label = "Title Blocks";
         }
      }
      : boxed_column {
         label = "Flange_Items";
         : button {
         key = "weldneck_flanges";
         label = "Weldneck Flanges";
         }
         : button {
         key = "Expansion_Joints";
         label = "Expansion Joints";
         }
      }
      : boxed_column {
         label = "Valves";
         : button {
         key = "Automatic_Butterfly_Valves";
         label = "Automatic Butterfly Valves";
         }
         : button {
         key = "Manual_Butterfly_Valves";
         label = "Manual Butterfly Valves";
         }
         : button {
         key = "Everlasting_Valves";
         label = "Everlasting Valves";
         }
         : button {
         key = "Automatic_Knifegate_Valves";
         label = "Automatic Knifegate Valves";
         }
         : button {
         key = "Manual_Knifegate_Valves";
         label = "Manual Knifegate Valves";
         }
      }
      : boxed_column {
         label = "Sch 40 Fittings";
         : button {
         key = "90_deg_elbows";
         label = "90 deg elbows";
         }
         : button {
         key = "45_deg_elbows";
         label = "45 deg elbows";
         }
         : button {
         key = "tees";
         label = "tees";
         }
         : button {
         key = "laterals";
         label = "laterals";
         }
         : button {
         key = "unions";
         label = "unions";
         }
         : button {
         key = "Concentric_Reducers";
         label = "Concentric Reducers";
         }
      }
                }
      :column {
      : boxed_column {
         label = "Pipe Supports";
         : button {
         key = "U_Bolts";
         label = "U Bolts";
         }
         : button {
         key = "Clevis";
         label = "Clevis";
         }
         : button {
         key = "Beam_Attachments";
         label = "Beam Attachments";
         }
         : button {
         key = "Riser_Clamps";
         label = "Riser Clamps";
         }
      }
      : boxed_column {
         label = "Couplings";
         : button {
         key = "Socket_Weld_ Couplings";
         label = "Socket Weld Couplings";
         }
         : button {
         key = "Threaded_ Couplings";
         label = "Threaded Couplings";
         }
      }
      : boxed_column {
         label = "Miscellaneous Items";
         : button {
         key = "Miscellaneous_Items";
         label = "Miscellaneous Items";
         }
         : button {
         key = "Instrument_Air";
         label = "Instrument Air";
         }
         : button {
         key = "PID Symbols";
         label = "PID Symbols";
         }
         : button {
         key = "PID_Assemblies";
         label = "PID Assemblies";
         }
         : button {
         key = "Weld_Symbols";
         label = "Weld Symbols";
         }
      }
      : boxed_column {
         label = "Fittings";
         : button {
         key = "Hardened Fittings";
         label = "Hardened Fittings";
         }
         : button {
         key = "Threaded Fittings";
         label = "Threaded Fittings";
         }
                }
                }
      : column {
      fixed_height = true;
         : list_box {
         label = "Blocks";
         width = 25;
         height = 35;
         key = "get_size";
         }
      }
   }
   :row { }
:row {
fixed_width = true;
alignment = centered;
ok_cancel;
: button {
  label = "Help";
  fixed_width =  true;
  key = "extra_help";
  }
}
}

extra_help : dialog {
label = "Help for extra";

: list_box {
width =  100;
height =  25;
fixed_height =  true;
key = "extra_help";
}
ok_cancel;
}


;  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   
  ;--------------------------------------------------------------------;
(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
    "LBIS Title Block"
    "Presentation Title Block"
    "8 1/2 x 11 Title Block"
    "8 1/2 x 11 Presentation"
    "LBIS Project Schedule"
  ));  setq/list
  ); which 1
; New Functions:
  ((= which 2); Weldneck Flanges
  (setq block_lst (list
    "1/2 in weldneck"
    "3/4 in weldneck"
    "1 in weldneck"
    "1 1/4 in weldneck"
    "1 1/2 in weldneck"
    "2 in weldneck"
    "2 1/2 in weldneck"
    "3 in weldneck"
    "3 1/2 in weldneck"
    "4 in weldneck"
    "5 in weldneck"
    "6 in weldneck"
    "8 in weldneck"
    "10 in weldneck"
    "12 in weldneck"
    "14 in weldneck"
    "16 in weldneck"
    "18 in weldneck"
    "20 in weldneck"
    "22 in weldneck"
    "24 in weldneck"
  ));  setq/list
  ); which 2
; New Functions:
  ((= which 3); Expansion Joints
  (setq block_lst (list
    "2 in expansion"
    "4 in expansion"
    "6 in expansion"
    "8 in expansion"
    "10 in expansion"
    "12 in expansion"
  ));  setq/list
  ); which 3
; New Functions:
  ((= which 4); Automatic Butterfly Valves
  (setq block_lst (list
    "2 in butterfly"
    "2 1/2 in butterfly"
    "3 in butterfly"
    "4 in butterfly"
    "5 in butterfly"
    "6 in butterfly"
    "8 in butterfly"
    "10 in butterfly"
    "12 in butterfly"
  ));  setq/list
  ); which 4
; New Functions:
  ((= which 5); Manual Butterfly Valves
  (setq block_lst (list
    "2 in butterfly"
    "2 1/2 in butterfly"
    "3 in butterfly"
    "4 in butterfly"
    "5 in butterfly"
    "6 in butterfly"
    "8 in butterfly"
    "10 in butterfly"
    "12 in butterfly"
  ));  setq/list
  ); which 5
; New Functions:
  ((= which 6); Everlasting Valves
  (setq block_lst (list
    "2 in everlasting"
    "2 1/2 in everlasting"
    "3 in everlasting"
    "4 in everlasting"
    "5 in everlasting"
    "6 in everlasting"
    "8 in everlasting"
    "10 in everlasting"
    "12 in everlasting"
  ));  setq/list
  ); which 6
 ); cond
); function
(defun fill_lst ()
(start_list "get_size")
(mapcar 'add_list block_lst)
(end_list)
); end function
;;-----------------

(defun extra_DIALOG ()
  (setq DCL_ID (load_dialog "extra.dcl"))             
  (if (not (new_dialog "extra" DCL_ID))               
    (exit)                                             
) ;end if                                                   
  (setq blockname ""
        Dia_Abort 0
        what_next 0
)
  (while (/= what_next 4)
    (action_tile
      "title_block"
      "(setq blockname (nth (atoi (setq _j $valve)) 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 "weldneck_flanges" "(get_block_list 2)(fill_lst)")
    (action_tile "Expansion_Joints" "(get_block_list 3)(fill_lst)")
    (action_tile "Automatic_Butterfly_Valves" "(get_block_list 4)(fill_lst)")
    (action_tile "Manual_Butterfly_Valves" "(get_block_list 5)(fill_lst)")
    (action_tile "Everlasting_Valves" "(get_block_list 6)(fill_lst)")                                     
    (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       
  ); 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" "0") ; 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)
  (princ)
) ;end extra
(princ "\nLB Industrial Systems Library Loaded. Type extra to use.")
(princ)



Jeff_M

  • King Gator
  • Posts: 4096
  • C3D user & customizer
Re: i am trying to make a lisp routine
« Reply #18 on: February 16, 2006, 06:20:37 PM »
Changing this line from
Code: [Select]
(action_tile
      "title_block"
      "(setq blockname (nth (atoi (setq _j $valve)) blocks_lst))(done_dialog 4)"
)
to this
Code: [Select]
(action_tile
      "get_size"
      "(setq blockname (nth (atoi (setq _j $value)) block_lst))(done_dialog 4)")
allowed me to at least get to the "Block not found" alert....which would be expected since I don't have your blocks or path to them.

HTH,
Jeff

lupes

  • Guest
Re: i am trying to make a lisp routine
« Reply #19 on: February 17, 2006, 11:04:57 AM »
HOK THAT SOUNDS GOOD HERE ARE SOME BLOCKS THAT I HAVE.  I THANK Y'ALL FOR ALL THE HELP AND GUIDANCE THAT Y'ALL HAVE PROVIDED AND IT IS GREATLY APPRECIATED!!

IF YOU NEED MORE BLOCKS JUST LE ME KNOW

GDF

  • Water Moccasin
  • Posts: 2081
Re: i am trying to make a lisp routine
« Reply #20 on: February 17, 2006, 11:19:40 AM »
You might want to consider using slides to help identify block names. I would have the slide popup whenever an item in the list_box is made.


Gary
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64

lupes

  • Guest
Re: i am trying to make a lisp routine
« Reply #21 on: February 17, 2006, 11:58:35 AM »
man that routine looks good.  but that routine is copy written huh.

GDF

  • Water Moccasin
  • Posts: 2081
Re: i am trying to make a lisp routine
« Reply #22 on: February 17, 2006, 12:41:40 PM »
I'm not the best code writer, but here is how I got the slides from a slide library.

Code: [Select]
           
from the dcl file:
:image {key = "shpimg"; width=14; height=4.75; color=-15;}   

from the lisp file:
(defun MECHIMAGEX (/ shpimx shpimy shimg)
  (setq shimg sufmech)
  (setq shpimx (dimx_tile "shpimg")
shpimy (dimy_tile "shpimg")
  )
  (start_image "shpimg")
  (fill_image 0 0 shpimx shpimy -15)
  ;;this resets the slide image! 
  (slide_image
    0
    -5
    shpimx
    shpimy
    (strcat ARCH#CUSF "MECH/" "MECH(" shimg ")")
  )
  (end_image)
  (set_tile "type-list" (rtos mechinx 2 0))
)

(defun MECHIMAGE (/ shpimx shpimy shimg)
  (cond
    ((= mechinx 0) (setq sufmech "24DifF") (MECH-DifFUSER))
    ((= mechinx 1) (setq sufmech "RDDN") (MECH-ELBOWS))
    ((= mechinx 2) (setq sufmech "DTAP") (MECH-TAPS))
    ((= mechinx 3) (setq sufmech "FPVAV") (MECH-FPVAV))
    ((= mechinx 4) (setq sufmech "VAV") (MECH-VAV))
    ((= mechinx 5) (setq sufmech "TRANERTU") (MECH-TRANERTU))
    ((= mechinx 6) (setq sufmech "500T") (MECH-SCHEMATIC))
    ((= mechinx 7) (setq sufmech "TUP") (MECH-SNGPIPE))
    ((= mechinx 8) (setq sufmech "BFV") (MECH-DBLPIPE))
  )
  (setq shimg sufmech)
  (setq shpimx (dimx_tile "shpimg")
shpimy (dimy_tile "shpimg")
  )
  (start_image "shpimg")
  (fill_image 0 0 shpimx shpimy -15)
  ;;this resets the slide image!
  (slide_image
    0
    -5
    shpimx
    shpimy
    (strcat ARCH#CUSF "MECH/" "MECH(" shimg ")")
  )
  (end_image)
  (set_tile "type-list" (rtos mechinx 2 0))
  (set_tile
    "set-title"
    (strcat ARCH#LOGO
    " : MECH                          Mechanical Plumbing : "
    listname
    )
  )
)


(defun MECH-DifFUSER (/ xxx)
  (mode_tile "accept" 0)
  (setq SET_MECHWIDTH
'("Supply"    "Return"    "Slot"
   "Slot 8"    "Supply <---"   "Return --->"
   "Flex Duct..."
  )
  )
  (defun GET_MECHWIDTH ()
    (cond
      ((= XXX 0)
       (setq MECHBLOCK "MECH_DifFUSER/24DifF")
       (setq sufmech "24DifF")
       (MECHIMAGEX)
       (ARCH:SETMECHMODE "4")
      )
      ((= XXX 1)
       (setq MECHBLOCK "MECH_DifFUSER/24RTN")
       (setq sufmech "24RTN")
       (MECHIMAGEX)
       (ARCH:SETMECHMODE "1")
      )
      ((= XXX 2)
       (setq MECHBLOCK "MECH_DifFUSER/LSD")
       (setq sufmech "LSD")
       (MECHIMAGEX)
       (ARCH:SETMECHMODE "1")
      )
      ((= XXX 3)
       (setq MECHBLOCK "MECH_DifFUSER/LSD8")
       (setq sufmech "LSD8")
       (MECHIMAGEX)
       (ARCH:SETMECHMODE "1")
      )
...and so on

Gary
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64

lupes

  • Guest
Re: i am trying to make a lisp routine
« Reply #23 on: February 17, 2006, 03:28:29 PM »
do you know what the command that this routine uses to insert the individual drawings that you have made. because that is the trouble that i am having.  I got the menu to load and show what it is suppose to show, I got it to select the block that I want but I have been trying for a while now to make the block insert into the autocad session.

I am going to try that part about the slide look because that looks pretty slick.  as an extra look for the routine.


thanks for the idea.

Lupe

GDF

  • Water Moccasin
  • Posts: 2081
Re: i am trying to make a lisp routine
« Reply #24 on: February 17, 2006, 04:15:05 PM »
oops

wrong image, here is the block one...
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64

hyposmurf

  • Guest
Re: i am trying to make a lisp routine
« Reply #25 on: February 17, 2006, 05:19:01 PM »
Your images of your pop dialogue boxes with all those buttons. :love: Looks like were from the same industry.Have you ever marketed your work?

GDF

  • Water Moccasin
  • Posts: 2081
Re: i am trying to make a lisp routine
« Reply #26 on: February 17, 2006, 06:15:37 PM »
It's free. What I have is highly customized to meet our office CAD standards.

However it is part of an overall program (non standalone for individual lisp routines).
I would have to send all or nothing for it to work.

Even the dcl widgets are in a seperate file and loaded using:
//To load master widgets used by Arch Program© for AutoCAD®
@include "..\\ARCH.dcl"

Parts of it could be easily customized to you standards, for ex: "LAYS" layer xxx.lay files

Does any of this make since? The whole routine plus generic blocks just fits on one CD.
I've gone down the path of no return....everthing is linked together.

I have thought about mailing out a CD of what I have. If anyone is interested, just send me
your mailing address and, I will send you the CD.

I will do this for the first three emails I get. I do have a day job.

Gary
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64