Jump to content

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


muthu123

Recommended Posts

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.

Link to comment
Share on other sites

Hi.

 

Give this a try.

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

 

Regards,

Tharwat

 

 

Not working.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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)

Link to comment
Share on other sites

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 .

Link to comment
Share on other sites

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...

Link to comment
Share on other sites

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=)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...