Entget on objects

Entget on objects

gwhitcherQ98HZ
Enthusiast Enthusiast
675 Views
3 Replies
Message 1 of 4

Entget on objects

gwhitcherQ98HZ
Enthusiast
Enthusiast

I am using this code and I want to entget each object. I keep getting the error for lines. and will not proceed afetr this error
** Error: bad argument type: lentityp #<VLA-OBJECT IAcadLine 000001d4e8d0e388> **

 

Any help would be appreciated

 

here is the code:

 

(vlax-map-collection (vla-get-modelspace doc)
 
    '(lambda (object) 
 
                     (cond ((= "AcDbBlockReference" (vla-get-objectname object))) (princ)) 
                     (cond ((= "AcDbMText" (vla-get-objectname object)) (princ)))
     (cond ((= "AcDbHatch" (vla-get-objectname object)) (princ)))
                     (cond ((= "AcDbLine" (vla-get-objectname object)) 
(progn
    (setq entg (entget (vlax-Ename->Vla-Object object)))
    (setq start (cdr (assoc 10 entg))) 
    (setq end (list (nth 0 start) (nth 1 start) 0 ))
    (vla-move object (vlax-3d-point start)(vlax-3d-point end))
)
       ))
   
     (cond ((= "AcDbPolyline" (vla-get-objectname object)) 
   (progn
    (setq entg (entget (vlax-Ename->Vla-Object object)))
    (setq start (cdr (assoc 10 entg))) 
    (setq end (list (nth 0 start) (nth 1 start) 0 ))
    (vla-move object (vlax-3d-point start)(vlax-3d-point end))
)
       ))
       )
  )

 

0 Likes
Accepted solutions (1)
676 Views
3 Replies
Replies (3)
Message 2 of 4

paullimapa
Mentor
Mentor
Accepted solution

you start off with:

(vlax-map-collection (vla-get-modelspace doc)

which creates a set of vl objects

 

but this line of code converts entities to objects:

(vlax-Ename->Vla-Object object)

 

so instead use this line of code to convert vl objects to entities:

(vlax-vla-object->ename object)

 


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

gwhitcherQ98HZ
Enthusiast
Enthusiast

Thank you so much!

0 Likes
Message 4 of 4

paullimapa
Mentor
Mentor

Glad to have helped…cheers!!!


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