get-points-polig

editado em 01/12/2006: Lwpolylines usam o dxf 10 em OCS, é preciso converter para WCS
Esta subrotina me ajuda em muitas das minhas rotinas, ela serve para coletar as coordenadas das linhas... sei que dá pra usar as subrotinas do express, mas nem todo mundo usa, por isso prefiro programar as minhas próprias...
(defun get-points-polig  (ent / x tp tmp elev)
(
setq ent (ename-of ent)
tp (dxf 0 ent))
(
cond ((wcmatch tp "LINE,SPLINE,MLINE")
(
vl-remove nil
(mapcar '(lambda (x)
(
if (member (car x) '(10 11))
(
cdr x)))
(
entget ent))))
((
= tp "LWPOLYLINE")
(
setq elev (list (dxf 38 ent)))
(
vl-remove nil
(mapcar '(lambda (x)
(
if (= (car x) 10)
;o dxf 10 aqui é OCS, converte para WCS:
(trans (append (cdr x) elev) ent 0)))
(
entget ent))))
((
= "POLYLINE" tp)
(
while (/= "SEQEND" (dxf 0 (setq ent (entnext ent))))
(
setq tmp (append tmp (list (dxf 10 ent))))))
((
= "VIEWPORT")
(
if (dxf 0 (dxf 340 ent))
(
get-points-polig (dxf 340 ent))
(
list (car (setq tmp (get-bounding-box ent)))
(
list (caadr tmp) (cadar tmp))
(
cadr tmp)
(
list (caar tmp) (cadadr tmp)))))))

Link(s) da(s) subrotina(s) usada(s):
get-points-polig, ename-of, dxf, get-points-polig, get-bounding-box

LinkWithin

Related Posts Plugin for WordPress, Blogger...