Lisp for Layer Name, Description start and end coordinates

Lisp for Layer Name, Description start and end coordinates

nislam04
Participant Participant
525 Views
6 Replies
Message 1 of 7

Lisp for Layer Name, Description start and end coordinates

nislam04
Participant
Participant

Hi,

I am badly in need of a Lisp for Layer Name, Description start and end coordinates listed on a txt file.

 

Like: Name, Description, x1, y1, z1, x2, y2, z2

 

Any one can help sending me a link for that please?

 

Thank you

 

 

0 Likes
526 Views
6 Replies
Replies (6)
Message 2 of 7

paullimapa
Mentor
Mentor

Layers do not have start & end coordinates...please clarify.


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
Message 3 of 7

Sea-Haven
Mentor
Mentor

Do you mean line work ?

Message 4 of 7

nislam04
Participant
Participant

Hi,

Thank you for your response.

In fact I want to make a list like this from the lines/polylines of a drawings:

 

//Time:

//File Location:

//Number of lines on the drawing:

 

Name,        Description,       x1,        y1,      z1,                x2,     y2,     z2

W8X10,      w,BEAM,B,3,       441.87,677.87,0.00,     517.80,677.87,0.00

 

Thank you very much

0 Likes
Message 5 of 7

Sea-Haven
Mentor
Mentor

Ok we now know lines and plines, the latter I take 2 points only.

 

So next question what do we do with all the answers we get ?

 

Copy this to command line it will tell you how many objects found.

 

(sslength (ssget "X" '((0 . "*line"))))

 

 

0 Likes
Message 6 of 7

Moshe-A
Mentor
Mentor

@nislam04 ,

 

did you look at DATAEXTRACTION command?

 

Moshe

 

0 Likes
Message 7 of 7

calderg1000
Mentor
Mentor

Regards @nislam04 

Try this code

Export the information of selected lines and polylines to a *txt file.

(defun c:ldat (/ fname fn s i sn la sp ep ln lp lpx)
  (if (setq s (ssget '((0 . "*line"))))
    (progn
      (setq fname (getfiled "Save Text File As:" "" "txt" 1))
      (setq fn (open fname "w"))
      (repeat (setq i (sslength s))
        (setq
          sn  (vlax-ename->vla-object (ssname s (setq i (1- i))))
          la  (vlax-get sn 'layer)
          ln  (vlax-get (vlax-ename->vla-object (tblobjname "LAYER" la))
                        'Description
              )
          sp  (vlax-curve-getstartpoint sn)
          ep  (vlax-curve-getendpoint sn)
          lpx
              (strcat
                la
                ", "
                ln
                ", "
                (apply 'strcat (mapcar '(lambda (x) (strcat (rtos x) ",")) sp))
                " "
                (apply 'strcat (mapcar '(lambda (x) (strcat (rtos x) ",")) ep))
              )
        )
        (write-line lpx fn)
      )
    )
    (close fn)
  )
  (princ)
)

 

 


Carlos Calderon G
EESignature
>Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

0 Likes