P0=*

Discussion in 'AutoCAD' started by j.buzbee, Oct 6, 2004.

  1. j.buzbee

    j.buzbee Guest

    Yes, yes I know this has been discussed to death. I did do a google search
    but found basically iterations of what's already in the Vlisp help. So here
    it is:

    I've created a pull-down menu, "jbXrefUnload" in my partial menu, menugroup
    "jb40". I call the following and the snaps menu pops up - what's the deal???

    (progn(menucmd "p0=jb40.jbXrefUnload")
    (menucmd "p0=*"))

    Any help at all would be greatly appreciated.

    jb
     
    j.buzbee, Oct 6, 2004
    #1
  2. j.buzbee

    Doug Broad Guest

    James,
    Could you post a menu file that I could test this problem with.
    Would rather not try to re-create the problem from scratch.

    Regards,
    Doug
     
    Doug Broad, Oct 7, 2004
    #2
  3. j.buzbee

    j.buzbee Guest

    Doug, thanks for having a look. Well, I'm creating it on the fly . . .
    maybe that's the problem? Code below:

    ;;; Return a list of Xrefs
    ;;; use(setq l(jb:ListXrefs))
    (defun jb:ListXrefs (/ xreflist)
    (vlax-for
    x (vla-get-blocks (vla-get-ActiveDocument (vlax-get-acad-object)))
    (if (= (vlax-get-property x 'isxref) :vlax-true)
    (setq xreflist (append xreflist (list (vlax-get-property x 'name))))))
    xreflist)


    ;;; Returns the VLA-Object of the supplied popup menu item name
    ;;; - creates it if not there
    ;;; use: (setq ret(jb:ReturnPopMenu "jb40" "jbXrefReload"))
    (defun jb:ReturnPopMenu(menugrp popname / menus menu pops pop)
    (setq pops(jb:RetPopObj menugrp))
    (setq pop(vl-catch-all-apply 'vla-item(list pops popname)))
    (if (= (vl-catch-all-error-p pop) T)
    (setq pop(vla-add pops popname)))
    pop)

    ;;;(setq mainMenu(jb:RetPopObj "jb40"))
    ;;;Returns the supplied menu groups PopMenu object
    (defun jb:RetPopObj(menugrp / menus ret)
    (setq menus(vla-get-menugroups (vlax-get-acad-object)))
    (vlax-for i menus
    (if (=(vla-get-name i) menugrp)
    (setq ret (vla-get-menus i))))
    ret)

    ;;; Populate the Popup menu with current xref names
    ;;; Requires a pop object from jb:ReturnPopMenu
    ;;; (setq popobj(jb:ReturnPopMenu "jb40" "jbXrefReload"))
    ;;; use: (jb:popPop(jb:ReturnPopMenu "jb40" "jbXrefReload")"_reload")
    ;;; use: (jb:popPop(jb:ReturnPopMenu "jb40" "jbXrefUnload")"_unload")
    ;;;
    (defun jb:popPop(popobj oper / xreflist)
    (vlax-for i popobj
    (vla-delete i))
    (setq xreflist(jb:ListXrefs)
    cnt 0)
    (foreach i xreflist
    (vlax-invoke popobj 'addmenuitem cnt i
    (strcat "-xref " oper " " (chr 34) i (chr 34) " "))
    (setq cnt(1+ cnt))
    ))

    ;;; Command Line - pulls up snaps instead of jbXrefUnload
    (defun c:jbUnloadXrefPop( / pop index)
    (setq pop(jb:ReturnPopMenu "jb40" "jbXrefUnload"))
    (jb:popPop pop "_unload")
    (progn(menucmd "p0=jb40.jbXrefUnload")
    (menucmd "p0=*"))
    (menucmd "p0=acad.pop0"))
     
    j.buzbee, Oct 7, 2004
    #3
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.
Similar Threads
There are no similar threads yet.
Loading...