Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Auto LISP QUANTITATIVE MATERIALS

0 REPLIES 0
Reply
Message 1 of 1
projetosmoretti
674 Views, 0 Replies

Auto LISP QUANTITATIVE MATERIALS

In the architectural design, there are names of rooms inside polylines, which gives me the areas and lengths of the room. I needed that in the place of the area and the length appear names of the blocks and the amount separated by the same polylines in the image, Can you help me with this?

 

 

(defun c:GABARITO (/ strnum _outside-p text ss Pline Txtinside i e entdata spc)
(defun strnum (var val str / p)
(setq p str)
(repeat (- val (strlen var)) (setq p (strcat str p)))
(strcat var p)
)
(defun _outside-p (pt ent / YoRay len)
;;; pBeFeb20014 ;;;
;;; http://en.wikipedia.org/wiki/Point_in_polygon ;;;
;;; even-odd rule ;;;
(setq YoRay
(entmakex (list
'(0 . "RAY")
'(100 . "AcDbEntity")
'(100 . "AcDbRay")
(cons 10 pt)
'(11 1.0 0.0 0.0)
)
)
)
(setq len (/ (length (vlax-invoke
(vlax-ename->vla-object YoRay)
'intersectwith
ent
acextendnone
)
) 3)
)
(entdel YoRay)
(zerop (rem len 2))
)

(if (setq text nil
Pline nil
Txtinside nil
ss (ssget "_X"
(list '(-4 . "<OR")
'(-4 . "<AND")
'(0 . "LWPOLYLINE")
'(8 . "_GABARITO");<--- LAYER DA POLYLINE
'(-4 . "AND>")
'(-4 . "<AND")
'(0 . "TEXT")
'(8 . "_AMBIENTES");<-- LAYER DO NOME DO AMBIENTE
'(-4 . "AND>")
'(-4 . "OR>")
(cons 410 (getvar 'ctab))
)
)
)
(progn
(repeat (setq i (sslength ss))
(setq e (vlax-ename->vla-object (ssname ss (setq i (1- i)))))

(if (eq "AcDbText" (vla-get-ObjectName e))
(setq text (cons (list e (vlax-get e 'InsertionPoint)) text))
(setq Pline (cons e Pline))
)
)
(foreach itm text
(if (setq hit (vl-some '(lambda (pl)
(if (not (_outside-p (Cadr itm) pl))
(list (car itm) pl)
)
)
pline
)
)
(setq Txtinside (cons hit Txtinside)
)
)
)
(princ (strcat "\n" (strnum "Ambiente" 20 "-")(strnum "Perímetro" 20 "-") "Área"))
(foreach tx Txtinside
(princ (strcat "\n" (strnum (vla-get-textstring (Car tx)) 20 "-")
(strnum (rtos (vla-get-length (cadr tx)) 2 2) 20 "-")
(rtos (vla-get-area (cadr tx))2 2))
)
)
)
)(princ)
)

 

Capturar.JPG

0 REPLIES 0

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

AutoCAD Inside the Factory


Autodesk Design & Make Report