Jump to content

HOw to extract data from read-line command


aleksa32

Recommended Posts

Hi,

 

I want to know how can I dequote so to say, a reading from a read-line command.

 

To be more specific, I have a TXT file with coordinates and heights, space delimited, and I would like to read the whole line (or parts of it) as not string.

 

expl:

...read-line -> "97451586.021 4869451.235 268.256"...

well I wan't to know how can I extract the data between the quotation marks

 

Thanks

Link to comment
Share on other sites

What are you going to do with the data once it is read?

Well I was just thinking about that.

 

For now lets just say, I want them in the drawing as points.

How would I go about that?

Link to comment
Share on other sites

You're welcome aleksa, glad it helps :thumbsup:

 

For space-delimited data, you can also use the following 'shortcut' to interpret the data:

(read (strcat "(" <your data> ")"))

Link to comment
Share on other sites

Also...

 

(setq str "123.123 456.456 789.789")
(setq Xcoord (substr str 1 (vl-string-position (ascii " ") str)))
(setq Ycoord (substr str (+ (vl-string-position (ascii " ") str) 2) (- (vl-string-position (ascii " ") str nil T) (vl-string-position (ascii " ") str))))
(setq Zcoord (substr str (+ (vl-string-position (ascii " ") str nil T) 2) (- (strlen str) (vl-string-position (ascii " ") str nil T) 1)))
(setq point (list (read Xcoord) (read Ycoord) (read Zcoord)))

Link to comment
Share on other sites

Nema na cemu, Aleksa... Inace ako imas zareze u stringu, samo promeni (ascii " ") u (ascii ",")... Inace zarez je cest delimiter kod CSV fajla (C-Comma Delimited) koji je cesto u upotrebi pri koriscenju transfera podataka ACAD EXCEL...

 

Puno pozdrava i nema na cemu, M.R.

Link to comment
Share on other sites

Hi

With this program you can get that, Mr. lee me if you can help me with an example.

Thank you

 

Hi mehrdad,

Are you unsure how to use my program?

What are you trying to do?

Link to comment
Share on other sites

Hi mehrdad,

Are you unsure how to use my program?

What are you trying to do?

 

Hi

I dont know what the program does and whether I'm at work using PDMS

Thank you

Link to comment
Share on other sites

Hi

I dont know what the program does and whether I'm at work using PDMS

Thank you

 

The program is designed to run on AutoCAD and other software that enables AutoLISP & Visual LISP functionality (such as Civil3D / MEP etc.), to my knowledge, PDMS doesn't permit the use of AutoLISP or Visual LISP.

 

As for what the program does, please read the description on my site.

 

Lee

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