- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Denunciar
How can I calculate the total length of all these lines as attached, by only one command?
Regarding solution, i put the dim linear command and manually calculate all the lines and add to calculate total length.
¡Resuelto! Ir a solución.
- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Denunciar
Here's one way
(defun c:somefunc ()
(apply '+ (vl-remove-if-not 'numberp
(mapcar '(lambda (x) (vl-catch-all-apply 'vla-get-length (list (vlax-ename->vla-object x))))
(vl-remove-if 'listp (mapcar 'cadr (ssnamex (ssget))))))))
- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Denunciar
@Ranjit_Singh2 puts the LISt Processing in AutoLISP!
Ranjit hats off to your never ending supply of Lamda's and Mapcars as well as the occasional apply function.
Your aversion to using Variables has made you a master of these functions.
- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Denunciar
There are a variety of routines out there to do that. For instance, several here. If you ever need to do it with a variety of entity types, you may find one of those better than @Ranjit_Singh2's suggestion, since it will work only on objects with a 'Length VLA Property, which not all entities have [for Circles, it's the 'Circumference Property, for Arcs, it's 'ArcLength, for Ellipses it isn't in VLA Properties at all].