Jump to content
sanju2323

Text and text coordinate extract to csv along polyline.

Recommended Posts

BIGAL

Your dwg in no way reflects how you got those elevations. Is it some form of set out routine did you have some other vertical curve info ?

Share this post


Link to post
Share on other sites
Tharwat

Here is my approach .

 

(defun c:Test  (/ sel f o l)
 ;;    Tharwat 11.01.2014    ;;
 (princ "\n Select Single texts :")
 (if (and (setq sel (ssget '((0 . "TEXT"))))
          (setq f (getfiled "Save as to csv format "
                            (getvar 'DWGPREFIX)
                            "CSV"
                            1))
          (setq o (open f "w"))
          )
   (progn
     ((lambda (x / sn e)
        (while (setq sn (ssname sel (setq x (1+ x))))
          (setq l
                 (cons (list (cdr (assoc 10 (setq e (entget sn))))
                             (cdr (assoc 1 e)))
                       l))
          )
        )
       -1)
     (setq l
            (vl-sort l
                     '(lambda (q p) (< (cadr (car q)) (cadr (car p))))))
     (write-line "Code,EASTING,NORTHING,ELEVATION" o)
     (mapcar '(lambda (v)
                (write-line
                  (strcat (cadr v)
                          ","
                          (rtos (caar v) 2)
                          ","
                          (rtos (cadar v) 2)
                          ","
                          (rtos (caddar v) 2))
                  o))
             l)
     (close o)
     )
   )
 (princ)
 )

Share this post


Link to post
Share on other sites
sanju2323

Thank you sir, Made a very good job lisp code

Share this post


Link to post
Share on other sites
sanju2323

The text appears to be vertical, The text appears to be vertical, the Polyline along text find out the text should accordingly.

Sample2.dwg

Required.csv

Share this post


Link to post
Share on other sites
Tharwat

My program is to work on the first drawing that you have attached in the first post .

So to make the program works on cases like that , I think the program should consider the way that the polyline goes along and sort the texts accordingly .

Share this post


Link to post
Share on other sites
pBe

I knew i'd seen and replied to this request on another forum.

 

The code i posted there should work on "sample2.dwg" and any other polyline configuration., only thing is, i opted to use the "TEXT" value instead of the Z coordinates for numerical text, as you already know, 1.292 will be listed as "0.0" elevation on the CSV file if Z coordinate supersedes the numeric value.

 

So again, if the TEXT value is 1.292 and the Z coordinate is 0.0, what value should appear on the CSV list?

0.0 for me does not makes sense, unless your telling me 1.292 is the Base Elevation.

Share this post


Link to post
Share on other sites
sanju2323

sir, need right changes 1.292 text z (Elevation) value is 0.00 "p2csv.lsp"

Share this post


Link to post
Share on other sites
pBe

And change the TEXT string value that is "1.292" to "0.0" on the drawing? or will remain the same? or are you saying 0.00 at csv should read as 1.292 at the elevation column?

Share this post


Link to post
Share on other sites
sanju2323

text value as it is, in code column.

but keep change elevation value actual height. ex 1.292 to 0.000 actual Elevation.

Edited by sanju2323

Share this post


Link to post
Share on other sites
pBe
Yes sir, the actual value of the Elevation of the column

 

I'm sorry, its still not clear. Elevation "1.292" on the drawing would appear as 0.00 at the elevation column, using Z elevation coordinate of the TEXT entity as basis for the value? if that's the case, the text string value on the drawing will remain as "1.292" but listed as 0.00 on the CSV file? is that because 1.292 is the base elevation? and the rest should read as "+0.421" and/or "-0.203"? its odd because "TP00" is at 0.95 elevation?

 

Or you are wanting 1.292 as Elevation value on the csv file and not 0.00?

 

I just want to clear this up, in the long run, the user might inadvertently put the wrong "numerical string" value on the rest of the TEXT entity and end up with a mismatch on the CSV file.

Share this post


Link to post
Share on other sites
sanju2323

Please See Screen Shot

Screen Shot.jpg

Share this post


Link to post
Share on other sites
Tharwat
I knew i'd seen and replied to this request on another forum.

 

I would not have written any code about this thread if I saw your reply to the same thread in Autodesk forum .

Share this post


Link to post
Share on other sites
pBe
text value as it is, in code column.

but keep change elevation value actual height. ex 1.292 to 0.000 actual Elevation.

 

I understand about the "ELEVATION" column as 0.00on the CSV file

 

But change the string value to "0.00" on the drawing or "keep" it as it is as "1.292"? it's the only thing that is not clear to me.

 

I'm guessing change means chainage, that is where the disconnect is. "keep" / "change"

Share this post


Link to post
Share on other sites
pBe
I would not have written any code about this thread if I saw your reply to the same thread in Autodesk forum .

 

No worries Tharwat, the more the better for the OP :)

 

You have been very helpful to a lot of requests for custom routines, keep it up buddy.:thumbsup:

Share this post


Link to post
Share on other sites
sanju2323

Code value is ok nothing problem

Share this post


Link to post
Share on other sites
pBe

Alrighty then. I change the code a bit to prompt for a filename , [similar to tharwats] there are times the user forgets to close the excel csv file and that will cause another set of problems.

 

TEXT value will remain as it is on the drawing

 

p2csv2.LSP

Share this post


Link to post
Share on other sites
sanju2323

sorry, Forgive me for understanding

Thanks for Suggestion and replay

Share this post


Link to post
Share on other sites
pBe
sorry, Forgive me for understanding

Thanks for Suggestion and replay

 

no problem dude, try the code on the previous post and tell me how it goes,

Share this post


Link to post
Share on other sites
sanju2323

It works, Thank You

Share this post


Link to post
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
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

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