Results 1 to 4 of 4

Thread: Help fix a routine - Error: too few arguments

  1. #1
    Woo! Hoo! my 1st post
    Join Date
    2020-04
    Posts
    1
    Login to Give a bone
    0

    Default Help fix a routine - Error: too few arguments

    Code:
    Private Sub ToggleWireNum()
    Dim pi As Double: pi = 4 * Atn(1)
    Dim x As AcadEntity
    Dim lin As AcadLine
    Call WDForceStart
    On Error Resume Next
    For Each x In ThisDrawing.ModelSpace
        If TypeName(x) = "IAcadLine" Then
            Set lin = x
              If lin.Angle = pi Then
                
                ThisDrawing.SetVariable "USERS1", x.Handle
                
                WDCommand ("(setq return (c:ace_get_wnum (handent (getvar ""USERS1""))))" & vbCr)
                
                WDCommand ("(setvar ""USERS2"" (car return))" & vbCr)
                    
                    If Len(ThisDrawing.GetVariable("USERS2")) > 0 Then
    
                        WDCommand ("(c:ace_toggle_inline (cadr return))" & vbCr)
                        
                    End If
            End If
        End If
    Next x
    End Sub
    
    Public Sub WDCommand(Command As String)
    ' MsgBox ("WDCommand subroutine called.")
    ThisDrawing.SendCommand (Command)
    End Sub
    
    Public Sub WDForceStart()
    Call WDCommand("(if(not wd_load)(if(setq x(findfile ""wd_load.lsp""))(load x)))(wd_load)" & vbCr)
    End Sub
    Last edited by Ed Jobe; 2020-04-27 at 02:24 PM. Reason: added <CODE> tags

  2. #2
    Active Member
    Join Date
    2015-12
    Posts
    51
    Login to Give a bone
    0

    Default Re: Help fix a routine - Error: too few arguments

    Hi, Welcome to the AUGI Forums. Unfortunately you've posted this in the Autolisp Forum and it really should be in the VBA/COM Interop Forum. Perhaps a MOD can move it.

  3. #3
    Administrator Ed Jobe's Avatar
    Join Date
    2000-11
    Location
    Turlock, CA
    Posts
    5,744
    Login to Give a bone
    0

    Default Re: Help fix a routine - Error: too few arguments

    Hi. I see this is your first post. Welcome to AUGI.

    You shouldn't try to mix lisp and VBA like this. The SendCommand method does not work like the (command) function. It is asynchronous. It runs after the vba method is finished. Therefore you are relying on variable that are not set until after the vba is finished. Convert the lisp to vba and it should work.

    Also, if you want help, it would be helpful if you provided as much information as possible, such as which line is giving the error. To add <CODE> tags to your post, click on Go Advanced at the bottom of the reply window, then select the <#> button.
    C:> ED WORKING....

  4. #4
    Member
    Join Date
    2008-02
    Posts
    48
    Login to Give a bone
    0

    Default Re: Help fix a routine - Error: too few arguments

    Hi andy_skur
    Please let us know where system hangs,
    I suggest only to substitute

    Code:
    If TypeName(x) = "IAcadLine" Then
    with

    Code:
    If TypeOf X is IAcadLine then
    concerning the section related to sendcommand I don't understand which is the functionality requested by sendcommand, in any case this part could be substitute with VBA code appropriate.
    Last edited by grobnik; 2020-05-01 at 01:24 PM.

Similar Threads

  1. Error: too few arguments in a function
    By twitchyChuck in forum AutoLISP
    Replies: 6
    Last Post: 2013-06-07, 09:24 PM
  2. Replies: 7
    Last Post: 2012-12-11, 01:41 PM
  3. Too few arguments, can someone check please?
    By mrsusan in forum AutoLISP
    Replies: 18
    Last Post: 2011-10-21, 12:00 PM
  4. Help fix a routine - Error: too few arguments
    By cadd4la in forum AutoLISP
    Replies: 3
    Last Post: 2006-01-10, 06:06 PM
  5. too few arguments on compile
    By voigtmark in forum AutoLISP
    Replies: 3
    Last Post: 2005-10-28, 06:54 PM

Tags for this Thread

Posting Permissions

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