[CommandMethod("Test1")]
public static void Test1()
{
Editor acadEditor = Application.DocumentManager.MdiActiveDocument.Editor;
PromptSelectionResult result = acadEditor.GetSelection();
if (result.Status == PromptStatus.OK)
{
SelectionSet selectionSet = result.Value;
int cnt = 1;
do
{
using (ResultBuffer resultBuffer
= new ResultBuffer
()) {
TypedValue typedValue
= new TypedValue
((int)LispDataType
.SelectionSet, selectionSet
);
resultBuffer.Add(typedValue);
acadEditor.WriteMessage(string.Format("\n{0}", cnt++));
}
}
while (acadEditor.GetString("\nPress Enter").Status == PromptStatus.OK);
}
}
[CommandMethod("Test2")]
public static void Test2()
{
Editor acadEditor = Application.DocumentManager.MdiActiveDocument.Editor;
PromptSelectionResult result = acadEditor.GetSelection();
if (result.Status == PromptStatus.OK)
{
SelectionSet selectionSet = result.Value;
ObjectId
[] objectIds
= new ObjectId
[selectionSet
.Count];
for (int i = 0; i < selectionSet.Count; i++)
{
objectIds[i] = selectionSet[i].ObjectId;
}
SelectionSet newSelectionSet = SelectionSet.FromObjectIds(objectIds);
int cnt = 1;
do
{
using (ResultBuffer resultBuffer
= new ResultBuffer
()) {
TypedValue typedValue
= new TypedValue
((int)LispDataType
.SelectionSet, newSelectionSet
);
resultBuffer.Add(typedValue);
acadEditor.WriteMessage(string.Format("\n{0}", cnt++));
}
}
while (acadEditor.GetString("\nPress Enter").Status == PromptStatus.OK);
}
}