Jump to content
muthu123

(read (strcat "(" "TUBE150X150X4.5 20.2" ")"))

Recommended Posts

muthu123

Please help in this issue.

 

(read (strcat "(" "TUBE150X150X4.5 20.2" ")"))

 

it returns a list

(TUBE150X150X4 20.2).

 

But I need a list

(TUBE150X150X4.5 20.2) including decimal point.

 

Yours,

Muthu.

Share this post


Link to post
Share on other sites
Tharwat

Hi.

 

Give this a try.

(read (strcat " " TUBE150X150X4.5 20.2 " "))

 

Regards,

Tharwat

Share this post


Link to post
Share on other sites
muthu123
Hi.

 

Give this a try.

(read (strcat " " TUBE150X150X4.5 20.2 " "))

 

Regards,

Tharwat

 

 

Not working.

Share this post


Link to post
Share on other sites
Tharwat

Here it goes very well.

load the file and type abc to start;

(defun c:abc (/ a b c d e f g tharwat pt)
(setq a "TUBE"
     b "150"
     c "X"
     d "150"
     e "X"
     f "4.5"
     g "20.2")
(setq tharwat (strcat "(" a b c d e f " " g ")"))
  (if (setq pt (getpoint "\nSpecify placement point: "))
   (entmake (list '(0 . "TEXT")
                  (cons 40 (getvar 'textsize))
                  (cons 10 (trans pt 1 0))
                  (cons 1 tharwat)
      ) ) )
 (princ)
)

The outcome is (TUBE150X150X4.5 20.2)

Enjoy.

Tharwat

Share this post


Link to post
Share on other sites
BIGAL

I think what you need is strcat chr(x) "TUBE150X150X4.5" "20.2" chr(y)

 

The correct value for x as an example 13 is Carriage return 32 is space you can basicly replace any keyboard character with a number value I wrote years ago an asc lisp that gave me the number as I pressed a key.

 

Big hints look for HELP asc & chr in lisp help

 

Sorry could not find asc.lsp also known as asci key codes.

Share this post


Link to post
Share on other sites
Tharwat
I think what you need is strcat chr(x) "TUBE150X150X4.5" "20.2" chr(y)

 

The correct value for x as an example 13 is Carriage return 32 is space you can basicly replace any keyboard character with a number value I wrote years ago an asc lisp that gave me the number as I pressed a key.

 

Big hints look for HELP asc & chr in lisp help

 

Sorry could not find asc.lsp also known as asci key codes.

 

Hi.

If you would give us an example, that would be much better.....

 

Tharwat

Share this post


Link to post
Share on other sites
Tharwat

Hello muthu123

Today is your lucky day man ... my ideas are burning up promptly today.

Check this out, it is as best as the previous one.

(defun c:abc (/ a pt)
(setq a "(TUBE150X150X4.5 20.2)")
  (if (setq pt (getpoint "\nSpecify placement point: "))
   (entmake (list '(0 . "TEXT")
                  (cons 40 (getvar 'textsize))
                  (cons 10 (trans pt 1 0))
                  (cons 1 a)
      ) ) )
 (princ "Cad Tutor Forum is the best")
(princ))

regards

Tharwar

Share this post


Link to post
Share on other sites
Tharwat

So finally.

 

The main problem is within the function 'read' because it doesn't except decimal

number or couldn't deal with it .

 

Hope that was helpful and enough .

 

Tharwat

Syria

Share this post


Link to post
Share on other sites
VVA
So finally.

 

The main problem is within the function 'read' because it doesn't except decimal

number or couldn't deal with it .

 

Hope that was helpful and enough .

 

Tharwat

Syria

so satisfied?

(read (strcat "(" [b][color="Red"]"\""[/color][/b] "TUBE150X150X4.5" [b][color="Red"]"\""[/color][/b] "20.2" ")"))

return ("TUBE150X150X4.5" 20.2)

Share this post


Link to post
Share on other sites
Tharwat
so satisfied?

(read (strcat "(" [b][color="Red"]"\""[/color][/b] "TUBE150X150X4.5" [b][color="Red"]"\""[/color][/b] "20.2" ")"))

return ("TUBE150X150X4.5" 20.2)

 

It is differ than the required. try it with brackets ...... :wink:

 

I would like to see it come true .

Share this post


Link to post
Share on other sites
Tharwat
so satisfied :D?

(read (strcat "(" [b][color="Red"]"\""[/color][/b] "TUBE150X150X4.5" [b][color="Red"]"\""[/color][/b] "20.2" ")"))

return ("TUBE150X150X4.5" 20.2)

 

These quotaion marks are should not be included.

so try it another way...

Share this post


Link to post
Share on other sites
BIGAL

Further to what I was suggesting this is from Autocad lisp help sometimes you need spaces and slashes but not as keyboard which stops code from running

 

Command: (chr 65) "A"

(chr 66) "B"

(chr 97) "a"

 

Likewise the opposite

Command: (ascii "A") 65

Command: (ascii "a") 97

Command: (ascii "BIG") 66

 

40=( 41=)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×