Hi, Jerry .... question from the Bricscad fourm
Thanks for trying this out, It seems that I do need to do a little work on SDSMethods.SSget. Anyway without seeing your code it’s hard to see where the problem is. I have written a couple of samples in C# showing the difference between using my SDS wrappers and the COM wrappers. I’ll post this over at the Swamp too so other can see.
//com sample
[CommandMethodAttribute("MySel1")]
public static void MySel1()
{
try
{
AcadApplication app = (AcadApplication)DRXNET.OdAp.Application.ComApplication;
if (app == null)
DRXNET.SDS.SDSMethods.PrintF("\n" + "Doh");
AcadDocument Doc = app.ActiveDocument;
AcadSelectionSet selection = Doc.SelectionSets.Add("test");
try
{
int[] var = new int[] { 0 };
object[] val = new object[] { "POINT" };
selection.SelectOnScreen(var, val);
List<AcadPoint> entlist = new List<AcadPoint>();
Point3dCollection ptlist = new Point3dCollection();
foreach (var e in selection)
entlist.Add((AcadPoint)e);
entlist.ForEach(e => ptlist.Add(new Point3d((double[])e.Coordinates)));
ptlist.ForEach(p => DRXNET.SDS.SDSMethods.PrintF(p.ToString()));
}
catch
{
DRXNET.SDS.SDSMethods.PrintF("\nError Getting Selection set: ");
}
finally
{
selection.Delete();
}
}
catch (System.Exception ex)
{
DRXNET.SDS.SDSMethods.PrintF("\n" + ex.Message);
DRXNET.SDS.SDSMethods.PrintF("\n" + ex.StackTrace);
}
}
//sds sample
[CommandMethodAttribute("MySel2")]
public static void MySel2()
{
try
{
Point3dCollection ptlist = new Point3dCollection();
SDSResultBuffer filter = new SDSResultBuffer();
filter.Add(new TypedValue(0, "POINT"));
SDSName ss = SDSMethods.SSGet(null, filter);
if (ss.ID0 == 0 && ss.ID1 == 0)
DRXNET.SDS.SDSMethods.PrintF("\nError Getting Selection set: ");
for (int i = 0; i < SDSMethods.SSLength(ss); i++)
{
SDSName entname = SDSMethods.SSName(ss, i);
SDSResultBuffer entlist = SDSMethods.EntGet(entname);
foreach (TypedValue tv in entlist)
{
if (tv.TypeCode == 10)
ptlist.Add(new Point3d((SDSPoint)tv.Value));
}
}
ptlist.ForEach(p => DRXNET.SDS.SDSMethods.PrintF(p.ToString()));
SDSMethods.SSFree(ss);
}
catch (System.Exception ex)
{
DRXNET.SDS.SDSMethods.PrintF("\n" + ex.Message);
DRXNET.SDS.SDSMethods.PrintF("\n" + ex.StackTrace);
}
}