+ Reply to Thread
Results 1 to 4 of 4
  1. #1
    Full Member
    Using
    AutoCAD 2010
    Join Date
    Sep 2010
    Location
    UAE / India
    Posts
    55

    Default Cond.. code is not working

    Registered forum members do not see this ad.

    hi friends please help me to correct this code...

    ;;;;;;; if a is integer

    (defun C:test()
    (setq a 01)

    (cond
    ((= (type a) STR) (alert "\nIT IS STRING"))
    ((= (type a) int) (alert "\nIT IS INTEGER"))
    )
    (princ)
    )

    ;;;;;;;;;; if a is string

    (defun C:test()
    (setq a "PLOT-01")

    (cond
    ((= (type a) STR) (alert "\nIT IS STRING"))
    ((= (type a) int) (alert "\nIT IS INTEGER"))
    )
    (princ)
    )

  2. #2
    Forum Deity pBe's Avatar
    Computer Details
    pBe's Computer Details
    Operating System:
    Windows XP
    Discipline
    Construction
    pBe's Discipline Details
    Discipline
    Construction
    Details
    Camp Construction planning and details
    Using
    AutoCAD 2009
    Join Date
    Apr 2010
    Posts
    2,644

    Default

    Code:
     
    (cond
    ((= (type a) 'STR) (alert "\nIT IS STRING")) 
    ((= (type a) 'int) (alert "\nIT IS INTEGER")) 
    )
    Did you not read the other replies on your post a while back? --- > Convert Real to String

    BTW: ADD CODE TAGS ---> Code Posting Guidelines

  3. #3
    Full Member
    Using
    AutoCAD 2010
    Join Date
    Sep 2010
    Location
    UAE / India
    Posts
    55

    Default

    thank you so much pBe
    yes i read that .. actually I 'm trying to create a lisp and i need to add this condition but it was not working.. no its working perfectly.

    thanks and regards
    bijoy

  4. #4
    Forum Deity pBe's Avatar
    Computer Details
    pBe's Computer Details
    Operating System:
    Windows XP
    Discipline
    Construction
    pBe's Discipline Details
    Discipline
    Construction
    Details
    Camp Construction planning and details
    Using
    AutoCAD 2009
    Join Date
    Apr 2010
    Posts
    2,644

    Default

    Registered forum members do not see this ad.

    Quote Originally Posted by bijoyvm View Post
    thank you so much pBe
    yes i read that .. actually I 'm trying to create a lisp and i need to add this condition but it was not working.. no its working perfectly.

    thanks and regards
    bijoy
    Glad to be of service.

    BUT you still need to ADD CODE TAGS ---> Code Posting Guidelines <--- read this

Similar Threads

  1. COND statement and list
    By monk in forum AutoLISP, Visual LISP & DCL
    Replies: 6
    Last Post: 17th Apr 2012, 02:46 pm
  2. COND statement help
    By ssm-jt in forum AutoLISP, Visual LISP & DCL
    Replies: 6
    Last Post: 23rd Mar 2012, 03:38 pm
  3. help on cond and repeating command
    By Lt Dan's legs in forum AutoLISP, Visual LISP & DCL
    Replies: 27
    Last Post: 3rd Aug 2010, 08:13 pm
  4. Trying to use COND
    By woodman78 in forum AutoLISP, Visual LISP & DCL
    Replies: 18
    Last Post: 14th Jul 2009, 12:25 pm
  5. Cond Statement Problems
    By Lee Mac in forum AutoLISP, Visual LISP & DCL
    Replies: 10
    Last Post: 7th Jan 2009, 08:06 pm

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