- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Denunciar
@Anonymous wrote:
Does AutoCAD 2017 have a polygon counter? I need one for my current project.
A routine could easily be written to count all closed LWPolylines [which is what the POLYGON command draws], if that's enough of a determinant for you. It could be made more sophisticated, to check each one as to whether its segments are all the same length, and none of them arc segments, and its vertices all the same distance from its center of gravity, if you need to count only regular Polygons [also characteristic of what the Polygon command makes -- see below]. But a Polygon in mathematical terms doesn't have to be regular, so some more information about what you want to count would be helpful.
For something that checks some of those things, look at MakeMore.lsp with its MM command, here. One of its improvements over the ADDSELECTED command [that was added in later versions of AutoCAD than MakeMore was first written in] is that when you select a Polyline, it doesn't merely call up the PLINE command, but looks at certain characteristics of the selected one, and if it looks like it might have been the result of certain specific commands other than PLINE that draw Polylines, it offers such a command as a default. If it finds that the Polyline has a global width of zero, and no arc segments, and at least its first two and last two segments are the same length, it offers the Polygon command. But it doesn't check that they're all the same length, or that the vertices are all the same distance from a common center, or that the angles between them are all the same.
For a more sophisticated determinant of whether a Polyline is a regular polygon, try the attached IsRegPoly.lsp function, which could be incorporated into a routine to count them in a drawing, if those are what you're looking for.