Jump to content

Area Statement Under Layer "Acquired No. & Area" to the csv


sanju2323

Recommended Posts

Pretty easy just make a list of the text within the polygons then run the Bpoly command one of its properties is area write answer out. One problem all ready 18P its insert point is out side polygon, can be reworked though. Someone may have a lisp already.

Link to comment
Share on other sites

Bit long winded for what I think you want I will return if someone does not put up something 1st.

 

Almost there your turn ran out of time

(defun textarea ( / obj obj2 ss pt point1 Tarea Textval)
(setq obj (vlax-ename->vla-object (car (entsel "Pick text"))))
(setq layname (vla-get-layer obj))
(setq ss (ssget (list (cons 0 "Text")(cons 8 layname))))
(setq x -1)
(setq len (sslength ss))

(repeat len 
(setq tobj (vlax-ename->vla-object (ssname ss (setq x (+ x 1)))))
(setq pt (vla-get-Insertionpoint tobj))
(setq texval (vla-get-Textstring tobj))
(setq point1 (vlax-safearray->list (vlax-variant-value pt)))
(bpoly)(vl-cmdf point1 "")
(setq obj2 (vlax-ename->vla-object (entlast)))
(setq Tarea (vla-get-area obj2))
(vl-cmdf "erase" "last" "") ; remove bpoly
; write out answers now to csv
(princ (strcat "\nLabel " texval " Area " (rtos Tarea 2 0)))
)
)
(textarea)

Edited by BIGAL
Link to comment
Share on other sites

Thank you for the support, but this lisp code does not work very well. I have added a second copy for to understand better.

 

 

 

Bit long winded for what I think you want I will return if someone does not put up something 1st.

 

Almost there your turn ran out of time

(defun textarea ( / obj obj2 ss pt point1 Tarea Textval)
(setq obj (vlax-ename->vla-object (car (entsel "Pick text"))))
(setq layname (vla-get-layer obj))
(setq ss (ssget (list (cons 0 "Text")(cons 8 layname))))
(setq x -1)
(setq len (sslength ss))

(repeat len 
(setq tobj (vlax-ename->vla-object (ssname ss (setq x (+ x 1)))))
(setq pt (vla-get-Insertionpoint tobj))
(setq texval (vla-get-Textstring tobj))
(setq point1 (vlax-safearray->list (vlax-variant-value pt)))
(bpoly)(vl-cmdf point1 "")
(setq obj2 (vlax-ename->vla-object (entlast)))
(setq Tarea (vla-get-area obj2))
(vl-cmdf "erase" "last" "") ; remove bpoly
; write out answers now to csv
(princ (strcat "\nLabel " texval " Area " (rtos Tarea 2 0)))
)
)
(textarea)

Sample 2.dwg

Required Sheet.xls

Sample 2.lsp

Link to comment
Share on other sites

This is what I got

Label 87 Area 12205

Label 48 Area 5015

Label 65 Area 9518

Label 55 Area 15421

 

As I said not finished need to just do csv bit ie write to file, but it works ! Lot less code.

 

Making it write to excel automatically its your turn.

Link to comment
Share on other sites

Sir, It does not matter to me. If export in Microsoft Excel or CSV.

It is important required result.

This is what I got

Label 87 Area 12205

Label 48 Area 5015

Label 65 Area 9518

Label 55 Area 15421

 

As I said not finished need to just do csv bit ie write to file, but it works ! Lot less code.

 

Making it write to excel automatically its your turn.

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