entsel question

entsel question

vince.krueger
Advocate Advocate
906 Views
4 Replies
Message 1 of 5

entsel question

vince.krueger
Advocate
Advocate

I have a set of code that I am using to update the attributes of an entity after being inserted.  Generally it looks like the following:

 

(setq e (c:wd_insym2 "component" '(2.1 21) nil nil))

 

This works fine with 

 

(c:wd_modattrval e "attr" value" 1)

 

However when I insert a multipole component things do not work since none of the entity names are returned (e is nil in the following):

 

(setq e (c:ace_multipole "component" 3 '(2.1 21 0) 13))

 

I have not found a way to make entsel use a point selection programmatically, or get the entity name out of a ssget.

 

I am pretty sure this is doable, I am just drawing a blank.

 

Thanks,

Vince

0 Likes
Accepted solutions (1)
907 Views
4 Replies
Replies (4)
Message 2 of 5

ВeekeeCZ
Consultant
Consultant
Accepted solution

First... I have no expierence with ACAD Electrical.. so in general...

 

 

Don't you need to built a list of components?

 

e.g.

(c:ace_multipole (LIST "HDS11" "HDS21" "HDS21" "HDS21") 4 NIL NIL)

 

 

Some samples for you:

Spoiler
;en from ss
(setq ss (ssget))
(repeat (setq i (sslength ss))
  (setq en (ssname ss (setq i (1- i)))))


; en from ss - if ss is single selection set
(setq ss (ssget "_+.:E:S"))
(setq en (ssname ss 0))


; en from entsel
(setq ensl (entsel))
(setq en (car ensl))
(setq pt (cadr ensl))


; en from selection without the need for user input
(setq pt '(1 2 3))
(setq ensl (nentselp pt))
(setq en (car ensl))


; you have point and en, need to get pair (as return from (entsel)
(setq pt '(1 2 3))
(setq en (entlast)) ; e.g.
(setq ensl (list en pt))

 

Message 3 of 5

vince.krueger
Advocate
Advocate

Not in this case.  The following code adds a two pole circuit breaker.

 

(c:ace_multipole "HCB11TH" 2 '(10.25 18.5 0) 13)

 

I was just trying (nentselp pt) but extracting the correct entity name (sub list at the end of the list) is being problematic also.

 

I appreciate the samples, I will take a look at them.

 

Vince

0 Likes
Message 4 of 5

vince.krueger
Advocate
Advocate

The following is the winner for my needs (I would have prefered the nentselp but in the electrical entities the first entity name is not the right one)

 

; en from ss - if ss is single selection set
(setq ss (ssget "_+.:E:S"))
(setq en (ssname ss 0))

 Thanks for the assistance!

Message 5 of 5

vince.krueger
Advocate
Advocate

The following is the winner for my needs (I would have prefered the nentselp but in the electrical entities the first entity name is not the right one)

 

; en from ss - if ss is single selection set
(setq ss (ssget "_+.:E:S"))
(setq en (ssname ss 0))

 

Thanks for the assistance!

0 Likes