Jump to content

Recommended Posts

Posted
Yes, and what is your question?

dear sir

sorry for my bad english

my question is

1) after selete pline create autocad table and

area of pline put in table & center of pline. see my jpg file

2) area in tbale by layer vise (area-1, area-2 etc...)

see example of pline to excle file

(defun c:pline-area ( / *error* data-lst sorted-lst str-lst top-str polys

data cnt obj file-nm tmp item tmp-str fl)

(defun *error* (msg)

(if(= msg "quit / exit abort")

(princ "\nNo output file was selected")

(princ msg)

)

)

 

(setq top-str ""

file-nm (getfiled "Output File" "" "csv" 1)

)

(if(null file-nm)(exit))

(if(setq polys(ssget '((0 . "*POLYLINE"))))

(repeat(setq cnt(sslength polys))

(setq obj (vlax-ename->vla-object

(ssname polys

(setq cnt(1- cnt))

)

)

data-lst (cons

(list(vlax-get obj 'Layer)

(vlax-get obj 'Area)

)

data-lst

)

)

)

)

(while data-lst

(setq data (car data-lst)

data-lst (cdr data-lst)

tmp (list data)

)

(foreach item data-lst

(if(=(car item)(car data))

(setq tmp (cons item tmp)

data-lst (vl-remove item data-lst)

)

)

)

(setq sorted-lst(cons tmp sorted-lst))

)

(setq sorted-lst

(vl-sort sorted-lst '(lambda(a b)(

)

(foreach item (reverse sorted-lst)

(setq top-str

(strcat(caar item)"," top-str)

)

)

(setq str-lst (cons top-str str-lst)

cnt 0

)

(repeat(apply 'max(mapcar 'length sorted-lst))

(setq tmp-str "")

(foreach item (reverse sorted-lst)

(setq tmp-str

(if(setq tmp(nth cnt item))

(strcat(rtos(cadr tmp)) "," tmp-str)

(strcat "," tmp-str)

)

)

)

(setq cnt (1+ cnt)

str-lst (cons tmp-str str-lst)

)

)

(if(setq fl(open file-nm "w"))

(progn

(foreach str (reverse str-lst)

(write-line str fl)

)

(close fl)

(alert(strcat file-nm " was created"))

)

(alert "Unable to create file")

)

(princ)

)

Posted
Yes, and what is your question?

 

dear sir

just like u r

Line Length Calculator

add opation selction

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