Jump to content

Need Script For Polyline Coordinate, Area from Texts Inside Boundary


Recommended Posts

uzumaki narudin

need help from senior here, as my attachment file from cad to output excel table, i need to create report ( coordinate and area ) from all closed polyline has text as an ID

 

thanks in advance

AREA.dwg REPORT.xlsx

Link to post
Share on other sites
Kajanthan

This is help for you.

(vl-load-com)
(defun _pac (e / l v d lst)
	(setq d (- (setq v (/ (setq l (vlax-curve-getDistAtParam e (vlax-curve-getEndParam e))) 100.))))
	(while (< (setq d (+ d v)) l)
		(setq lst (cons (vlax-curve-getPointAtDist e d) lst))
	)
)


(defun c:dd (/ s i e p r n x lss t1 t2)
(setq p 0)
	(= 1 (getvar 'Dwgtitled))
	(setq	collectedData nil
			csvFile (strcat (getvar 'dwgprefix)	(vl-filename-base (getvar 'dwgname)) ".csv")
	)
(if (setq s (ssget "_:L" '((0 . "POLYLINE,LWPOLYLINE") (-4 . "<OR") (70 . 1) (70 . 3)(-4 . "OR>"))))
    (repeat
		(setq i (sslength s))
		(setq e (ssname s (setq i (1- i))))
		(setq r (getpropertyvalue e "area"))
		(setq t2 (strcat "AREA" "," (rtos r 2 1)))

		(foreach itm (setq ptlist (mapcar 'cdr  (vl-remove-if-not '(lambda	(x) (= (car x) 10)) (entget e))))
			(setq p (1+ p))
			(princ "\n") (princ (setq coor (strcat (rtos p 2 0) "," (rtos (car itm) 2 3) "," (rtos (car itm) 2 3))))
			(setq x (cons (list coor) x))
		)
		(foreach lk x (setq lss (cons lk lss)))
	

	
		(if (setq ss (ssget "_WP" (_pac e) (list '(0 . "TEXT,MTEXT") )))
			(repeat
				(setq n (sslength ss))
				(setq hnd (ssname ss (setq n (1- n))))
				(setq vobject (vlax-ename->vla-object hnd))
				(if (vlax-property-available-p vobject 'textstring); test if object has textstring property
					(setq vobjstring (vla-get-textstring vobject)) ; String value
					(princ "\nSelected object don't have \"TextString\" property... ")
				); if
				(setq t1 (strcat "ID" "," vobjstring))
			)
		)
	(setq lss (cons (list t2) lss))
	(setq lss (cons (list t1) lss))
	(setq p 0 x nil)
	);repeat
);if main

(setq opf (open csvFile "w"))
(foreach rowValue lss
	(write-line  (apply 'strcat rowValue) opf)
)
(setq lss nil)
(not (close opf))
(princ)
)

I am not a lisp expert ..

Pline area to csv.lsp

  • Like 1
Link to post
Share on other sites
uzumaki narudin

thanks mate, but it seem doesnt meet my need, cause i need to identified each closed polyline with text inside the boundary, cause i want to create report each boundary area and each boundary polyline

Link to post
Share on other sites
BIGAL

If this is a civil say road style design then using say CIV3D or Civil Site Design is the way to go. 

 

As a side note getting area of multiple plines is easy and end area volume can be calculated no need for excel.

Link to post
Share on other sites
uzumaki narudin

can you elaborate more please,

im using civil3D also, the report what i need should meet criteria report by our local goverment, so excel with chart that show list coordinate and calculation of end area should in excel format. in civil 3d i cannot show list coordinate and end area calculation, maybe im missing for that one.

CUT FILL.jpg

Link to post
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
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...