vl-Catch-All-Apply and redefined command

Discussion in 'AutoCAD' started by Gordon Price, Dec 31, 2003.

  1. Gordon Price

    Gordon Price Guest

    Let me just try this again ;)

    I am trying to replace the standard Mtext command with one that handles
    office layers and styles and such. prefer this first batch of code at the
    vl-Catch-All-Apply handles a user cancel of the Mtext dialog rather nicely.
    However, when I undefine Mtext and include the code in my own C:Mtext
    routine, the vl-Catch-All-Apply line fails because there is no Mtext
    command, even with the period to run the original Acad commend. Am I doing
    something wrong in my code? Do I need to use a different approach for this?
    Any help out there on a New Years Eve Day?

    Thanks in advance.
    Happy New Year everyone!

    Gordon

    While I am at it, the other thing that I don't like is that I only show the
    user a standard getcorner rectangle, but I can't seem to get a Pause to work
    in a vl-Catch-All-Apply. Is there a better way to manage this so that I can
    get a proper Mtext box graphic when picking the Mtext corners?



    (setq LE (entlast))
    (initdia 1)
    (setq PT1 (getpoint "Specify first corner: "))
    (setq PT2 (getcorner PT1 "Specify second corner: "))
    (vl-Catch-All-Apply 'vl-cmdf (list ".mtext" PT1 PT2))
    (if (= (entlast) LE)(*ERROR* "Function cancelled"))

    (setqLE (entlast))
    (initdia 1)
    (command ".mtext" pause "Height" TH)
    (while (= (logand (getvar "CMDACTIVE") 1) 1)(command pause))
    (if (= (entlast) LE)(*ERROR* "Function cancelled"))
     
    Gordon Price, Dec 31, 2003
    #1
  2. Gordon Price

    ECCAD Guest

    In the following: Where is TH defined ?
    (command ".mtext" pause "Height" TH)

    Could be the culprit.
    Bob
     
    ECCAD, Dec 31, 2003
    #2
  3. Gordon Price

    Gordon Price Guest

    The TH is just a calculation for text height, and in the vl-... version I
    just set the textsize sysvar elsewhere. I will try them and see, but I am
    guessing that if anything the simpler version of the vl-... is better. I am
    guessing that there is something in using vl-cath-all-apply with a redefined
    command, but tomorrow I will be playing with really stripped down stuff and
    see if I can get just the vl- and undefine to work.

    Best,
    Gordon
     
    Gordon Price, Dec 31, 2003
    #3
  4. (vl-cmdf) evaluates all of its arguments *before*
    any of them are passed to AutoCAD. Don't use it.

    You need to check the DIASTAT system variable.

    (initdia 1)

    (setq res
    (vl-catch-all-apply
    '(lambda
    (command "._MTEXT" pause pause)
    )
    )
    )

    (if (or (zerop (getvar "diastat"))
    (vl-catch-all-error-p res)
    )
    (princ "\nUser cancelled MTEXT")
    )
     
    Tony Tanzillo, Dec 31, 2003
    #4
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.