cadex

cadex

Anonymous
Not applicable
893 Views
4 Replies
Message 1 of 5

cadex

Anonymous
Not applicable

Hello, everyone!

I am searching for a lisp for certain parameters to be exported to excel file from a .dwg/.dxf file. The perimeters of the entities selected that we need in excel file in a row of cells are

1)no of objects in the selected entities,

2)no of nodes in the entities

3)perimeter of the selected entities and

4) a statement of yes or no if the entities are closed polyline or open polyline.

I have been using tlen.lisp for perimeter,pedit command for closing polylines. I am not a novice in lisp creation so any help you can provide me would be highly appreciated!

Thanks in advance!

0 Likes
894 Views
4 Replies
Replies (4)
Message 2 of 5

Moshe-A
Mentor
Mentor

@Anonymous  hi,

 

something like this?

 

enjoy

moshe

 

(defun c:dpl (/ ss elist csv^ fname f)
 (if (setq ss (ssget '((0 . "lwpolyline"))))
  (progn 
   (foreach ename (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss)))
    (setq elist (entget ename))
    (setq csv^ (cons
		 (list
		   (vlax-curve-getdistatparam ename (vlax-curve-getendparam ename))
		   (cdr (assoc '90 elist))
		   (cdr (assoc '70 elist))
		 )
		 csv^
	       )
    ); setq
   ); foreach

   (setq fname (strcat (getvar "dwgprefix") (vl-filename-base (getvar "dwgname")) ".csv")) 
 
   (if (setq f (open fname "w"))
    (progn
     (write-line "length,nodes,close" f) ; header
     (foreach item (vl-sort csv^ '(lambda (a0 a1) (< (car a0) (car a1))))
      (write-line (strcat (rtos (car item) 2 2) "," (itoa (cadr item)) "," (if (= (caddr item) 1) "Yes" "No")) f)    
     ); foreach
     (setq f (close f))

     (prompt (strcat "\ncreating " fname " file."))
    ); progn
   ); if
  ); progn 
 ); if

 (princ) 
)
0 Likes
Message 3 of 5

Anonymous
Not applicable
Thank you,Moshe for the swift response.I am not getting.The Commandline
response after loading the dpl lisp was:
Specify entities»

Error: No function.
0 Likes
Message 4 of 5

Moshe-A
Mentor
Mentor

@Anonymous  hi,

 

after loading the lisp you need to key in DPL on the command line to make it run.

 

moshe

 

 

0 Likes
Message 5 of 5

Moshe-A
Mentor
Mentor

attached a minor update  😀

 

0 Likes