Jump to content

Text and text coordinate extract to csv along polyline.


sanju2323

Recommended Posts

  • Replies 24
  • Created
  • Last Reply

Top Posters In This Topic

  • sanju2323

    9

  • pBe

    8

  • BIGAL

    3

  • Tharwat

    3

Top Posters In This Topic

Posted Images

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

Link to comment
Share on other sites

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 .

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 .

Link to comment
Share on other sites

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"

Link to comment
Share on other sites

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:

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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,

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