WHY? ; error: bad argument type: lselsetp nil
(DEFUN me1( string default)
(PRINC string)
(PRINC "< ")
(PRINC default)
(PRINC " >:")
(PRINC "")
)
(DEFUN c:SA ( / exp g_ext g_int n_g_ext e_ext v_e_ext1 v_e_ext2
v_e_ext n_int s_int s_int1 e_int v_e_int total total1)
(setvar "cmdecho" 0)
(setvar "menuecho" 1)
(IF (= v_default nil)
(SETQ v_default 5)
(SETQ v_default v_intro)
)
(SETQ v_intro (GETINT (me1 "\nNumero de precision despues de Punto Recomendable 5:" v_default)))(TERPRI)
(IF (= v_intro nil)
(SETQ v_intro v_default)
)
(SETQ exp (expt 10 v_intro))
(SETQ g_ext (SSGET "X" '( (0 . "POLYLINE")
(8 . "GROS*")
)
)
g_int (SSGET "X" '( (0 . "POLYLINE")
(8 . "RM*")
)
)
n_g_ext (SSLENGTH g_ext)
)
(IF (/= n_g_ext 1)
(PROGN
(princ "\n\tExisten en el dibujo varias Areas Gros")
(PRINC)
)
)
(SETQ e_ext (SSNAME g_ext 0))
(command "_area" "o" e_ext )
(SETQ v_e_ext1 (GETVAR "area")
v_e_ext (* v_e_ext1 exp)
v_e_ext (fix v_e_ext)
n_int 0
s_int 0
)
(REPEAT (SSLENGTH g_int)
(SETQ e_int (SSNAME g_int n_int))
(command "_area" "o" e_int )
(SETQ v_e_int (GETVAR "area")
v_e_int (* v_e_int exp)
v_e_int (fix v_e_int)
s_int (+ s_int v_e_int )
n_int (+ n_int 1))
)
(SETQ g_ext nil)
(SETQ g_int nil)
(SETQ total (float (- v_e_ext s_int)))
(SETQ total1 (float (/ total exp)))
(TEXTPAGE)
(PROMPT "Area total: ")
(PRIN1 v_e_ext1)(TERPRI)
(PROMPT "Resultante total Extena: ")
(PRIN1 v_e_ext)(TERPRI)
(PROMPT "Resultantes totales Internas: ")
(PRIN1 s_int)(TERPRI)
(PROMPT "Area faltante en Metros ")
(PRIN1 total1)(TERPRI)
(PROMPT "Si es - Sobran Areas, Si es + Faltan Areas")
(PRINC)
(setvar "cmdecho" 1)
(setvar "menuecho" 0)
)
(PRINC
"\n\tSe cargo la rutina de Suma de areas ")
(PRINC
"\n\tInicia con SA ")
Solved! Go to Solution.
Solved by Kent1Cooper. Go to Solution.
if im not mistaken I don't think ssget will work with polyline sub entities which is why are you getting a nil error, but you should wait for more experienced posters to weigh in.
That means something is looking for a selection set to work with, and what it's getting is nil. That would happen if there were no Polylines on either or both groups of the GROS* or RM* Layers. The g_ext and/or g_int variable(s) will be nil, so some (sslength) or (ssname) function will not find a selection set.
I wonder whether what you are working with are really Lightweight Polylines. The "POLYLINE" entity type in entity data is used for "heavy" 2D Polylines and 3D Polylines. Try:
(0 . "LWPOLYLINE")
in place of
(0 . "POLYLINE")
in your (ssget) functions.
@Anonymous wrote:Thank you Kent1Cooper . I really help me
You're welcome -- you'll get used to the need to distinguish heavy from lightweight Polylines. I have often wondered why they set it up so that the PLINE command does not create something whose entity-type name is (0 . "POLYLINE") by default, but only when you consciously change the PLINETYPE System Variable to 0 before you make one, or convert a lightweight one to make it "heavy." If it were up to me, I would have called lightweight Polylines (0 . "POLYLINE") and given the entity-type names (0 . "2DPOLYLINE") and (0 . "3DPOLYLINE") to the other types. That would coordinate better with their ObjectName VLA Properties, and the second 100-code entry in their entity data. And I would have introduced a 2DPOLY command. I'm sure it's an issue of compatibility with older versions of AutoCAD before there were lightweight Polylines.
@Kent1Cooper, this is a decade old post but your suggestion helped me out.
for error: bad argument type: lselsetp nil I reviewed the ssget variables and found the issue in my code.
Hoping this helps others in the future as well.
Can't find what you're looking for? Ask the community or share your knowledge.