Could someone explain some old lisp routines for me please? Ustr / Ureal

Discussion in 'AutoCAD' started by Friptzap, Apr 8, 2004.

  1. Friptzap

    Friptzap Guest

    USTR and UREAL - if you search the forums you will find them. I have these in use currently and my files will not work without them however they seem redundant or perhaps overly extensive? Could you break down the details of what these two files actually do for me please?
     
    Friptzap, Apr 8, 2004
    #1
  2. Friptzap

    Joe Burke Guest

    From what I gather (Goggle search) they are just wrappers for standard lisp
    functions. Do you want to remove these functions from your programs which use them?

    Joe Burke


    currently and my files will not work without them however they seem redundant or
    perhaps overly extensive? Could you break down the details of what these two files
    actually do for me please?
     
    Joe Burke, Apr 8, 2004
    #2
  3. Friptzap

    Friptzap Guest

    Yeah that is what I am trying to do. Seams that they rely in part on these for message input somehow. I think there may be a more efficient way to do this (not sure what yet :) )

    ;* UREAL User interface real function
    ;* BIT (0 for none) and KWD key work ("" for none) are same as for INITGET.
    ;* MSG is the prompt string, to which a default real is added a <DEF> (nil
    ;* for none), and a : is added. BPT is base point (nil for none).

    (defun ureal (bit kwd msg def / inp)
    (if def
    (setq msg (strcat "\n" msg " <" (rtos def) ">: ")
    bit (* 2 (fix (/ bit 2)))
    );setq
    (setq msg (strcat "\n" msg ": "))
    );end if
    (initget bit kwd)
    (setq inp (getreal msg))
    (if inp inp def)
    );defun
    *

    ;* USTR User interface string
    ;* If BIT=1 no null "" input allowed, 0 for note, BIT ignored if DEF present.
    ;* MSG is the prompt string, to which a default string is added a <DEF> (nil
    ;* or "" for none), and a : is added. If SPFLAG T, spaces are allowed in
    ;* string.
    ;*

    (defun ustr (bit msg def spflag / inp nval)
    (if (and def (/= def ""))
    (setq msg (strcat "\n" msg " <" def ">: ")
    inp (getstring msg spflag)
    inp (if (= inp "") def inp)
    );setq
    (progn
    (setq msg (strcat "\n" msg ": "))
    (if (= bit 1)
    (while (= "" (setq inp (getstring msg spflag))))
    (setq inp (getstring msg spflag))
    ) );progn & if
    );if
    inp
    );defun
    ;*

    I have used these in another local and had no clue where they came from. Seems to have been a magazine years ago, as my search of these boards found out.

    I have seen other things I think I can do inside my lisp routine so I am not sure if I need these or not. They are used in places that request user input and seem to hold values for future session use two separate values one for size input and one for layer name. Then unless the user changes these on the next command execution they just stay as defaults. Anyway around this that you think may serve better?

    I really try hard to create my own code or at the very least use only common code, in the same vein that no matter who uses it always will be the same wording. How do you know the difference between common code (for lack of better wording) and copyright infringement? If I get back into this I want to create my own stuff but like most people I am sure I would be borrowing from others ideas. What is the line between common code and ownership?
     
    Friptzap, Apr 8, 2004
    #3
  4. If I am not mistaken those are from an old New Rider's
    Publication book "Maximizing AutoCAD" or "AutoLISP"
    (something like that) and are copyrighted works.

    Read: Probably should not be posted on newsgroups.

    Yeah that is what I am trying to do. Seams that they rely in part on these for message input somehow. I think there may be a more
    efficient way to do this (not sure what yet :) )

    ;* UREAL User interface real function

    <snippage>
     
    michael puckett, Apr 8, 2004
    #4
  5. Friptzap

    Friptzap Guest

    I found that posted in several places in the newsgroups. I am not sure if it is @ or not though that is why I would lie to get rid of it's usage.
     
    Friptzap, Apr 8, 2004
    #5
  6. I have no idea what you're talking about. Sorry.


    I am not sure if it is @ or not though that is why I would lie to get rid of it's usage.
     
    michael puckett, Apr 8, 2004
    #6
  7. Friptzap

    Don Butler Guest

    This is from the book Maximizing Autolisp by New Riders Publishing.

    I believe Tony Tanzillo of this newsgroup collaborated on this book.

    Checkout Amazon to find a copy.

    This book is an excellent primer for AutoLisp.

    Don


    in use currently and my files will not work without them however they seem
    redundant or perhaps overly extensive? Could you break down the details of
    what these two files actually do for me please?
     
    Don Butler, Apr 8, 2004
    #7
  8. Friptzap

    Joe Burke Guest

    Regardless of intentions... we can't help you with reverse engineering copyrighted
    code. Catch 22.

    Joe Burke


    or not though that is why I would lie to get rid of it's usage.
     
    Joe Burke, Apr 8, 2004
    #8
  9. Friptzap

    Friptzap Guest

    I will see if I can contact him thanks :) I just want to know what it does. Is it just handling message input? If so I may not need it in its current capacity. I just want user input and a way to remember that input for next time.

    My sub question on this thread is regarding what is common code and what is copyright. How can you determine the difference between the two. Not all results come from the same type of code but some code is just common place to be done in a certain manner. If I am trying to, lets say on a simple basis, have part of my code draw a circle it will say a certain thing in the code and no matter who codes it, it will more than likely look the same. Or at the very least be one of a few different ways it can be done.

    Could you tell me how I might contact him ?
     
    Friptzap, Apr 9, 2004
    #9
  10. Friptzap

    Friptzap Guest

    hmm funny I responded but it did not go through.....

    anyway I am NOT asking for reverse engineering. And I only posted to make sure we were talking about the same thing. And I only posted because I saw this for myself in SEVERAL other posts in these forums.

    What I am asking is (and maybe this is a better word) what TASK do these two routines perform. I never asked for reverse engineering. I simply asked for someone to explain what these do. So I can remove them form use without disabling my code. Thus not infringing on anyones right when I have no idea if I am or not.

    Now if all you want to do is accuse then please read what I am asking wthout jumping to conclusions. If they do what I think they do then perhaps there is a much more simple way to do this. I think alot of the code I see looks way over done and I try to make my code as simple as possible. Not that I do much anyway. Less baggage is a good thing and that is all I am trying to do here rid myself some baggage. It is discussions like this that keep me away from here for years on end.
     
    Friptzap, Apr 9, 2004
    #10
  11. Friptzap

    Joe Burke Guest

    Friptzap,

    Take it easy. You're misreading what I said, or meant to say.

    In effect, you are asking for reverse engineering. How else could someone explain
    what tasks the functions perform, without studying the logic behind them? Thereby
    violating the copyright by exposing the intellectual property behind them.

    I'm not accusing you of anything. And I sympathize with your situation.

    Others here know much more about these issues than I do. Maybe they will chime in.

    Joe Burke

    were talking about the same thing. And I only posted because I saw this for myself in
    SEVERAL other posts in these forums.
    routines perform. I never asked for reverse engineering. I simply asked for someone
    to explain what these do. So I can remove them form use without disabling my code.
    Thus not infringing on anyones right when I have no idea if I am or not.
    jumping to conclusions. If they do what I think they do then perhaps there is a much
    more simple way to do this. I think alot of the code I see looks way over done and I
    try to make my code as simple as possible. Not that I do much anyway. Less baggage is
    a good thing and that is all I am trying to do here rid myself some baggage. It is
    discussions like this that keep me away from here for years on end.
     
    Joe Burke, Apr 9, 2004
    #11
  12. Friptzap

    Friptzap Guest

    ok then lets take it back to the basics of what I am looking for. Without getting into the code issue. I was hoping anyone that was in knowledge of these routines could enlighten me on what they where told they can do when they learned about them in whatever book / seminar etc they learned from. I am sure someone can explain what they learned in a book without infringing on said books copyright protection.

    I need a sig that reads:
    Sometimes knowledge is a good thing but some times too much of a good thing can be bad for you.
     
    Friptzap, Apr 9, 2004
    #12
  13. Friptzap

    CAB2k Guest

    Friptzap,

    this is the header i found attached to the routines, 8 functions.

    ============================================================

    ;These functions are freeware courtesy of the author's of "Inside AutoLisp"
    ;for rel. 10 published by New Riders Publications. This credit must
    ;accompany all copies of this function.

    ;* UANGLE User interface angle function
    ;* BIT (1 for no null, 0 for none) and KWD key word ("" for none) are same as
    ;* for INITGET. MSG is the prompt string, to which a default real in rads is
    ;* added as <DEF> (nil for none), and a : is added. BPT is base point (nil
    ;* for none).
    ;*

    =============================================================
    Here is some more info...


    ;;---MORE USER-FRIENDLY PROMPTING.
    ;; Bit can be set to:
    ;; 1 no null 2 no zero 4 no negative 8 no limits
    ;; 16 use 3d points 32 use rubberband 64 ignore z



    Here are some samples of use:
    (setq pSt (upoint 1 "" "Insertion point of slot" nil nil)
    rDia (udist 6 "" "Diameter" rDia pSt)
    rOl (udist 6 "" "Overall length of slot" rOl pSt)
    aRot (uangle 1 "" "Rotation angle" nil pSt)
    spt (upoint 1 "" "Select side" nil (cadr ent))
    iNum (uint 5 "" "How many times" iNum)
    ) ;_ end of setq


    These are subroutines to streamline the user input code so you don't have
    to repeat the some error checking over & over.
    The header in each routine gives you the over view of how it works.

    Are you asking for a line by line explanation of the code?
    I don't believe explaining the code is reverse engineering.
    Reverse engineering in my opinion is Writing code to simulate the function
    and form of an encrypted routine. Here we have the code in plain view.

    CAB
     
    CAB2k, Apr 9, 2004
    #13
  14. Friptzap

    Friptzap Guest

    That in and of itself is a big help. Line by line explanation would be great to help me understand, but there seems to be different thoughts on what effect that has :( . And overall explanation would be welcomed as well, which I can't see anyone disagreeing on at all, and seems you already gave me that too. And I think I agree with your description of reverse eng. But seems it is a touchy subject :)

    The headers themselves are a great help as the files I have do not have them attached and now I can reapply them. I will try and find this book as well seems it sounds like a good book to have.

    Thank you very much for helping :)
     
    Friptzap, Apr 9, 2004
    #14
  15. Friptzap

    CAB2k Guest

    This is the only one I have commented, but it should clear up some of your questions

    [pre];These functions are freeware courtesy of the author's of "Inside AutoLisp"
    ;for rel. 10 published by New Riders Publications. This credit must
    ;accompany all copies of this function.

    ;*
    ;* UPOINT User interface point function
    ;* BIT (1 for no null, 0 for none)
    ;* KWD key word ("" for none) are same as for INITGET.
    ;* MSG is the prompt string
    ;* DEF is the default point (X Y) or (X Y Z) or nil
    ;* BPT is base point
    ;* (nil for none)
    ;*
    (defun upoint (bit kwd msg def bpt / inp)
    (if def ;add default to prompt string
    ;;formats X,Y 2D pt as string
    (setq pts (strcat (rtos (car def)) "," ; X value to string
    (rtos (cadr def)) ; Y value to string
    ;; if a 3d default point was supplied and FLATLAND = 0
    ;; **FLATLAND is a discontinued system variable**
    (if ;formats 3D ,Z if supplied and FLATLAND off
    (and (caddr def) ; check for 3 value in point list
    (= 0 (getvar "FLATLAND"))); check flatland
    (strcat "," (rtos (caddr def))) ; Z value to string
    "" ; else add empty Z value to string
    ) ;_ end of if
    ) ;end strcat
    msg (strcat "\n" msg " <" pts ">: ") ;string them with default
    bit (* 2 (fix (/ bit 2))) ;a default and no null bit code conflict so
    ;; this reduces bit by 1 if odd, to allow null
    ) ;end setq
    ;; ELSE no default point
    (setq msg (strcat "\n" msg ": ")) ;format without default point
    ) ;endif a default was specified
    (initget bit kwd)
    (setq inp (if bpt ;check if base point was supplied
    (getpoint msg bpt) ;and use it to display rubber band
    (getpoint msg) ;no bpt
    ) ;_ end of if
    ) ;setq&if
    (if inp ;evaluate results and return proper value
    inp ; returns picked point
    def ; no point picked so return default
    ;; note def could be nil if def is nil so you nust deal with nil in your code
    )
    ) ;defun[/pre]
     
    CAB2k, Apr 10, 2004
    #15
  16. Friptzap

    Friptzap Guest

    Thanks that is a big help :)
     
    Friptzap, Apr 14, 2004
    #16
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.