Return static exit quietly

Discussion in 'AutoCAD' started by Matthew, Jul 26, 2004.

  1. Matthew

    Matthew Guest

    I have a reactor that, when it runs it returns or prints to the command line
    a bunch of vla-objects and nils. I am wondering how to get rid of this
    phenomenon. As an example this is what I get.

    0e70dc54>#<VLA-OBJECT IAcadDimStyle 0e70da14>#<VLA-OBJECT IAcadDimStyle
    0e70d7d4>#<VLA-OBJECT IAcadDimStyle 0e70d594>txt.shx((0 . STYLE) (100 .
    AcDbSymbolTableRecord) (100 . AcDbTextStyleTableRecord) (2 . T60) (70 . 0)
    (40
    .. 12.0) (41 . 0.9) (50 . 0.0) (71 . 0) (42 . 0.0) (3 . txt.shx) (4 .
    ))txt.shx((0 . STYLE) (100 . AcDbSymbolTableRecord) (100 .

    I think that this is caused by (princ var) to return information from one
    function back to another. Is this it? Is there another way of doing that?
    without making a global variable.

    Matthew
     
    Matthew, Jul 26, 2004
    #1
  2. Just remove the (princ ) from your (princ var),

    e.g., change
    (setq a (princ b))
    to
    (setq a b)
     
    Allen Johnson, Jul 26, 2004
    #2
  3. Matthew

    Tom Smith Guest

    It looks like a princ is involved. If you mean that the function being
    called ends in (princ var), that isn't necessary. To make the function
    return the value of var, simply end it with var rather than (princ var).
     
    Tom Smith, Jul 26, 2004
    #3
  4. Matthew

    Matthew Guest

    Thanks. I didn't know it would work that way. being that the variable wan
    not inside a paren. ;)

    Thanks again
    Matthew
     
    Matthew, Jul 26, 2004
    #4
  5. Matthew

    Tom Smith Guest

    Thanks. I didn't know it would work that way.

    It's not necessary to do a setq, pric, or whatever to return a value. In
    lisp, the general rule is, whatever is evaluated last is returned.

    (defun c:test (/ a b c)
    (setq
    a 1
    b 2
    c 3
    )
    b
    )

    In this case, the last thing evaluated is the variable b, so the function
    will return its value, 2. If this line were omitted, then the last thing
    evaluated would be (setq c 3) and the function would return 3.
     
    Tom Smith, Jul 26, 2004
    #5
  6. Matthew

    Doug Broad Guest

    Hi Tom,
    What you showed is correct. Return values of reactor callbacks, however,
    are not displayed at the command line.

    Regards,
    Doug
     
    Doug Broad, Jul 26, 2004
    #6
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.