[LispFunction("MyLispFunc")]
public ResultBuffer mylispfunc(ResultBuffer resBuf)
{
ResultBuffer rbfResult = default(ResultBuffer);
var args = resBuf.AsArray();
var theList
= new List
<KeyValuePair
<ObjectId,
short>>(); var shpAdress = (string)args[0].Value;
for (int i = 3; i < args.Length - 2; i += 4)
{
theList
.Add(new KeyValuePair
<ObjectId,
short>((ObjectId
)args
[i
].Value,
(short)args
[i
+ 1].Value)); }
processTheList(shpAdress, theList);
rbfResult
= new ResultBuffer
(new TypedValue
(Convert
.ToInt32(5005),
"ProbableSuccess")); return rbfResult;
}
private void processTheList(string shpAdress, List<KeyValuePair<ObjectId, short>> theList)
{
var db = HostApplicationServices.WorkingDatabase;
using (Transaction tr = db.TransactionManager.StartTransaction())
{
foreach (var item in theList)
{
//ShapeFile shp = new Esri.ShapeFile.Polygon();
Polyline lwp = tr.GetObject(item.Key, OpenMode.ForRead) as Polyline;
int vn = lwp.NumberOfVertices;
for (int i = 0; i < vn; i++)
{
Point2d vertex = lwp.GetPoint2dAt(i);
//shp.Vertices.Add(vertex.X, vertex.Y);
}
//shp.Fields["Text"].Value = item.Value.ToString();
//shp.Create();
//shp.run(shpAdress);
}
tr.Commit();
}
}