Author Topic: Compiling multiple lisps into one larger lisp...  (Read 8323 times)

0 Members and 1 Guest are viewing this topic.

Dommy2Hotty

  • Swamp Rat
  • Posts: 1127
Compiling multiple lisps into one larger lisp...
« on: June 02, 2004, 06:49:36 PM »


That is my Electrical toolbar.  I am writing a lisp for each button, but I don't want 19 seperate lisp files.  Each button inserts a block.  The lisp will put the block on it's correct layer.  I am aware I can just add the change command after the insertion macro, but I want to add a TBLSEARCH "LAYER" to each one to make sure the layer exists, and if not, then it would create it.

How would I go about arranging them within 1 lisp file, and how would the buttons call the correct lisp?  I'm guessing I make one lisp named "Electrical.lsp" with each button having it's own defun.  Something along the lines of...

Code: [Select]
Electrical.lsp
**********************
(defun c:button1 ()
          ----------
          ----------
)

(defun c:button2 ()
          ----------
          ----------
)

(defun c:button3 ()
          ----------
          ----------
)


And then each button macro would just be "^C^C_button1" "^C^C_button2"  etc....

Is all this correct??? :twisted:

Jeff_M

  • King Gator
  • Posts: 4095
  • C3D user & customizer
Re: Compiling multiple lisps into one larger lisp...
« Reply #1 on: June 02, 2004, 07:38:23 PM »
[quote="Dommy2HottyAnd then each button macro would just be "^C^C_button1" "^C^C_button2"  etc....

Is all this correct??? :twisted:[/quote]

Yes, however I would suggest a slightly different strategy. I'm going out on a limb here and assume that you have your toolbar in it's own mnu/mns file, instead of the base acad menu. If not, I strongly suggest you do. This will make upgrades, re-installs, further customization, etc, much easier to manage.
Now, based on that, create a .mnl file that mimics the name of your menu file. Such as: your toolbars are in MyElectric.mns so create a MyElectric.mnl file. Now place all of the button defuns into this mnl file and they will always load with the menu.

edited to show the use of files having the same name, not similar names....thanks to Slim for catching that.

Just my $0.02....
Jeff    :idea:[/i]

Slim©

  • Needs a day job
  • Posts: 6566
  • The Dude Abides...
Re: Compiling multiple lisps into one larger lisp...
« Reply #2 on: June 02, 2004, 07:43:03 PM »
Quote from: Jeff Mishler
MyElectric.mns so create a MeElectric.mnl file.


Both should be MyElectric.*, Right Jeff. :)  :wink:
I drink beer and I know things....

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Compiling multiple lisps into one larger lisp...
« Reply #3 on: June 02, 2004, 07:55:11 PM »
.. and further to that ..
Change the command names to  c:elec_button01  .. etc .. or similar to ensure the names are unique, and wont overwrite the button01 command from the next menu toolbar that you write.

Re the layer setting command : I assume that would be a stand alone library routine called from each buttonxx command. .. rather than just repeat a block of code in each routine.
Sort of like this :-
Code: [Select]

;;; Elect_tb1.mnl file
(vl-load-com)

(defun myChangeLayerCommand (LayerName / )
;;
;;
;Do Layer change stuff here ..
; < snip >
)

(defun c:Elect_tb1_01 ( / prevLayer)
;save prevLayer
(myChangeLayerCommand "ElecBlocks")

; < snip >
; < do your stuff here >

;restore prevLayer
)
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.

Slim©

  • Needs a day job
  • Posts: 6566
  • The Dude Abides...
Compiling multiple lisps into one larger lisp...
« Reply #4 on: June 02, 2004, 07:56:18 PM »
Nice stuff, Kerry :D
I drink beer and I know things....

Dommy2Hotty

  • Swamp Rat
  • Posts: 1127
Compiling multiple lisps into one larger lisp...
« Reply #5 on: June 03, 2004, 11:40:58 AM »
AHHH.....yes....mnl files...buh-duh....

ok...now what's up with the (vl-load-com) stuff...

a pointing to a website for the vla, vlax, ex-lax or whatever that is would be nice...have to learn it sooner or later... :twisted:

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Compiling multiple lisps into one larger lisp...
« Reply #6 on: June 03, 2004, 11:49:18 AM »
Quote
ok...now what's up with the (vl-load-com) stuff...

a pointing to a website for the vla, vlax, ex-lax or whatever that is would be nice


RTFM will work.

.. 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.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Compiling multiple lisps into one larger lisp...
« Reply #7 on: June 03, 2004, 11:54:25 AM »
Quote from: Kerry Brown
RTFM will work.
I can verify that. :)
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

Dommy2Hotty

  • Swamp Rat
  • Posts: 1127
Compiling multiple lisps into one larger lisp...
« Reply #8 on: June 03, 2004, 12:41:02 PM »
Quote from: Kerry Brown
Quote
ok...now what's up with the (vl-load-com) stuff...

a pointing to a website for the vla, vlax, ex-lax or whatever that is would be nice


RTFM will work.

.. and you're welcome.


Pardon my ignorance...but now what's RTFM :crazy:

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
Compiling multiple lisps into one larger lisp...
« Reply #9 on: June 03, 2004, 12:50:11 PM »
"read the fine manual" the word "fine" can be substituted with another word of four letters.
TheSwamp.org  (serving the CAD community since 2003)

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Compiling multiple lisps into one larger lisp...
« Reply #10 on: June 03, 2004, 12:53:12 PM »
RTFM is a specialist technical consulting organisation for the solving of difficult problems.
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.

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
Compiling multiple lisps into one larger lisp...
« Reply #11 on: June 03, 2004, 12:55:11 PM »
Quote from: Kerry Brown
RTFM is a specialist technical consulting organisation for the solving of difficult problems.


lmao 2 points for Kerry. :D
TheSwamp.org  (serving the CAD community since 2003)

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Compiling multiple lisps into one larger lisp...
« Reply #12 on: June 03, 2004, 12:57:43 PM »
:D  They will also do peoples homework, If asked properly.
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.

Anonymous

  • Guest
Compiling multiple lisps into one larger lisp...
« Reply #13 on: June 03, 2004, 01:02:52 PM »
RTFM is a powerful tool that every competent developer continually uses, and surprisingly, the very thing that frequently prevents casual coders from evolving. No attitude here, just statin' facts.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Compiling multiple lisps into one larger lisp...
« Reply #14 on: June 03, 2004, 01:08:50 PM »
Quote
.. No attitude here, just statin' facts.


Even if it was attitude, I wouldn't apologise. ... attitude is what keeps me at this game.


:)
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.