vlax-ename->vla-object (entlast)

vlax-ename->vla-object (entlast)

robert06
Collaborator Collaborator
1,654 Views
11 Replies
Message 1 of 12

vlax-ename->vla-object (entlast)

robert06
Collaborator
Collaborator

(setq D1 (/ (getdist) 2))
(setq O1 (entsel))
(setq S1 (getpoint))
(command "offset" "e" "n" D1 O1 S1 "")
(setq ob (entlast))

(setq obj (vlax-ename->vla-object (car ob)))

 

can't figure out, why entlast can't be turned to vla-object with this nor 

(setq obj (vlax-ename->vla-object (entlast)))

 

if to select again with entsel, works 

(setq obj (vlax-ename->vla-object (car (entsel)))

0 Likes
Accepted solutions (1)
1,655 Views
11 Replies
Replies (11)
Message 2 of 12

Sea-Haven
Mentor
Mentor

Works for me no idea why not for you. Do you have (vl-load-com) at start of code ?

 

offset etc
: (setq obj (vlax-ename->vla-object (entlast)))
#<VLA-OBJECT IAcadLine 0000000063D0F0E0>

 

0 Likes
Message 3 of 12

robert06
Collaborator
Collaborator

so the bug must be somewhere else, please see the whole lisp

 

(deleted in edit) 

0 Likes
Message 4 of 12

john.uhden
Mentor
Mentor

@robert06 

Is the object getting offset?

How about if O1 were (car (entsel))?

John F. Uhden

0 Likes
Message 5 of 12

robert06
Collaborator
Collaborator

O1 is object existing prior running the command.

telg is created from O1 by offset alright, this is the entlast object i can't select for further processing.

0 Likes
Message 6 of 12

paullimapa
Mentor
Mentor
Accepted solution

try this instead of car:

(setq obj (vlax-ename->vla-object ob))


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
Message 7 of 12

robert06
Collaborator
Collaborator

Thank you @paullimapa , this solved it.

0 Likes
Message 8 of 12

paullimapa
Mentor
Mentor

glad to have helped...cheers!!!


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 9 of 12

robert06
Collaborator
Collaborator

As I understand with car  the object name is extracted to handle (to rename etc), but without the object itself.

0 Likes
Message 10 of 12

paullimapa
Mentor
Mentor

all depends on the lisp function you use to grab the entity

(entsel) for example will return a list with 2 elements: <entity name> being the first & coordinates being the 2nd.

So in this case you'll need (car) to extract just the 1st element which is the <entity name> to pass on to vlax function:

(vlax-ename->vla-object <entity name>)

but if you use (entlast) function then you only get back the <entity name> and not a list so there's no need to use (car) function when passing on to vlax function:

(vlax-ename->vla-object <entity name>)

 


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
Message 11 of 12

robert06
Collaborator
Collaborator

Thank you @paullimapa 

0 Likes
Message 12 of 12

paullimapa
Mentor
Mentor

You are welcome...cheers!!!


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes