Jump to content

Recommended Posts

Posted

Hi

I want export information's of a pline by picking it , to an excel file like this :

dataxls.gif

suppose my pline has coordinates as :

10,10,10

20,20,20

30,10,5

40,30,14

Does anyone has , in this case any information's for me ?

dataxls.GIF

  • Replies 32
  • Created
  • Last Reply

Top Posters In This Topic

  • Lee Mac

    11

  • cadman2009

    8

  • fixo

    6

  • SteveK

    3

Top Posters In This Topic

Posted Images

Posted

Excel is possible, but CSV file is much much less coding... is this suitable also?

Posted
Excel is possible, but CSV file is much much less coding... is this suitable also?

yes , it is !

Posted

Try this:

 

;; Polyline Vertex Exporter  ~   by Lee McDonnell  ~  26.11.2009

(defun c:pExp (/ ss tmp i j ent tot dis pt)
 (vl-load-com)

 (if (and (setq ss   (ssget '((0 . "*POLYLINE"))))
          (setq tmp  (getfiled "Output File" (cond (*load) ("")) "txt;csv" 9)))
   (progn
     (setq *load tmp tmp (open tmp "a") i -1)
     (write-line "Point,X,Y,Z,Distance,Total" tmp)

     (while (setq ent (ssname ss (setq i (1+ i))))
       (setq tot 0. j (1- (vlax-curve-getStartParam ent)))

       (while (<= (setq j (1+ j)) (vlax-curve-getEndParam ent))
         (setq pt (mapcar 'rtos (vlax-curve-getPointatParam ent j)))          

         (write-line
           
           (strcat (rtos (1+ j) 2 0) (chr 44)
                   (car pt) (chr 44) (cadr pt) (chr 44) (caddr pt) (chr 44)
                   (rtos (setq dis (- (vlax-curve-getDistatParam ent j)
                                      (if (zerop j) 0 (vlax-curve-getDistatParam ent (1- j)))))) (chr 44)
                   (rtos (setq tot (+ dis tot))))
           tmp))

       (write-line "" tmp))
     
     (close tmp)))

 (princ))

Posted

Dear Lee

Hi

I check your codes ver 1.0 and 2.0 that you write for stevesfr , those export length of segments but I need coordinates of vertex and length information's together , If this is difficult , at least routine must give me length segment and elevation's of start and end point of them .

Posted
Try this:

 

;; Polyline Vertex Exporter  ~   by Lee McDonnell  ~  26.11.2009

(defun c:pExp (/ ss tmp i j ent tot dis pt)
 (vl-load-com)

 (if (and (setq ss   (ssget '((0 . "*POLYLINE"))))
          (setq tmp  (getfiled "Output File" (cond (*load) ("")) "txt;csv" 9)))
   (progn
     (setq *load tmp tmp (open tmp "a") i -1)
     (write-line "Point,X,Y,Z,Distance,Total" tmp)

     (while (setq ent (ssname ss (setq i (1+ i))))
       (setq tot 0. j (1- (vlax-curve-getStartParam ent)))

       (while (<= (setq j (1+ j)) (vlax-curve-getEndParam ent))
         (setq pt (mapcar 'rtos (vlax-curve-getPointatParam ent j)))          

         (write-line
           
           (strcat (rtos (1+ j) 2 0) (chr 44)
                   (car pt) (chr 44) (cadr pt) (chr 44) (caddr pt) (chr 44)
                   (rtos (setq dis (- (vlax-curve-getDistatParam ent j)
                                      (if (zerop j) 0 (vlax-curve-getDistatParam ent (1- j)))))) (chr 44)
                   (rtos (setq tot (+ dis tot))))
           tmp))

       (write-line "" tmp))
     
     (close tmp)))

 (princ))

Dear LEE

this one works completely accurate , special thanks for your cooperation

Posted
Dear LEE

this one works completely accurate , special thanks for your cooperation

 

You're welcome Cadman :)

Posted
Hi

I want export information's of a pline by picking it , to an excel file like this :

dataxls.gif

suppose my pline has coordinates as :

10,10,10

20,20,20

30,10,5

40,30,14

Does anyone has , in this case any information's for me ?

 

Here is another one too big but with flowers :)

 

~'J'~

PlineImport.LSP

Posted
Impressive Fixo - your knowledge of Excel interface is brilliant :)

 

Nop unfortunatelly

Just a counterpart of VBA :)

 

~'J'~

Posted
Impressive Fixo - your knowledge of Excel interface is brilliant :)

I second that. I know a bit of vba but how you bring that into lisp I don't get. Trial & error is too error prone.

 

That said, fixo, how does your lisp work? When I select a polyline (lw) nothing happens. Not only that but "Command:" disappears from my command line. :)

Posted
I second that. I know a bit of vba but how you bring that into lisp I don't get. Trial & error is too error prone.

 

That said, fixo, how does your lisp work? When I select a polyline (lw) nothing happens. Not only that but "Command:" disappears from my command line. :)

 

This will save pline data into the Excel file

in the same folder (just with .xls extension)

And also in the table are X, Y and Z values

so you need probably test it on 3dpoly

 

~'J'~

Posted

Oh really, now I have to remember where all those drawings are saved I tried it on hehe

 

And actually I'd really like to know how to get "Command:" back?

Posted

Fixo messes with the NOMUTT sys var. :wink:

 

{Fixo, better coding practice to store the old value instead of setting it to what you think it should be o:) }

Posted

Ta Lee, didn't that was it but it was...

"NOMUTT: Suppresses the message display (muttering) when it wouldn't normally be suppressed. Displaying messages is the normal mode, but message display is suppressed during scripts, AutoLISP routines, and so on."

Posted
Fixo messes with the NOMUTT sys var. :wink:

 

{Fixo, better coding practice to store the old value instead of setting it to what you think it should be o:) }

I agree with you, but I think nomutt is an exception.

Posted
I agree with you, but I think nomutt is an exception.

 

I agree that no-one would really set it to 1, but I have seen examples in the past where Fixo sets Sys Vars differently... o:)

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