NENTSEL to SSGET

NENTSEL to SSGET

msarqui
Collaborator Collaborator
1,876 Views
10 Replies
Message 1 of 11

NENTSEL to SSGET

msarqui
Collaborator
Collaborator

Hi guys,

 

May I have some help please?

I am struggling with this problem. I am trying to adapt an existing routine that uses NENTSEL to work with StripMtexthttps://cadabyss.wordpress.com/2010/01/04/stripmtext-v5-0/

 

So this works:

(if (setq sel (ssget)) (StripMtext sel "C"))

But this not works because the NENTSEL in my existing routine does not put the selected objects to accept a PREVIOUS selection.

(setq nsel (nentsel))
(if (setq sel (ssget "_P")) (StripMtext sel "C"))

So, how to put the object selected by NENTSEL in a SSGET selection?

 

Thanks

Marcelo

0 Likes
Accepted solutions (1)
1,877 Views
10 Replies
Replies (10)
Message 2 of 11

Satoews
Advocate
Advocate

USE SSADD TO ADD TO SEL

 

SSADD

Shawn T
0 Likes
Message 3 of 11

Satoews
Advocate
Advocate
(setq nsel (nentsel))
(ssadd (cdr (entget (ssname nsel 1))) sel)
(StripMtext sel "C")

Try this, untested but I think I got this right, if not and someone dosen't get to it first, I will work it over tonight.

Shawn T
0 Likes
Message 4 of 11

msarqui
Collaborator
Collaborator

Hi Shawn, thanks for the repply.
I am having an error here 

(ssadd (cdr (entget (ssname nsel 1))) sel)


Error: bad argument type: lselsetp (<Entity name: 7ffff96da80> (228.467 194.123 0.0))

0 Likes
Message 5 of 11

Satoews
Advocate
Advocate
(setq nsel (nentsel))
(ssadd (ssname nsel 0) sel)

this worked for me, try it out.

Shawn T
0 Likes
Message 6 of 11

msarqui
Collaborator
Collaborator

Same error.

Atached the block I am using. Maybe it could help.

Thanks.

0 Likes
Message 7 of 11

hmsilva
Mentor
Mentor
Accepted solution

@msarqui wrote:

Hi guys,

 

May I have some help please?

I am struggling with this problem. I am trying to adapt an existing routine that uses NENTSEL to work with StripMtexthttps://cadabyss.wordpress.com/2010/01/04/stripmtext-v5-0/

 

So this works:

(if (setq sel (ssget)) (StripMtext sel "C"))

But this not works because the NENTSEL in my existing routine does not put the selected objects to accept a PREVIOUS selection.

(setq nsel (nentsel))
(if (setq sel (ssget "_P")) (StripMtext sel "C"))

So, how to put the object selected by NENTSEL in a SSGET selection?

 

Thanks

Marcelo


Hi Marcelo,

why 'nentsel'???

Edit: try this...

 

(if (and (setq nsel (nentsel "\nSelect an attribute: "))
         (= (length nsel) 2)
         (setq ent1 (entget (car nsel)))
         (= (cdr (assoc 0 ent1)) "ATTRIB")
         (setq hnd1 (cdr (assoc 330 ent1)))
    )
   (progn
      (setq ss (ssadd))
      (setq ss (ssadd hnd1 ss))
      (StripMtext ss "C")
   )
)

 

Hope this helps,
Henrique

EESignature

Message 8 of 11

msarqui
Collaborator
Collaborator

@hmsilva wrote:

Hi Marcelo,

why 'nentsel'???

 

Henrique


Hi Henrique, as I said, I am trying to adapt an old routine that uses NENTSEL...
If the answer exists and if it is simple, I think it will be far less work than rewrite the entire existing routine.

 

0 Likes
Message 9 of 11

Satoews
Advocate
Advocate
(setq nsel (nentsel))
(ssadd (car nsel) sel)

 

I think i fixed mine but hsilva knows way more than i do =P  

Shawn T
0 Likes
Message 10 of 11

msarqui
Collaborator
Collaborator

It is perfect!

Many thanks Henrique!

0 Likes
Message 11 of 11

hmsilva
Mentor
Mentor

@msarqui wrote:

It is perfect!

Many thanks Henrique!


You're welcome, Marcelo!
Glad I could help

Henrique

EESignature

0 Likes