+ Reply to Thread
Results 1 to 8 of 8
  1. #1
    Junior Member
    Using
    not specified
    Join Date
    Aug 2004
    Location
    Cork, Ireland
    Posts
    15

    Default strcat help sought

    Registered forum members do not see this ad.

    Lisp question

    (setq ope(getreal "\nenter the actual ope size..."))
    (setq wname (strcat ope "w"))
    (command "-insert" wname p2 "" "" p3 "") ; inserts a standard block.


    What I basically want to do is create a new variable that will be whatever number I enter for the variable “ope” to be joined with the letter “w”

    So "!name" will return to me at the prompt line of 900w (if I was to enter 900 at the prompt line when asked)

    Am I barking up the wrong tree?

    thanks in advance

    Diarmuid
    Jesus Saves,

    Ronaldo scores on the rebound

  2. #2
    Forum Deity
    Using
    not specified
    Join Date
    Jul 2004
    Location
    Anchorage, Alaska
    Posts
    2,074

    Default

    Barking up right tree just got to keep from mixing fruits and nuts.

    'ope' is a real number. 'Strcat' works on only strings. So using'ope' in 'strcat' function you need to convert it to a string using 'rtos'.

    If 'ope' can only be an interger you should use 'getint' rather than 'getreal'. Convert an integer to string using 'itoa'.

  3. #3
    Full Member
    Using
    not specified
    Join Date
    Aug 2006
    Posts
    31

    Default

    Yes. Strcat can deal only in strings, so you shoulkd convert the real / int in to string by using
    for Int - Itoa (integer to ascii)
    or for real it is RTOS - real to string
    eg;
    Code:
    (setq ope (getreal "sdjsd")
            combine_Ope (strcat (rtos ope) "W")
    )
    India CAD, The CAD people
    http://indiacad.11.forumer.com/

  4. #4
    Junior Member
    Using
    not specified
    Join Date
    Aug 2004
    Location
    Cork, Ireland
    Posts
    15

    Default

    thanks guys.

    slowly but surely i'm getting the hang of lisp. my routines are getting more elobrate each time, i'm still a looooong way of yet, but i'm getting there.

    Ta.

    Diarmuid
    Jesus Saves,

    Ronaldo scores on the rebound

  5. #5
    Senior Member
    Computer Details
    OMEGA-ThundeR's Computer Details
    Operating System:
    Windows 10
    Computer:
    HP Z440
    Discipline
    Civil
    OMEGA-ThundeR's Discipline Details
    Occupation
    Civil Engineer (CAD Design)
    Discipline
    Civil
    Using
    AutoCAD 2017
    Join Date
    Oct 2008
    Location
    Netherlands
    Posts
    305

    Default

    i would like to ask how the RTOS part can make an integer a whole number.

    Code:
    (if (null NUMBER) (setq NUMBER 6))
    (setq NUMBER(getint (strcat "\nHow many ?<" (rtos NUMBER) ">: ")))
    The output would be "How many? <6.000>:"

    But i would want it to be "How many? <6>:".

    Any indication on how the '.000' part can be removed?


    p.s. This is just a learing case for me, i know (or at least in my code at the moment) the number 6 would not be saved if i just press enter after the question)

  6. #6
    Super Member
    Using
    not applicable
    Join Date
    Jun 2016
    Posts
    589

    Default

    Use itoa instead. Or (rtos number 2 0).
    BricsCAD 16

  7. #7
    Luminous Being
    Using
    Civil 3D 2016
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    9,901

    Default

    To quote the lisp bible (Autocad release 12 paper copy)

    (rtos number [mode [precision]])
    mode
    1 Scientific
    2 Decimal
    3 Engineeering Feet & dec inches
    4 Architectural Feet & inches
    5 Fractional
    A man who never made mistakes never made anything

  8. #8
    Senior Member
    Computer Details
    OMEGA-ThundeR's Computer Details
    Operating System:
    Windows 10
    Computer:
    HP Z440
    Discipline
    Civil
    OMEGA-ThundeR's Discipline Details
    Occupation
    Civil Engineer (CAD Design)
    Discipline
    Civil
    Using
    AutoCAD 2017
    Join Date
    Oct 2008
    Location
    Netherlands
    Posts
    305

    Default

    Registered forum members do not see this ad.

    Thanks guys!

Bookmarks

Posting Permissions

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