Jump to content

Recommended Posts

Posted

I am trying to convert a routine that I wrote awhile back so that I can create a command line version of it. Right now it is all one function and I am trying to divide it up into several local functions so that I can choose which parts to use based on what command is executed. I have a few local functions already set up that work fine. I am doing it section by sectiona nd testing it. When I got to loading the dialog box it keeps erroring out.

 

This is the function command that calls the select local functions:

 
(defun C:pltt (/)
 (space)
 (bdrExt)
 (rundcl)
 (vrebles)
 (dwgplot)
)

 

This is the function I have set up for to load and run the DCL dialog box:

 
(defun rundcl (numThree / dlg-id dev1 dev2 dev3 dev4 dev5 device# pOne pTwo pThree pFour pFive Plot#)
 (setq dlg-id (load_dialog "Q:\\std\\acad\\support\\lisp\\plt.dcl"))
 (new_dialog "plt" dlg-id)

 (if
   (= numThree 20)
   (progn
    (action_tile "dev1" "(setq device# 1)")
    (mode_tile "dev2" 1)
    (mode_tile "dev3" 1)
    (mode_tile "dev4" 1)
    (action_tile "dev5" "(setq device# 5)")
    (action_tile "pOne" "(setq Plot# 1)")
    (mode_tile "pTwo" 1)
    (mode_tile "pThree" 1)
    (mode_tile "pFour" 1)
    (mode_tile "pFive" 1)
   )
 )

 (if
   (= numThree 40)
   (progn
    (mode_tile "dev1" 1)
    (action_tile "dev2" "(setq device# 2)")
    (action_tile "dev3" "(setq device# 3)")
    (action_tile "dev4" "(setq device# 4)")
    (action_tile "dev5" "(setq device# 5)")
    (mode_tile "pOne" 1)
    (action_tile "pTwo" "(setq Plot# 2)")
    (action_tile "pThree" "(setq Plot# 3)")
    (action_tile "pFour" "(setq Plot# 4)")
    (mode_tile "pFive" 1)
   )
 )

 (if
   (= numThree 60)
   (progn
    (mode_tile "dev1" 1)
    (action_tile "dev2" "(setq device# 2)")
    (action_tile "dev3" "(setq device# 3)")
    (action_tile "dev4" "(setq device# 4)")
    (action_tile "dev5" "(setq device# 5)")
    (mode_tile "pOne" 1)
    (action_tile "pTwo" "(setq Plot# 2)")
    (action_tile "pThree" "(setq Plot# 3)")
    (action_tile "pFour" "(setq Plot# 4)")
    (action_tile "pFive" "(setq Plot# 5)")
   )
 )
    (action_tile "plot" "(done_dialog 1)")
    (action_tile "cancel" "(done_dialog 0)")

    (start_dialog)
    (unload_dialog dlg-id)
)

 

The functions for "space," "dwgplot," "BdrExt," and "vrebles" work fine. I don't understand why this one keeps getting the error:

 

 
; error: too few arguments

 

any help would be greatly appreciated. I am new to using local functions so any help on this would be greatly appreciated.

 

Thanks.

Posted

Nvm. I resolved the issue. The variable "numThree" was called out as a local variable instead of keeping it global. Works now.

Posted

I got alittl eahead of myself. The dialog function now workd, and yes I will change it over to "Cond". However, this function is not working. I jsut want to set several variables that will be used for the output configuration:

 

;---------------------------------------------------
;------ Set Variables for Output configuration -----
;---------------------------------------------------
(defun vrebles (device1 device2 device3 device4 device5 device# Plot1 Plot2 Plot3 Plot4 Plot5 Plot# numThree / numOne numTwo)
; Set the output device variable and numOne based on selection:
 
 (cond
   ((= device# 1) (setq numOne 1))
   ((= device# 2) (setq numOne 10))
   ((= device# 3) (setq numOne 100))
   ((= device# 4) (setq numOne 1000))
   ((= device# 5) (setq numOne 10000))
 )
; Set the plot size variable and numTwo based on selection:
 (cond
   ((= Plot# 1) (setq numTwo 1))
   ((= Plot# 2) (setq numTwo 2))
   ((= Plot# 3) (setq numTwo 3))
   ((= Plot# 4) (setq numTwo 4))
   ((= Plot# 5) (setq numTwo 5))
 ))

 

Thanks again for the quick response Lee. Any additional help would be very greatly appreciated.

Posted

That's quite a few arguments you have there, only two of which are used in the function...

Posted
that's quite a few arguments you have there, only two of which are used in the function...

wow

........

Posted

Ok, I deleted the unnecessay arguments, but its still getting the error "too few arguments"

Posted
Ok, I deleted the unnecessay arguments, but its still getting the error "too few arguments"

You are assigning variables in a subroutine, but localizing them. What's the point?

Posted

Well, like I said, I am new to subroutines. Is this the reason I am getting that error?

Posted

Sounds like you aren't calling it with the correct number of arguments.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...