The 2013 .NET API exposes just 10 of the 22 PartDataFields for Pipe objects. WTh (Wall thickness) is not one of them so I'm attempting to get it via Late Binding. This lisp code works, where (vl-sel) is just a helper function to select an object and convert it to a vla-object:
(setq pdr (vlax-get (vl-sel) 'partdatarecord)) (setq itm (vlax-invoke pdr 'find "WTh"))
to get the PartDataField. However, putting this into my C# code, it fails on the Find portion with an exception
//ps is a valid PartSize object PartDataRecord pdr = ps.SizeDataRecord; PartDataField diafld = pdr.GetDataFieldBy(PartContextType.PipeInnerDiameter); object[] args = new object[1];
object acadobj = ps.AcadObject;
object pdrobj = acadobj.GetType().InvokeMember("PartDataRecord", System.Reflection.BindingFlags.GetProperty, null, acadobj, null);
args[0] = "WTh";
object wth = pdrobj.GetType().InvokeMember("Find", System.Reflection.BindingFlags.InvokeMethod, null, pdrobj, args); //<<<Fails here
object tag = wth.GetType().InvokeMember("TAG", System.Reflection.BindingFlags.GetProperty, null, wth, null);
string units = (string)wth.GetType().InvokeMember("Units", System.Reflection.BindingFlags.GetProperty, null, wth, null);
Any ideas as to what I'm missing?
And for some reason COM is out of the question?:
AeccPipe comPipe = p.AcadObject as AeccPipe; //p is of type Autodesk.Civil.DatabaseServices.Pipe
if (comPipe != null)
{
double dWT = comPipe.WallThickness;
}
@Anonymous wrote:
And for some reason COM is out of the question?:
Yes, this is a COM-less application, so I was trying to get it via late binding. However, since I am creating a pipe, not getting one, I need the data from the PartsList, not a Pipe object.