changing Elevation issue

changing Elevation issue

gwhitcherQ98HZ
Enthusiast Enthusiast
729 Views
4 Replies
Message 1 of 5

changing Elevation issue

gwhitcherQ98HZ
Enthusiast
Enthusiast

Whenever I use this in a function I get this error:

 

** Error: ActiveX Server returned the error: unknown name: Elevation **

 

What am i missing? Is there a better way to do this?

 

 

(vlax-map-collection (vla-get-modelspace doc)
'(lambda (object) (if
(and
(/= "AcDbBlockReference" (vla-get-objectname object))
(/= "AcDbMText" (vla-get-objectname object))
(/= "AcDbHatch" (vla-get-objectname object))
)
(progn
(vla-put-elevation object 0))
)))

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

paullimapa
Mentor
Mentor
Accepted solution

easy to find out why by doing the following:

place these 3 object types on your drawing:

Hatch

MText

Block

run this code on each:

(vlax-dump-object (vlax-ename->vla-object (car(entsel))))
If you don't see an Elevation property on the text screen dump, then this line in your code will fail with an error:
(vla-put-elevation object 0)

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

john.uhden
Mentor
Mentor
Accepted solution

@gwhitcherQ98HZ ,

I agree with @paullimapa .

IOW,

You can't change the property of an object if it doesn't have that property.

If you don't know for sure that an object has the target property, then you must "dump" it to find out, or be cautious ahead of time with...

(if (vlax-property-available-p object 'Elevation) ;; then go ahead and change it.

 

Of the three types of objects you wanted to modify, only the Hatch had an Elevation property.

John F. Uhden

0 Likes
Message 4 of 5

gwhitcherQ98HZ
Enthusiast
Enthusiast

I was able to get the z value and move the objects from that value to 0.

0 Likes
Message 5 of 5

paullimapa
Mentor
Mentor
0 Likes