Results 1 to 7 of 7

Thread: Pausing for user during SendCommand

  1. #1
    100 Club KevinBarnett's Avatar
    Join Date
    2001-10
    Location
    Pretoria, South Africa
    Posts
    119
    Login to Give a bone
    0

    Default Pausing for user during SendCommand

    Hi Gang

    The following code works but issues an error message at the command prompt:

    ThisDrawing.SendCommand ("rotate" & vbCr & "l" & vbCr & vbCr & _
    CStr(Round(Pnt(0), 3)) & "," & CStr(Round(Pnt(1), 3)) & vbCr & _
    "(pause)" & vbCr)

    The error message:
    ; error: bad function: "\\"

    Is there another way to pause for user input during VBA's SendCommand? Or is this a "no go/ dont do it" area?

    Thanks,

    Kevin.

  2. #2
    All AUGI, all the time
    Join Date
    2003-10
    Posts
    706
    Login to Give a bone
    0

    Default Re: Pausing for user during SendCommand

    What are you pausing for? Is it something that you could get VBA to get for you on screen (like a pick point) and then pass that to the sendcommand method? I've set SETQs in VBA before by just sending the command "(setq X value)" to the command line using sendcommand and then any lisp routine or AutoCAD command can access that value.

    I'll let someone else tell you why it's bad to use sendcommand method though. I really can't explain it the way it was explained to me.

  3. #3
    100 Club KevinBarnett's Avatar
    Join Date
    2001-10
    Location
    Pretoria, South Africa
    Posts
    119
    Login to Give a bone
    0

    Default Re: Pausing for user during SendCommand

    The example is using the rotate command. The macro/program needs the user to provide a rotation of the last object, and - usually this rotation would not be an exact angle, but rather a visually acceptable angle, therefore it would be best if the user can see the last object being "dynamically" rotated whilst supplying the rotation. I could be wrong, but VBA code to do the same task is either impossible or very very complex - thats why I opted for the sendcommand with rotate command, (pause) in lisp when prompting for the angle - simple but ugly. So ugly that an error message appears - thats why I would love to see an alternative.

    Thanks,

    Kevin.

  4. #4
    Member
    Join Date
    2001-11
    Location
    Manchester, UK
    Posts
    47
    Login to Give a bone
    0

    Smile Re: Pausing for user during SendCommand

    Is this the only thing you are doing in the sub/function? If so why not leave the pause for user input off which should leave the command ready for user input anyway.
    Make sure you still exit the sub/function cleanly.

    Jim

  5. #5
    Administrator richard.binning's Avatar
    Join Date
    2015-12
    Location
    In the foothills of the appalachians
    Posts
    2,261
    Login to Give a bone
    0

    Default Re: Pausing for user during SendCommand

    How about writing a lisp routine to grab the last entity and move and rotate it for placement. Then your vba routine could simply insert the block at a known location and use send command to call your newly written lisp routine to finalize the placement and rotation. The best of both worlds.

  6. #6
    Active Member
    Join Date
    2000-12
    Posts
    71
    Login to Give a bone
    0

    Default Re: Pausing for user during SendCommand

    If anyone ever needs to do this something like this will work
    Code:
    CommandString = "(Command ""-Insert"" """ & Selection & """ pause ""1"" ""1"" ""0"")"
    ThisDrawing.SendCommand (CommandString & VbCr)

  7. #7
    Active Member
    Join Date
    2007-12
    Posts
    68
    Login to Give a bone
    0

    Default Re: Pausing for user during SendCommand

    Ive ended up making my own rotate command in VBA, that does so by the user sliding a scroll control across the form. That way, you get to select the appropriate angle for initial viewing ...

Similar Threads

  1. Modelspace AddDimRotated <> Sendcommand DimLinear
    By bsardeson in forum VBA/COM Interop
    Replies: 1
    Last Post: 2010-08-24, 07:54 PM
  2. using sendcommand
    By mdsalman2003 in forum AutoLISP
    Replies: 2
    Last Post: 2010-05-31, 05:47 AM
  3. Not pausing for input
    By tsigler in forum AutoLISP
    Replies: 2
    Last Post: 2009-07-17, 03:38 PM
  4. Sendcommand Insert point
    By LHINES in forum VBA/COM Interop
    Replies: 1
    Last Post: 2006-08-09, 05:31 PM
  5. Replies: 5
    Last Post: 2005-09-09, 07:30 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •