Invoke GetXdata method on a Label

Invoke GetXdata method on a Label

tcorey
Mentor Mentor
973 Views
5 Replies
Message 1 of 6

Invoke GetXdata method on a Label

tcorey
Mentor
Mentor

 

I am trying to see what is in the Xdata of a label object:

 

(setq labl (car (entsel "\nSelect label: "))
vlabl (vlax-ename->vla-object labl)
)

 

GetXData is a method of the selected object I am calling vlabl.

 

I can't figure out exactly how to get this to work. The method list says GetXdata(3). 

 

When I try 

 

(setq xdater (vlax-invoke-method vlabl 'getxdata x y z))

 

I get an error: error: ActiveX Server returned an error: Parameter not optional

 

If I try

 

(setq xdater (vlax-invoke-method vlabl 'getxdata 5 5 5))   ;shouldn't this retrieve the values of the array as double double                                                                                     double?

 

I get nil. No error, just nil. Does this mean there are no values in the array or am I missing a step that lets me read the array?

 

I was able to convert from variant to safearray for another routine I wrote yesterday, but that variant came from a get-property, not a method. As you can tell, I have hit a wall.

 

Any help will be greatly appreciated.

 

Tim

 



Tim Corey
MicroCAD Training and Consulting, Inc.
Redding, CA
Autodesk Platinum Reseller

New knowledge is the most valuable commodity on earth. -- Kurt Vonnegut
0 Likes
Accepted solutions (1)
974 Views
5 Replies
Replies (5)
Message 2 of 6

Jeff_M
Consultant
Consultant

What makes you think the label has XData, Tim?

 

For determining what is needed in the Activex methods, look at the ACtiveX help (last one to be included in the Acad help was 2011) acadauto.chm. There you will see this: 

 

object.GetXData AppName, XDataType, XDataValue 

 

Then furtherdown it says that AppName is an input value, and the other 2 are output values. So in lisp that would be:

 

(vlax-invoke-method obj "MyAppName" 'datatype 'datavalue)

 

When run, the datatype and datavalue variables will hold the dxfcode/value pair that you are looking for. Make sense?

Jeff_M, also a frequent Swamper
EESignature
0 Likes
Message 3 of 6

tcorey
Mentor
Mentor

Yeah, that makes sense, but this object type (LineBetweenTwoPointsLabel) has a method specifically for GetXData. Shouldn't I use that method instead of Vlax-getxdata? What about the fact that the method says GetXData(3). Does that mean I need the regapp, datatype and datavalue or might this mean there is point data in there? Other methods for this object type show (2) or () after the method name. Don't you need to treat each type differently?

 

Nothing makes me think there is xdata, I just want to try to see if there is.

 

What sent me down this rabbit hole is I'm trying to see if there is a way to update the two points that are used by a LineBetweenTwoPoints label type. As it sits, if you grip edit the label and change the points, the original elevations of those points remain, even if you pick a different 3d point.

 

Thanks, Jeff.

 

Tim

 



Tim Corey
MicroCAD Training and Consulting, Inc.
Redding, CA
Autodesk Platinum Reseller

New knowledge is the most valuable commodity on earth. -- Kurt Vonnegut
0 Likes
Message 4 of 6

Jeff_M
Consultant
Consultant

GetXdata is a generic method for all Entity types. Just because the method exists doesn't mean the object has any of that data. 

 

Just got home from a night of pool, will investigate that label in the morning.

 

Jeff_M, also a frequent Swamper
EESignature
0 Likes
Message 5 of 6

Jeff_M
Consultant
Consultant
Accepted solution

Well, it's not looking good for being able to manipulate this object, Tim. Even with .NET and using the GetGripPoints() method, which I have used to move other C3D objects, I'm not finding any way to work with these. For that method I'm getting an eNotImplementedYet exception.

Jeff_M, also a frequent Swamper
EESignature
Message 6 of 6

tcorey
Mentor
Mentor

Thanks, Jeff. I won't bang my head on that wall any longer...



Tim Corey
MicroCAD Training and Consulting, Inc.
Redding, CA
Autodesk Platinum Reseller

New knowledge is the most valuable commodity on earth. -- Kurt Vonnegut
0 Likes