Author Topic: No command line means ...  (Read 4130 times)

0 Members and 1 Guest are viewing this topic.

Hangman

  • Guest
No command line means ...
« on: July 15, 2005, 02:13:54 PM »
TROUBLE  :?:

Has anyone figured out how to   PRINC   without a command line in 2006 ???

I'm having trouble reading the questions and variable settings in my lisps without a command line, the  PRINC  does not print the text in the lisp to the command line at the cursor in 2006.

daron

  • Guest
No command line means ...
« Reply #1 on: July 15, 2005, 02:35:23 PM »
Turn it back on? Are there customizable tooltips? <Something that would popup when there was a question to the user? Edit your lisps to be more GUI compliant? I don't know.

Hangman

  • Guest
No command line means ...
« Reply #2 on: July 18, 2005, 11:56:15 AM »
Well Daron, ...  there's noth'n to turn on that I'm aware of (unless your speak'n of the command line).  Here's an example of a problem I am having:
Code: [Select]
;
  (setq defbs bs)
  (if (= defbs NIL)
    (setq defbs 0.75)
  )
  (setq deftk tk)
  (if (= deftk NIL)
    (setq deftk 0.75)
  )
  (setq defbd bd)
  (if (= defbd NIL)
    (setq defbd 8.0)
  )
  (if (/= ln nil)
    (setq defln ln)
  )
  (if (= ln nil)
    (setq defln "Y")
  )
;
;;;get user input for anchor bolt
;
  (setq spt (getpoint "\nEnter start point for bolt...  "))
  (princ "Enter bolt diameter <")
  (princ defbs)
  (setq bs (getreal " in >:"))
  (if (= bs nil)
    (setq bs defbs)
  )
  (princ "Enter the base plate thickness <")
  (princ deftk)
  (setq tk (getdist " in >:"))
  (if (= tk nil)
    (setq tk deftk)
  )
  (princ "\nEnter the embedment depth <")
  (princ defbd)
  (setq bd (getdist " in >:"))
  (if (= bd nil)
    (setq bd defbd)
  )
  (princ "\nDo you want a leveling nut <")
  (princ defln)
  (setq ln (getstring ">? "))
  (if (= ln "")
    (setq ln defln)
  )
  (if (= ln "n")
    (setq ln "N")
  )
  (if (= ln "y")
    (setq ln "Y")
  )
;

This code draws an anchor bolt according to the input of the user.  The first line, (setq spt (getpoint "\nEnter start point for bolt...  ")) shows up at the cursor when the program is launched.  But the second thru the rest - enter bolt diameter, base plate thickness, etc - does not show up, and they are princ statements.

How can I make these more GUI compliant without dialog boxes ???  I'm working for speed here, not eye candy.

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
No command line means ...
« Reply #3 on: July 18, 2005, 01:07:31 PM »
Try this;
Code: [Select]
(setq spt (getpoint "\nEnter start point for bolt...  "))
  (setq bs (getreal (strcat "Enter bolt diameter " (rtos defbs) " in >: ")))
  (if (= bs nil)
    (setq bs defbs)
  )
TheSwamp.org  (serving the CAD community since 2003)

daron

  • Guest
No command line means ...
« Reply #4 on: July 18, 2005, 03:05:39 PM »
I thought your command line was turned off :?: If not, what Mark showed should work. I'll never figure out why princ is so overused like you've got there, but that's just me.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
No command line means ...
« Reply #5 on: July 18, 2005, 03:06:17 PM »
As Mark said this is the way you could do it.
Code: [Select]
;
;;;get user input for anchor bolt
;
(setq spt (getpoint "\nEnter start point for bolt...  "))
(setq bs (getreal(strcat "\nEnter bolt diameter <" (rtos defbs) " in >:")))
(or bs (setq bs defbs))
(setq tk (getdist (strcat "\nEnter the base plate thickness <" (rtos deftk) " in >:"))
(or tk (setq tk deftk))
(setq bd (getdist (strcat "\nEnter the embedment depth <" (rtos defbd) " in >:"))
(or bd (setq bd defbd))
(initget "Y N")
(setq ln (getstring "\nDo you want a leveling nut <" defln ">? "))
(or (/= ln "") (setq ln defln))
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Hangman

  • Guest
No command line means ...
« Reply #6 on: July 19, 2005, 11:16:53 AM »
Mark,  Excellent, Thank you.
Daron, In 2006, the user can turn the command line off.  Whenever the lisp is run, the integers and quotes are displayed at the cursor.  The display at the cursor however, does not display the princ function.  dunno why.  We have the command line on at the moment just to use the lsps we have but we want to eventually turn it off.  Dunno why on that one either.  Just a cool feature that'll quickly die young perhaps.
Cab, Thank you, that helped a great deal.  I've realized I know very little about lsp.  I had no idea I could use the OR the way you did there.  I do have a stupid question though.  I noticed the rtos is displaying the integers of the defined labels.  But how does one display the definition of the LN, So the user can see what the current default of the leveling nut, either Y or N would be ???

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
No command line means ...
« Reply #7 on: July 19, 2005, 11:34:49 AM »
Wasn't paying attention to the variable for the Y/N
If ln is the string just use it like this
Code: [Select]
(initget "Y N")
(setq ln (getstring "\nDo you want a leveling nut <" ln ">? "))
(or (/= ln "") (setq ln defln))

What exactly is defln, what type var? if you wan to use a logical variable (T/F)
you could do it like this
Code: [Select]
(initget "Y N")
(setq ln (getstring "\nDo you want a leveling nut <"
                    (if defln  "Y" "N")
                    ">? "))
(cond
 ((= ln "")); no change, leave var as is
 ((= ln "Y")(setq defln T))
 (T (setq defln nil)) ; T catches everything else
)
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Hangman

  • Guest
No command line means ...
« Reply #8 on: July 19, 2005, 12:07:24 PM »
CAB, your correct in that this is a T/F statement.  What I'm looking at is the first line of code you have there:
[code] (setq ln (getstring "... <' ln ">? "))  [\code]
It is the  ln  you have by itself that I'm focusing on.  This does not display what variable  ln  is holding, whether a Y or an N.  How can you get the display of the  ln  without using princ and before the user makes a choice ???
In my initial post, the code shows that  defln  is pre-defined with a Y.  However, if the user is using this lsp several times, the current  ln  needs to be displayed as the user needs to know if the current definition is an N or a Y.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
No command line means ...
« Reply #9 on: July 19, 2005, 12:33:27 PM »
Sorry I left out the strcat
Code: [Select]
(initget "Y N")
(setq ln (getstring (strcat "\nDo you want a leveling nut <" defln ">? ")))
(or (/= ln "") (setq ln defln))
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Hangman

  • Guest
No command line means ...
« Reply #10 on: July 19, 2005, 12:54:19 PM »
Yessir, that's the ticket.

I was trying the strcat but I couldn't figure out where it was to be placed, I kept trying to place it after the prompt and before the defln, in between the brackets <>.

Thank You.

DanB

  • Bull Frog
  • Posts: 367
No command line means ...
« Reply #11 on: July 20, 2005, 01:00:47 PM »
Is it also possible to display a result of a LISP at the cursor? Such as:

Code: [Select]

 (defun C:S1 (/)
  (setvar "osmode" 33)
  (prompt "\nOSNAP Set to ENDpoint + INTersection")
  (princ)
 )


"OSNAP Set to ENDpoint + INTersection" will not display at the cursor.

Hangman

  • Guest
No command line means ...
« Reply #12 on: July 20, 2005, 01:24:56 PM »
Correct Dan, for some reason 2006 will not display any prin1, princ, prompt or other type at the cursor.  It has to be doing something.  Also interesting to note, in 2006, the command you type in does not appear at the command line, it appears at the cursor only.

daron

  • Guest
No command line means ...
« Reply #13 on: July 20, 2005, 01:56:51 PM »
What happens if you use princ instead of prompt and leave out the lone princ so that the prompting princ is your return value? Or, just leaving out the princ altogether?