help with code?

Discussion in 'AutoCAD' started by Debi Olson, Aug 6, 2003.

  1. Debi Olson

    Debi Olson Guest

    There's something different between the A2k2 & A2k4 way of reading lisp.
    (duh!) However, I can't figure this one out and I'm still learning code so
    some of this is really Greek to me. In A2K2 when an item is selected and the
    prompts followed, a drop down menu of our colors appears for your selection.
    In A2k4 the menu does not drop down. You can select the menu and then
    complete the process but I'd like for it to work properly.

    Can anyone translate this into "where" my problem is? Point me in the right
    direction even? My guess is that it's something in the

    (menucmd (strcat "GAH."LMENU"=*"))

    portion of the code but I don't understand this command at all.

    Thanks for your help.

    Debi


    ;;;
    ;;; By Carl Rockstrom (my predecessor)
    ;;;

    ;;;
    ;;; CHANGE LAYER BY PICKING
    ;;; First, select entities to be changed to desired layer, press enter
    ;;; Second, select entity on layer to which all previously selected
    ;;; entities will go or press enter again to select layer from menu.
    ;;; Calls a section of the AutoCAD menu
    ;;;
    (prompt "Layer Changer - version 2.0")
    (defun error (s) ; If an error (such as escape) occurs
    (if (/= s "Function cancelled")
    (princ (strcat "\nError: " s)))
    (setq S nil
    cnt1 nil
    ss1 nil
    uv3 nil) ; Free selection-set if any
    (setq *error* olderr) ; Restore old *error* handler
    (princ)
    )
    (defun C:CL (/ olderr ss1 cnt1 uv1 uv2)
    (setq olderr *error*
    *error* error)
    (graphscr)
    (prompt "\nSelect entities to be changed ") (terpri)
    (setq ss1 (ssget))
    (setq cnt1 0)
    (setq uv3 (car (nentsel "Point to entity on target layer or ENTER for
    list: ")))
    (if uv3
    (progn (setq uv3 (assoc 8 (entget uv3))))
    (progn
    (menucmd (strcat "GAH."LMENU"=*"))
    (setq uv3 (cons 8 (strcase
    (getstring "Pick layer from menu or Type layer name: "))))
    )
    )
    (if (not (tblsearch "layer" (cdr uv3)))
    (progn
    (setq al-name (cdr uv3))
    (ADDLAYER "al-name")
    (repeat (sslength ss1)
    (setq uv1 (entget (ssname ss1 cnt1)))
    (setq uv2 (assoc 8 uv1))
    (entmod (subst uv3 uv2 uv1))
    (setq cnt1 (+ cnt1 1)))
    (PROMPT (strcat "\nChanged To Layer < "(CDR uv3)" >"))
    )
    (progn
    (repeat (sslength ss1)
    (setq uv1 (entget (ssname ss1 cnt1)))
    (setq uv2 (assoc 8 uv1))
    (entmod (subst uv3 uv2 uv1))
    (setq cnt1 (+ cnt1 1)))
    (PROMPT (strcat "\nChanged To Layer < "(CDR uv3)" >"))
    )
    )
    (setq *error* olderr
    uv3 nil)
    (PRINC)
    )
     
    Debi Olson, Aug 6, 2003
    #1
  2. Debi Olson

    Debi Olson Guest

    I'm not sure. There is an enormous menu file that has some of this in it.
    One of the things I'm trying to pare down. What am I looking for?

    Here's a section of the menu:

    //[4 IMAGE8 SYMBOLS]\^C^P(menucmd (strcat "I=AH."(substr LMENU 1
    1)"IMAGE8")) $I=* ^P
    //[5 IMAGE9 SYMBOLS]\^C^P(menucmd (strcat "I=AH."(substr LMENU 1
    1)"IMAGE9")) $I=* ^P
    //[6 IMAGE10 SYMBOLS]\^C^P(menucmd (strcat "I=AH."(substr LMENU 1
    1)"IMAGE10")) $I=* ^P
    //[7 IMAGE11 SYMBOLS]\^C^P(menucmd (strcat "I=AH."(substr LMENU 1
    1)"IMAGE11")) $I=* ^P

    Here's another one farther down the page:

    (cond ((tblsearch "LAYER" (strcat LMENU "TX")) (command "-LAYER" "S" (strcat
    LMENU "TX") ""))+
    ((tblsearch "LAYER" "A7") (command "-LAYER" "S" "A7" "")))(setvar "cecolor"
    "bylayer");+
    (command "_DTEXT" pause pause pause );(setvar "clayer" uv1)(setvar "cecolor"
    uv2)(setq uv1 nil uv2 nil)(princ))
    AH_Head [Headings](progn (command "_style" "ah-frac" "ah-frac" "" "" "" ""
    "" "TEXTSIZE" (*//DS 0.125))+
    (setq uv1 (getvar "clayer") uv2 (getvar "cecolor"));+
    (cond ((tblsearch "LAYER" (strcat LMENU "TX")) (command "-LAYER" "S" (strcat
    LMENU "TX") ""))+
    ((tblsearch "LAYER" "A7") (command "-LAYER" "S" "A7" "")))(setvar "cecolor"
    "2")(PRINC);+
    (command "_DTEXT" pause pause pause );(setvar "clayer" uv1)(setvar "cecolor"
    uv2)(setq uv1 nil uv2 nil)(princ))
    AH_Title [Titles](progn (command "_style" "hmfo" "hmf0" "" "" "" "" ""
    "TEXTSIZE" (* DS //0.1875))+
    (setq uv1 (getvar "clayer") uv2 (getvar "cecolor"));+
    (cond ((tblsearch "LAYER" (strcat LMENU "TX")) (command "-LAYER" "S" (strcat
    LMENU "TX") ""))+
    ((tblsearch "LAYER" "A7") (command "-LAYER" "S" "A7" "")))(setvar "cecolor"
    "2")(PRINC);+
    (command "_DTEXT" pause pause pause );(setvar "clayer" uv1)(setvar "cecolor"
    uv2)(setq uv1 nil uv2 nil)(princ))


    "Luis Esquivel" <www.draftteam.com> wrote in message
    how the variable LMENU is created?
     
    Debi Olson, Aug 6, 2003
    #2
  3. Debi Olson

    Debi Olson Guest

    Can I send it directly to you?

    "Luis Esquivel" <www.draftteam.com> wrote in message
    I supposed yes, make sure you are cover for any copyright issues since I
    think that code is own by your company... ask them first.

    luis
     
    Debi Olson, Aug 6, 2003
    #3
  4. Debi Olson

    Debi Olson Guest

    Thank you Luis. If you don't mind my asking, what is your native language?
    From where I'm sitting, your English is terrific.

    I think the above does not sound good in English should be:

    an I will try the best to help you...

    sorry ;-)

    luis.
     
    Debi Olson, Aug 6, 2003
    #4
  5. Debi Olson

    PF Guest

    ;; look carefully at the STRCAT statement...

    (strcat "GAH." LMENU "=*" )

    ;; Is there a menugroup named GAH <there Better be!>
    ;; check via MenuLoad command

    ;; do a string search for (setq LMENU ... or similar ... you may find it
    in LSP or MNL files
    ;; the * demands an immediate display of the result


    ;; also-- from what I could see (from part 2 of you posted MNU file)
    ;; LMENU deals with layers... is there a Layer handling Lisp file that has a
    relates Setq?
    (tblsearch "LAYER" (strcat LMENU "TX"))

    ;; above: looking for some LMENU Layer with "TX" suffix
     
    PF, Aug 7, 2003
    #5
  6. Debi Olson

    Debi Olson Guest

    This is the only other reference I can find in the original menu. Am I
    looking for another file? What does a "menugroup" actually look like. (I
    know there are different styles but the general commonalities.)

    (menucmd (STRCAT "GAH.LIB"LMENU"=AH.SWITDISC"))(menucmd "GAH.SWITDISC=*")

    We have an "AH" menu. I always thought the letter G was some sort of
    wildcard/command thing.

    Deb

    ;; look carefully at the STRCAT statement...

    (strcat "GAH." LMENU "=*" )

    ;; Is there a menugroup named GAH <there Better be!>
    ;; check via MenuLoad command

    ;; do a string search for (setq LMENU ... or similar ... you may find it
    in LSP or MNL files
    ;; the * demands an immediate display of the result


    ;; also-- from what I could see (from part 2 of you posted MNU file)
    ;; LMENU deals with layers... is there a Layer handling Lisp file that has a
    relates Setq?
    (tblsearch "LAYER" (strcat LMENU "TX"))

    ;; above: looking for some LMENU Layer with "TX" suffix
     
    Debi Olson, Aug 7, 2003
    #6
  7. Debi Olson

    Debi Olson Guest

    I should have been more careful reading your post. I thought most of that
    was my old post. Give me a bit and I'll check all your hints.

    Deb

    ;; look carefully at the STRCAT statement...

    (strcat "GAH." LMENU "=*" )

    ;; Is there a menugroup named GAH <there Better be!>
    ;; check via MenuLoad command

    ;; do a string search for (setq LMENU ... or similar ... you may find it
    in LSP or MNL files
    ;; the * demands an immediate display of the result


    ;; also-- from what I could see (from part 2 of you posted MNU file)
    ;; LMENU deals with layers... is there a Layer handling Lisp file that has a
    relates Setq?
    (tblsearch "LAYER" (strcat LMENU "TX"))

    ;; above: looking for some LMENU Layer with "TX" suffix
     
    Debi Olson, Aug 7, 2003
    #7
  8. Debi Olson

    PF Guest

    no- G indcates "Group" and that's OK (as is GAH as part of the Strcat
    function)
     
    PF, Aug 7, 2003
    #8
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.