PDA

View Full Version : No lines at points



devitg
31st Oct 2009, 03:15 pm
At this dwg , there are a lot of point where no LINES starts or ends.
I need to isolate it.
so I did this lisp


(defun trabajo ()
(setq puntos-ss (ssget "_X" '(( 0 . "point")))) ;_select all points

(setq puntos-ent (ss-->>ent-list puntos-ss));_ convert th SS in a Ent list
(NEW-LAY-CO "puntos AISLADOS" acred) ;_ a new layer where asile point will go
(setq punto (nth 0 puntos-ent)) ;_ to test
(foreach punto puntos-ent
(setq ins-pt (code 10 punto));_ the point insertion point
(if(not (ssget "_c" ins-pt ins-pt '( ( 0 . "LINE")))) ;_chek if
at that point there is no LINES
(progn
(setq pt-obj (en2ob punto)) ;_ change to OBJ
(vla-put-Layer pt-obj "puntos AISLADOS") ;_ put it at the aisledpoints layer
);_progn
);_ if

);_ foreach



);_ trabajo








;;************************************************ ************
(defun C:AIS-PT ()

(vl-load-com)
(setq acad* (vlax-get-acad-object)) ;_ el programa ACAD
(setq adoc (vla-get-activedocument acad*)) ;_ el DWG que esta abierto
(setq lay-coll (vla-get-layers adoc)) ;_ all layers)
(trabajo)

)


;;======++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++

(defun ss-->>ent-list (ss)
(vl-remove-if-not '(lambda(x)(= (type x) 'ENAME)) (mapcar 'cadr (ssnamex ss)))

)
;;************************************************ ************************************************** ******
(defun code ( cod ent )
(cdr (assoc cod (entget ent)))
)

;;*//*/*/*/*/*/*/*/*/*/*/*/*/**/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*
(defun NEW-LAY-CO (LAYER-NAME COLOR /
)
(if (tblsearch "LAYER" layer-name)
(progn
(setq LAY-NEW (vla-item LAY-COLL LAYER-NAME))
(if ( = (vla-get-freeze LAY-NEW ) :vlax-false)
(princ)
(vla-put-freeze LAY-NEW :vlax-false)
)
(vla-put-layeron LAY-NEW :vlax-true)
(vla-put-color LAY-NEW COLOR)
(vla-put-activelayer ADOC LAY-NEW)
(vla-item LAY-COLL LAYER-NAME)
) ;_ progn si existe , y la descongela y la prende
(progn
(setq LAY-NEW (vla-add LAY-COLL LAYER-NAME))
(vla-put-color LAY-NEW COLOR)
(vla-put-activelayer ADOC LAY-NEW)
(vla-item LAY-COLL LAYER-NAME)
) ;Progn si no existe
) ;_ controla si existe la capa
) ;_END NEW-LAY
;;*//*/*/*/*/*/*/*/*/*/*/*/*/**/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/
(defun en2ob (en);_ 01
(vlax-ename->vla-object en)
)
;;*//*/*/*/*/*/*/*/*/*/*/*/*/**/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*




But as it can be seen at the dwg , not all aisled point change to the
layers , and points where lines start or end , are changed

What I'm doing wrong?

Thanks in advance

gile
31st Oct 2009, 06:04 pm
Hola,

Prueba asì :


(if (not (ssget "_c" ins-pt ins-pt (list
'(0 . "LINE")
'(-4 . "<or")
'(-4 . "=,=,=")
(cons 10 ins-pt)
'(-4 . "=,=,=")
(cons 11 ins-pt)
'(-4 . "or>")
))) ;_chek if
(progn
(setq pt-obj (en2ob punto)) ;_ change to OBJ
(vla-put-Layer pt-obj "puntos AISLADOS") ;_ put it at the aisledpoints layer
) ;_progn
)

devitg
31st Oct 2009, 06:46 pm
Gile, Gracias , era eso .
Thanks it was it.
I have to learn to use the OR AND in SSGET.
Now it Work.

Now I need to get all lines on from a given xyz point , but at any Z

It do it well
The trick is != for not equal


(if (not (ssget "_c" ins-pt ins-pt (list
'(0 . "LINE")
'(-4 . "<or")
'(-4 . "=,=,!=")
(cons 10 ins-pt)
'(-4 . "=,=,!=")
(cons 11 ins-pt)
'(-4 . "or>")
))) ;_chek if
(progn
(setq pt-obj (en2ob punto)) ;_ change to OBJ
(vla-put-Layer pt-obj "puntos AISLADOS") ;_ put it at the aisledpoints layer
) ;_progn
)