Jump to content

Recommended Posts

Posted

im trying to write a lsp, this is how it starts, when i run it my command line says

Command: 321

Loaded.

Select objects/: ; error: no function definition: TYPE

im confused why is it asking for a object and not a variable and not displaying my question?

(defun C:321 (/ type)
(setq type(getvar "\n Type of wall - X L T: "))

  • Replies 25
  • Created
  • Last Reply

Top Posters In This Topic

  • The Buzzard

    9

  • chelsea1307

    8

  • Lee Mac

    3

  • flowerrobot

    2

Posted

Chelsea,

 

Try

(defun C:321 (/ type)

(setq type(getstring "\n Type of wall - X L T: "))

 

the "getvar" is looking for a system variable, sometimes used with "setvar" to set a system variable.

Posted

thanks i will try that

Posted

ok, so i got that part fixed, this is what i have so far (yes im trying to work on a solution to the combining 3 lisps into one and yes i saw they have a solution but i already started so now i want to finish) So it gets through the picking right (thanks for getstring) and then it asks for the first corner for the window selection then it says

Select objects/: ; error: bad function: "x"

any ideas why? wall-x lsp works fine i tries it out

(defun C:321 (/ type)
(setq type(getstring "\n Type of wall - X L T: "))
(cond 
(= type x (c:wall-x))
(= type l (c:wall-l))
(= type t (c:wall-t))
)
(princ))

flowerrobot showed me this, and i think it would be good to add since it makes sure the files needed are loaded but i dont know where to put it

(if (findfile "Somesortalfile.lsp)
(load (findfile "somesortafile.lsp))
(progn
(alert "\nCan Not find you file, adjust your search paths")
(exit)
)
)

any help would be much appreciated

Posted

You can put all the lisp on the same doc, and, call the lisp as a command.

 

(cond
(= type x (command "lispoftypex"))
(= type l (command "lispoftypel"))
(= type t (command "lispoftypet"))
)
(princ)

Posted

Not sure about the Select objects/: ; error: bad function: "x" thing since that part of the code is not posted.

 

Anyway try this:

 

(defun C:321 (/ type)
 (initget "X L T")
 (setq type (getstring "\n Type of wall - < X > < L > < T >: "))
 (cond 
   ((= type "X")(WALL-X))
   ((= type "L")(WALL-L))
   ((= type "T")(WALL-T))
 )
 (princ)
)
(defun WALL-X ()
 (ALERT "You chose WALL-X")
)
(defun WALL-L ()
 (ALERT "You chose WALL-L")
)
(defun WALL-T ()
 (ALERT "You chose WALL-T")
)

Posted

Mates im trying to solve also :cry: my eyes are getting wet but keep trying

 

chelsea thanks for the extension, :D

Posted

You can also do this:

 

(defun C:321 (/ type)
 (initget "X L T")
 (setq type (getstring "\n Type of wall - < X > < L > < T >: "))
 (cond 
   ((= type "X")(C:WALL-X))
   ((= type "L")(C:WALL-L))
   ((= type "T")(C:WALL-T))
 )
 (princ)
)
(defun C:WALL-X ()
 (ALERT "You chose WALL-X")
)
(defun C:WALL-L ()
 (ALERT "You chose WALL-L")
)
(defun C:WALL-T ()
 (ALERT "You chose WALL-T")
)

Posted

whats the purpose of initget?

Posted
whats the purpose of initget?

 

It will only allow you to pick X, L, or T for the program to execute.

If you enter anything else the program will do nothing.

 

By the way, There seems to be a Working ; error: bad argument type: lselsetp nil problem in each of those 3 codes that you are trying to execute.

Posted
It will only allow you to pick X, L, or T for the program to execute.

If you enter anything else the program will do nothing.

 

By the way, There seems to be a Working ; error: bad argument type: lselsetp nil problem in each of those 3 codes that you are trying to execute.

 

 

When I checked the three codes in the VLisp editor I get this:

[CHECKING TEXT WALL-T.LSP loading...]
.
; warning: local variable used as function: WORK
; warning: local variable used as function: WORK
; warning: local variable used as function: WORK
; warning: local variable used as function: WORK
; warning: local variable used as function: WORK
; warning: local variable used as function: WORK
; warning: local variable used as function: WORK
; warning: local variable used as function: WORK
; warning: local variable used as function: WORK
; warning: local variable used as function: WORK
; warning: local variable used as function: WORK
; warning: local variable used as function: WORK
; warning: local variable used as function: WORK
; warning: local variable used as function: WORK
; warning: local variable used as function: WORK
; warning: local variable used as function: WORK
; warning: local variable used as function: SSFUNC
; warning: local variable used as function: WORK
; warning: local variable used as function: GETSIDE
; warning: local variable used as function: WORK
; warning: local variable used as function: NEATT1
.
; Check done.

 

[CHECKING TEXT WALL-X.LSP loading...]
.
; warning: local variable used as function: WORK
; warning: local variable used as function: WORK
; warning: local variable used as function: WORK
; warning: local variable used as function: WORK
; warning: local variable used as function: WORK
; warning: local variable used as function: WORK
; warning: local variable used as function: WORK
; warning: local variable used as function: WORK
; warning: local variable used as function: WORK
; warning: local variable used as function: WORK
; warning: local variable used as function: WORK
; warning: local variable used as function: WORK
; warning: local variable used as function: WORK
; warning: local variable used as function: SSFUNC
; warning: local variable used as function: NEATX1
.
; Check done.

 

[CHECKING TEXT WALL-L.LSP loading...]
.
; warning: local variable used as function: WORK
; warning: local variable used as function: WORK
; warning: local variable used as function: WORK
; warning: local variable used as function: WORK
; warning: local variable used as function: WORK
; warning: local variable used as function: WORK
; warning: local variable used as function: WORK
; warning: local variable used as function: WORK
; warning: local variable used as function: WORK
; warning: local variable used as function: WORK
; warning: local variable used as function: WORK
; warning: local variable used as function: WORK
; warning: local variable used as function: SSFUNC
; warning: local variable used as function: NEATL
.
; Check done.

Posted

hmmm, i just downloaded it and tried it and they worked for me, i cant get past the Select objects/: ; error: bad function: "x" or Select objects/: ; error: bad function: "X" doesnt seem to matter whether is caps or not

Posted
hmmm, i just downloaded it and tried it and they worked for me, i cant get past the Select objects/: ; error: bad function: "x" or Select objects/: ; error: bad function: "X" doesnt seem to matter whether is caps or not

 

I found out that part of the problem was I did not have anything on screen to select. The code is not clear to me on how it works. The program does not take into account user error.

 

There is still problems with variables in all three programs just the same as I have previously pointed out.

Posted

Yes same as a problem that i incounter, Select objects/: ; error: bad function: "T" but in a single route it work fine only when lines are not selected it post Working ; error: bad argument type: lselsetp nil, :o

Posted

lselsetp nil means that the selset (selection set) is nil.

 

Bad error trapping for no selection imo.

Posted

have any ideas why we cant get past selecting the first corner for the window? i understand the other lisps arent perfect, i didnt write them and have no idea where to even start trying to fix them it just doesnt seem right that when runningt the lisp alone it works fine but errors when called from another lsp

Posted

I'd have to take a proper look at them, I haven't the time right now :(

Posted
ok, so i got that part fixed, this is what i have so far (yes im trying to work on a solution to the combining 3 lisps into one and yes i saw they have a solution but i already started so now i want to finish) (princ))[/code]

Good on Ya!!!

 

 

i think it would be good to add since it makes sure the files needed are loaded but i dont know where to put it

(if (findfile "Somesortalfile.lsp)
(load (findfile "somesortafile.lsp))
(progn
(alert "\nCan Not find you file, adjust your search paths")
(exit)
)
)

any help would be much appreciated

 

Mate it depends oh how you want to approcate it.

do you want it to be a self contained file

Or have 3 other files floating around.

 

 

(if (findfile "WALL-L.lsp")
(load (findfile "WALL-L.lsp))
(progn
 (alert "\nCan Not find you file, adjust your search paths")
 (exit)
)
)
(initget "L T X")
BLAH BLAH

 

 

 

 

 

What you had before was close of the mark

 

(defun C:321 (/ type)
[color=red](initget 7 "X L T")[/color]
(setq type([color=red]getkword[/color]"\n Type of wall -[color=red] [X/L/T[/color][color=red]][/color]: "))
(cond 
(= type [color=red]"[/color][color=red]X"[/color] (c:wall-x))
(= type [color=red]"L"[/color] (c:wall-l))
(= type [color=red]"T"[/color] (c:wall-t))
)
(princ))

as was said before

Iniget makes the user only respond with thoese, if they dont, loop

7 means carnt be 0, "enter" or (negative i think, I always stick with 7)

I would also go with the getkword, once initget is there, kword & string will act the same, except the kword on all the later versions place a drop down menu on the mouse.

 

x \= X

Normally to combate this i use srcase

(setq type (srcase (getstring \n Type of wall - X L T: "))

so all letter come out as capitals.

 

 

mate, if you chuck them all in a single file, and **** the hole command thing from them, it would be the same as what i have in that topic, So i say GJ!

As for the errors you are getting im not sure why, purhaps post what you have

Posted
have any ideas why we cant get past selecting the first corner for the window? i understand the other lisps arent perfect, i didnt write them and have no idea where to even start trying to fix them it just doesnt seem right that when runningt the lisp alone it works fine but errors when called from another lsp

 

chelsea1307,

 

Attached is the 321.lsp with the 3 wall lisps added. They seem to work the same if called independently or from within this combined routine. I do not fully understand how each program is suppose to function. What I do know is they are running the same way no matter how they are called. As I have pointed out there are variable conflicts as well as poor error trapping. If you know how these routines are suppose to work then give this a try. Since I am aware that conflicts exist in this routine, I do not intend to resolve them since I do not understand the operation or intent of this program. If the attached programs above ~ WALL-X.lsp, WALL-L.lsp & WALL-T.lsp were working for you, This program should function the same way.

 

Good Luck,

The Buzzard

321.LSP

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...