Can't reenter LISP.

Discussion in 'AutoCAD' started by mgrigoriev, Jul 16, 2004.

  1. mgrigoriev

    mgrigoriev Guest

    Hi, I am running into a "Can't reenter LISP." problem when I run align command from my VB code. This happens only the first time I run align. The second time I run the program it works just fine. My program creates a LWPolyline with AddLightWeightPolyline and then aligns it with an existing object on the screen. That's all it does. I send the entity to the align command with the help of handent. Here is the error that I am getting:


    Command: align
    Initializing...
    Select objects: (handent "13ECE2D")
    Can't reenter LISP.
    *Invalid selection*
    Expects a point or
    Window/Last/Crossing/BOX/ALL/Fence/WPolygon/CPolygon/Group/Add/Remove/Multiple/P
    revious/Undo/AUto/SIngle
    Select objects:

    Thanks in advance for any help you can give me.
    Mike
     
    mgrigoriev, Jul 16, 2004
    #1
  2. mgrigoriev

    TomD Guest

    You cannot pass a lisp function to the command line while another lisp
    routine is running, that is what generates that message.

    (handent "13ECE2D") is a lisp function, therefore cannot be called by ALIGN,
    which is actually a lisp function, as well.......I think.

    What puzzles me is that you said it works the second time you run it. Are
    you passing all of this via SendCommand?

    Could you paste from the command line after a successful run through?

    command from my VB code. This happens only the first time I run align. The
    second time I run the program it works just fine. My program creates a
    LWPolyline with AddLightWeightPolyline and then aligns it with an existing
    object on the screen. That's all it does. I send the entity to the align
    command with the help of handent. Here is the error that I am getting:
     
    TomD, Jul 16, 2004
    #2
  3. mgrigoriev

    mgrigoriev Guest

    Here's the code that I use:

    ThisDrawing.SendCommand "align" & vbCr & "(handent " & Chr(34) & Entity & Chr(34) & ")" & vbCr & vbCr & _
    Entity.Coordinate(0)(0) & "," & Entity.Coordinate(0)(1) & vbCr & EntityInside.Coordinate(0)(0) & "," & EntityInside.Coordinate(0)(1) & vbCr & _
    Entity.Coordinate(3)(0) & "," & Entity.Coordinate(3)(1) & vbCr & EntityInside.Coordinate(3)(0) & "," & EntityInside.Coordinate(3)(1) & vbCr & vbCr & "N" & vbCr

    ...And here's the command line when everything works well:

    Command: align
    Select objects: (handent "13F154F")
    <Entity name: 4129d478>
    1 found
    Select objects:
    Specify first source point: -3,-3.5
    Specify first destination point: 6712326.50020298,1877323.6763659
    Specify second source point: -3,44
    Specify second destination point: 6712362.38342688,1877354.79941593
    Specify third source point or <continue>:
    Scale objects based on alignment points? [Yes/No] <N>: N
     
    mgrigoriev, Jul 16, 2004
    #3
  4. mgrigoriev

    Jeff Mishler Guest

    The first time "Align" is used, the arx module hasn't been
    loaded.....acad2000doc.lsp has commands that "autoload" certain external
    applications, align is one of these. To autoload them, a small lisp program
    is used that actually creates the command to call from the command line,
    thus the "can't re-enter autolisp" message. Once it's been loaded, acad
    recognizes "align" as a command, so the lisp is bypassed, which is why it
    works after the initial run.

    To circumvent this, you may be able to issue
    Sendcommand "align" & vbCr & vbCr
    Which should initialize, and then cancel, the align command. Now you should
    be able to continue.

    HTH,
    Jeff
    --
    For additional help, try out www.cadvault.com
    remove USES from email address to reply
    Chr(34) & ")" & vbCr & vbCr & _
    EntityInside.Coordinate(0)(0) & "," & EntityInside.Coordinate(0)(1) & vbCr &
    _
    EntityInside.Coordinate(3)(0) & "," & EntityInside.Coordinate(3)(1) & vbCr &
    vbCr & "N" & vbCr
     
    Jeff Mishler, Jul 16, 2004
    #4
  5. mgrigoriev

    mgrigoriev Guest

    Thanks, Jeff, that makes sense.
     
    mgrigoriev, Jul 17, 2004
    #5
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.