Author Topic: Another Menu question  (Read 8566 times)

0 Members and 1 Guest are viewing this topic.

pmvliet

  • Guest
Another Menu question
« Reply #15 on: February 01, 2005, 08:33:09 AM »
Gee Cab,

I didn't mean for you to write the whole thing....
I will try it in a little while.
The only one thing I see that I really don't like is having the list
of clients. This is only one part ouf our client list. It is probably closer to 30.

hey, I will take what I can and make things work.

Pieter

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Another Menu question
« Reply #16 on: February 01, 2005, 10:42:04 AM »
Quote from: pmvliet
Gee Cab,

I didn't mean for you to write the whole thing....
I will try it in a little while.
The only one thing I see that I really don't like is having the list
of clients. This is only one part ouf our client list. It is probably closer to 30.

hey, I will take what I can and make things work.

Pieter

No problem, it's mostly cut and paste.
Why don't you like the list?
Are you doing more than loading a menu?
Idealy the client data should be in a text file so you would not have to update the lisp.
I've reached the age where the happy hour is a nap. ()
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

pmvliet

  • Guest
Another Menu question
« Reply #17 on: February 02, 2005, 06:18:01 PM »
your last statement hit it on the head.
The fewer core files I need to modify when we get a new client the better.
That list will be long and if I made 1 mistake putting another client in, none of that will work.

I am going to try this now and see how it goes.
I really appreciate your help.

Pieter

pmvliet

  • Guest
Another Menu question
« Reply #18 on: February 02, 2005, 06:59:17 PM »
Ok Cab,

I get the following error
Quote
; error: no function definition: MENU_CHANGE


I did lsp, function and menu_change was not loaded.
Once I loaded it in, I get this error
Quote

Command:
; error: bad argument type: stringp nil


which means I got a () or a "" issue so I will start looking at the code.
checked that...

I wonder if it is what I have in the mnu, due to the length it wrapped and I wonder if I got something typed in wrong...

Code: [Select]
^c^c^p that does a double cancel and then toggles the menuecho

then
Code: [Select]
(if (null menu_change) (load menu_change))
this looks to see if "menu_change" is loaded, if it isn't it loads it.
Code: [Select]
(menu_change "lowes")
does this define menu_change as lowes?
I guess I don't see how it proceeds...

I re-did my menu part and put spaces between the ) ; (
and that made it do something more and comes back with two errors.
Code: [Select]
Command:  ; error: bad argument type: stringp nil

Command:
_HELP
Command:  HELP
Command:  ; error: no function definition: MENU_CHANGE


this is urting my brain on top of the day I had so I am going to take off and try to get some sleep.

Pieter

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Another Menu question
« Reply #19 on: February 02, 2005, 09:39:42 PM »
This
Code: [Select]
(menu_change "lowe's")
calls the lisp and passes the string "lowe's" to the routine.
The string is stored in the variable newclient.
Try this:
Code: [Select]
;;  Menu_change.lsp
(defun menu_change (newclient)
  (if (or (null newclient) (= newclient ""))
    (setq newclient "lowe's") ; default client
  )
  (if (null (getenv "client"))
    (setenv "client" "None Loaded")
  )
  ;;  check for new client
  (if (= (strcase newclient) (strcase (getenv "client")))
    (alert "\r Client already Loaded")
    ;; else load client
    (if (member (strcase newclient)
                (list
                  "LOWE'S"
                  "CIRCUIT CITY"
                  "RITEAID"
                  "WALGREEN'S"
                  "PETSMART"
                  "MEIJER"
                  "ALBERTSONS"
                  "TIPPMANN"
                  "GE FUEL"
                  "RETAIL"
                  "DOMINICKS"
                  "WESTFIELD-IN"
                  "<-WESTFIELD-OUT"
                ) ; list
        ); member
     (progn
        ;; Check / Unload existing menugroup
        (if (/= (menugroup (getenv "client")) nil)
           (command "_MENUUNLOAD" (getenv "client"))
        ); end if
        (setenv "client" newclient)
        (command "menuload"
                (strcat "i:\\autodesk\\ro sbu\\retail\\" newclient "\\menu\\" newclient))
        (menucmd (strcat "p15=+" newclient ".pop1"))
        (alert (strcat "Notice:\nThe" newclient "Workspace has been loaded!"))
      ); progn
      (alert "\r Client data missing nothing Loaded")
    ); endif
  ); endif
  (princ)
); end defun
I've reached the age where the happy hour is a nap. ()
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

pmvliet

  • Guest
Another Menu question
« Reply #20 on: February 04, 2005, 12:53:12 PM »
Hi Cab,

I did two things, I replaced the menu_change code to the second one and I took all the spaces out of my menu. Now it sort of worked, but Menu_change is not getting loaded into the drawing. If I manually appload menu_change.lsp, the routine works. I do have a bug so i have to sort that out and I need to get more clients set up to really test this.

Stay tuned.

Pieter

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Another Menu question
« Reply #21 on: February 04, 2005, 01:18:00 PM »
Pieter

Replace the LOAD command with APPLOAD

Code: [Select]
[Lowe's]^c^c^P(if (null menu_change) (appload menu_change));(menu_change "lowes");
I've reached the age where the happy hour is a nap. ()
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

pmvliet

  • Guest
Another Menu question
« Reply #22 on: February 04, 2005, 03:04:08 PM »
Thanks Cab, I will change that to appload.
I will say that this is really, really sweet and everything that I want!
Profiles will be gone and I will be  :D

I need to modify the routine because as I was testing it I realized I have two more variables that I need to account for.

The statement
Code: [Select]
(menu_change "lowes");
takes Lowes to the menu_change lisp correct
it is then read into menu_change lisp with this
Code: [Select]
(defun menu_change (newclient)
so menu_change is a holder for the value to pass it on to the routine?
to become the variable "newclient"
is this correct?

Now, can I pull in two more variables as well the same way?
Code: [Select]
(Menu_change division sbu "lowes" "Retail" "RO SBU")

the reason being is
Quote

strcat "i:\\autodesk\\ro sbu\\retail\\" newclient "\\menu\\" newclient))


"ro sbu" needs to vary
and "retail" would vary depending on the one above.

Quote
strcat i:\\autodesk\\" SBU "\\" Division "\\" newclient "\\menu\\" newclient


I sure got a lot of variables in this thing, but I think that will make it work better and stay broad enough...

Pieter

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Another Menu question
« Reply #23 on: February 04, 2005, 03:45:01 PM »
You could keep the data in the lisp like this.
Code: [Select]
;;  Menu_change.lsp
(defun menu_change (newclient / clist)
  (if (or (null newclient) (= newclient ""))
    (setq newclient "lowe's") ; default client
  )
  (if (null (getenv "client"))
    (setenv "client" "None Loaded")
  )
  ;;  check for new client
  (if (= (strcase newclient) (strcase (getenv "client")))
    (alert "\r Client already Loaded")
    ;; else load client
    (if (setq clist (assoc (strcase newclient)
                (list
           (list  "LOWE'S"             "ro sbu" "retail")
           (list  "CIRCUIT CITY"       "ro sbu" "retail")
           (list  "RITEAID"            "ro sbu" "retail")
           (list  "WALGREEN'S"         "ro sbu" "retail")
           (list  "PETSMART"           "ro sbu" "retail")
           (list  "MEIJER"             "ro sbu" "retail")
           (list  "ALBERTSONS"         "ro sbu" "retail")
           (list  "TIPPMANN"           "ro sbu" "retail")
           (list  "GE FUEL"            "ro sbu" "retail")
           (list  "RETAIL"             "ro sbu" "retail")
           (list  "DOMINICKS"          "ro sbu" "retail")
           (list  "WESTFIELD-IN"       "ro sbu" "retail")
           (list  "<-WESTFIELD-OUT"    "ro sbu" "retail")
                ) ; list
        ); assoc
     (progn
        ;; Check / Unload existing menugroup
        (if (/= (menugroup (getenv "client")) nil)
           (command "_MENUUNLOAD" (getenv "client"))
        ); end if
        (setenv "client" newclient)
        (command "menuload"
                (strcat "i:\\autodesk\\" (cadr clist) "\\"
                        (caddr clist) "\\" newclient "\\menu\\" newclient))
        (menucmd (strcat "p15=+" newclient ".pop1"))
        (alert (strcat "Notice:\nThe" newclient "Workspace has been loaded!"))
      ); progn
      (alert "\r Client data missing nothing Loaded")
    ); endif
  ); endif
); end defun
I've reached the age where the happy hour is a nap. ()
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

pmvliet

  • Guest
Another Menu question
« Reply #24 on: February 04, 2005, 06:52:15 PM »
Hi Cab,

The appload didn't work either. I added a call for that routine in my main mnl file. You think that is ok... What could I take out of
Code: [Select]
[Lowe's]^c^c^P(if (null menu_change) (appload menu_change));(menu_change "lowes");
can it just be
Code: [Select]
^c^c^p(menu_change "lowes")

the other thing,
Code: [Select]
(setq newclient "lowe's")
lowe's is embeded into this code, how could we change this? I don't know if that is why Lowe's won't load correctly. I would take a guess.

Well Thanks a lot Cab! I will have to buy you a cold one or two when we meet!

Pieter

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Another Menu question
« Reply #25 on: February 04, 2005, 08:41:56 PM »
This is all you need if menu_choice is already loaded.
Code: [Select]
^c^c^p(menu_change "lowes")
Nothing else is needed.

Is the Menu_Choice routine working?
Note, your example is inconsistant with the lisp data which is "lowe's" not "lowes"
Sounds like "Menu_Choice.lsp" in not in the ACAD search path.
If you enter (load "Menu_choice") at the command line it will load if in the path.
You should not have to change the menu file just ge the lisp in the path.
Move it to the ACAD root directory & try to load it.
I've reached the age where the happy hour is a nap. ()
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

pmvliet

  • Guest
Another Menu question
« Reply #26 on: February 09, 2005, 05:02:36 PM »
Hey Cab,

I figured out why my menu command didn't work.
I needed:
Quote
(Load "Menu_Change")

The quotes, now it works just fine.

ok, after testing it works really well and now I see something I want to add. Yet another variable to pull yet another menu.
This time I want to pull discipline menu's.

I don't fully understand the lists. Any tips to expand the list or to put it in.
I would call the variable "discipline" of "disc" for short.

Thanks,
pieter

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Another Menu question
« Reply #27 on: February 09, 2005, 06:49:55 PM »
Missing the quotes, sorry I didn't see that. I should have. :oops:

Can you give an example of the new item?
I've reached the age where the happy hour is a nap. ()
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

pmvliet

  • Guest
Another Menu question
« Reply #28 on: February 14, 2005, 09:00:23 AM »
Basically I want to have part of my pulldown menu which will look like this:
Quote

[->Select your Discipline]
[Architectural]
[Mechanica]
[Plumbing]
[Civil]
[Structural]
[Interiors]
[Electrical]


When you select one of your disciplines, it will then load a cooresponding menu. Just like the client menu's but one for a discipline. Once this menu is loaded, I will have blocks/lisps/data associated for that specific client.

For me thinking ahead, some clients already have sub menu's like this and I may want to unload or disable these master disciplines but I will worry about that later.

Thanks,
Pieter