Jump to content

Text along polyline export length, distance, coordinate.


Recommended Posts

Posted

Hay, please any thing give lisp or please other separatlly lisp available fine.

Posted

Hi ,

 

Here is a draft codes for this process , so test this routine and let me know if you need any modification or so.

 

(defun c:test (/ f o s e lst p1 pt ang v l p _mt _t _parse)
 ;; Tharwat 16.08.2015		;;
 (if (and (setq f (getfiled "Select Excel file :"
                            (getvar 'dwgprefix)
                            "csv"
                            16
                            )
                )
          (setq o (open f "r"))
          (princ "\nSelect LWpolyline :")
          (setq s (ssget "_+.:S:E" '((0 . "LWPOLYLINE"))))
          )
   (progn
     (defun _mt (pt str)
       (entmakex (list '(0 . "MTEXT")
                       '(100 . "AcDbEntity")
                       '(100 . "AcDbMText")
                       '(40 . 0.6)
                       '(8 . "point")
                       (cons 10 pt)
                       (cons 1 str)
                       (cons 7
                             (if (tblsearch "STYLE" "STANDARD")
                               "STANDARD"
                               (getvar 'textstyle)
                               )
                             )
                       )
                 )
       )
     (defun _t (pt str)
       (entmakex (list '(0 . "TEXT")
                       '(8 . "Structure")
                       (cons 10 pt)
                       (cons 11 pt)
                       (cons 1 str)
                       (cons 7
                             (if (tblsearch "STYLE" "ARIAL-N")
                               "ARIAL-N"
                               (getvar 'textstyle)
                               )
                             )
                       '(8 . "Structure")
                       '(40 . 2.0)
                       '(50 . 0.0)
                       ;; '(71 . 0)
                       ;; '(72 . 1)
                       ;; '(73 . 2)
                       )
                 )
       )
     (defun _parse (string delimiter / pos lst)
       (while (setq pos (vl-string-search delimiter string 0))
         (progn (setq lst (cons (substr string 1 pos) lst))
                (setq string (substr string (+ pos 2) (strlen string)))
                )
         )
       (if (and string (/= string ""))
         (setq lst (cons string lst))
         )
       (setq lst (reverse lst))
       )
     (setq e (ssname s 0)
           l (vlax-curve-getdistatpoint e (vlax-curve-getendpoint e))
           p (vlax-curve-getstartpoint e)
           )
     (read-line o)
     (while (setq v (read-line o))
       (setq lst (_parse v ","))
       (if (< (read (nth 5 lst)) l)
         (progn
           (setq pt  (vlax-curve-getpointatdist e (read (nth 5 lst)))
                 ang (angle '(0. 0. 0.)
                            (vlax-curve-getfirstderiv
                              e
                              (vlax-curve-getparamatpoint e pt)
                              )
                            )
                 p1  (polar pt
                            ((eval (if (eq (last lst) "Right")
                                     '+
                                     '-
                                     )
                                   )
                              ang
                              (* pi 1.5)
                              )
                            (read (nth 4 lst))
                            )
                 )
           (entmake (list '(0 . "LINE")
                          (cons 10 pt)
                          (cons 11 p1)
                          (cons 8 "perp")
                          )
                    )
           (entmake (list '(0 . "POINT")
                          (cons 10 p1)
                          '(62 . 256)
                          (assoc 8 (entget e))
                          )
                    )
           (_mt (list (car p1) (cadr p1) (read (nth 3 lst)))
                (nth 4 lst)
                )
           (_t p1 (car lst))
           )
         )
       )
     (close o)
     )
   )
 (princ)
 )(vl-load-com)

Posted

Tharwat,

Thank you very much to the reply, but i want autocad to csv report.

Posted
  sanju2323 said:
Tharwat,

Thank you very much to the reply, but i want autocad to csv report.

 

I make it on the contrary ? :lol:

Your first post wasn't clear enough to tell that you want it to excel and not from excel to cad. !

Posted (edited)

sorry for confusion, Yes, I want the opposite (answer) lisp. 600km DWG file data already plotted. So I needed to export data as per my attachment csv requirement.

Edited by sanju2323

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