Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
luanshixia authored Dec 18, 2018
1 parent be81eb2 commit c73ac1b
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,9 @@ The library consists of the following modules:

## A Quick Look

You may write this elegant code with the code pack:
You may write this elegant code with the code pack. Let's say you want a command to clean up all 0-length polylines.

```csharp
/// <summary>
/// Eliminate zero-length polylines
/// </summary>
[CommandMethod("PolyClean0", CommandFlags.UsePickSet)]
public static void PolyClean0()
{
Expand All @@ -52,7 +49,7 @@ public static void PolyClean0()
}
```

instead of the verbose version using original API:
Crazy simple, right? Can you imagine how much extra code you would have to write using the original API:

```csharp
[CommandMethod("PolyClean0_Old", CommandFlags.UsePickSet)]
Expand All @@ -61,9 +58,16 @@ public static void PolyClean0_Old()
string message = "\nSelect polyline";
string allowedType = "LWPOLYLINE";
Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
PromptSelectionOptions opt = new PromptSelectionOptions { MessageForAdding = message };
PromptSelectionOptions opt = new PromptSelectionOptions
{
MessageForAdding = message
};
ed.WriteMessage(message);
SelectionFilter filter = new SelectionFilter(new TypedValue[] { new TypedValue(0, allowedType) });
SelectionFilter filter = new SelectionFilter(
new TypedValue[]
{
new TypedValue(0, allowedType)
});
PromptSelectionResult res = ed.GetSelection(opt, filter);
if (res.Status != PromptStatus.OK)
{
Expand Down

0 comments on commit c73ac1b

Please sign in to comment.