{"id":27132794,"url":"https://github.com/wtertinek/linq2acad","last_synced_at":"2025-08-21T17:19:56.216Z","repository":{"id":32108691,"uuid":"35681029","full_name":"wtertinek/Linq2Acad","owner":"wtertinek","description":"A library that aims to simplify AutoCAD .NET plugin code","archived":false,"fork":false,"pushed_at":"2024-05-29T22:08:06.000Z","size":7700,"stargazers_count":65,"open_issues_count":2,"forks_count":35,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-04-07T12:08:24.552Z","etag":null,"topics":["autocad","csharp","dotnet","linq"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wtertinek.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-05-15T15:18:01.000Z","updated_at":"2025-03-07T13:14:41.000Z","dependencies_parsed_at":"2024-05-18T06:30:17.981Z","dependency_job_id":"9bea54bc-3ee6-4226-9cd1-4d6e766c88f6","html_url":"https://github.com/wtertinek/Linq2Acad","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wtertinek%2FLinq2Acad","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wtertinek%2FLinq2Acad/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wtertinek%2FLinq2Acad/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wtertinek%2FLinq2Acad/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wtertinek","download_url":"https://codeload.github.com/wtertinek/Linq2Acad/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247739515,"owners_count":20988032,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["autocad","csharp","dotnet","linq"],"created_at":"2025-04-07T22:26:39.601Z","updated_at":"2025-04-07T22:26:40.165Z","avatar_url":"https://github.com/wtertinek.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Linq2Acad\nA library that aims to simplify AutoCAD .NET plugin code. Available for `AutoCAD 2015` and later.\n\n### Overview\n- [News](#news)\n- [Getting started](#getting-started)\n- [Installation](#installation)\n- [API documentation](#api-documentation)\n- [How it works](#how-it-works)\n- [Contributing](#contributing)\n- [License](#license)\n\n# News\n**Linq2Acad-2024** is now available on [NuGet](https://www.nuget.org/packages/Linq2Acad-2024/).\n\n## Getting started\n`Linq2Acad` is a library that aims to simplify AutoCAD .NET plugin code. It should be a more intuitive API for working with the drawing database, making the learning curve for beginners less steep.\n\n#### As a simple example, let's print all layer names using Linq2Acad:\n\n```cs\nusing (var db = AcadDatabase.Active())\n{\n  var layerNames = db.Layers.Select(l =\u003e l.Name);\n  MessageBox.Show(string.Join(\", \", layerNames));\n}\n```\n\n#### Linq2Acad makes it easy to delete all BlockReferences from the model space:\n\n```cs\nusing (var db = AcadDatabase.Active())\n{\n  foreach (var br in db.ModelSpace\n                       .OfType\u003cBlockReference\u003e()\n                       .UpgradeOpen())\n  {\n    br.Erase();\n  }\n}\n```\n\n#### This code shows how to import a block from a DWG file into the active document:\n\n```cs\nusing (var sourceDb = AcadDatabase.OpenReadOnly(@\"C:\\Blocks\\Shapes.dwg\"))\nusing (var targetDb = AcadDatabase.Active())\n{\n  var block = sourceDb.Blocks.Element(\"TRIANGLE\");\n  targetDb.Blocks.Import(block);\n}\n```\n\n#### You can easily store data on entities:\n\n```c#\nvar entityId = GetEntity(\"Pick an Entity\");\nvar key = GetString(\"Enter key\");\nvar str = GetString(\"Enter string to save\");\n\n// We first write the data (it is stored in the Entity's extension data)\nusing (var db = AcadDatabase.Active())\n{\n  db.CurrentSpace\n    .Element(entityId)\n    .SaveData(key, str);\n\n  WriteMessage($\"Key-value-pair {key}:{str} saved on Entity\");\n}\n\n// Then we read it back\nusing (var db = AcadDatabase.Active())\n{\n  var str = db.CurrentSpace\n              .Element(entityId)\n              .GetData\u003cstring\u003e(key);\n\n  WriteMessage($\"String {str} read from Entity\");\n}\n```\n\n#### You can use Linq2Acad to changes the summary info of the active document:\n\n```cs\nusing (var db = AcadDatabase.Active())\n{\n  db.SummaryInfo.Author = \"John Doe\";\n  db.SummaryInfo.CustomProperties[\"CustomData1\"] = \"42\";\n}\n```\n\n#### There's also a simple way to, for example, reload all loaded XRefs:\n\n```cs\nusing (var db = AcadDatabase.Active())\n{\n  foreach (var xRef in db.XRefs\n                         .Where(xr =\u003e xr.IsLoaded))\n  {\n    xRef.Reload();\n  }\n}\n```\n      \nMore code samples (in C# and VB.NET) can be found [here](docs/CodeSamples.md).\n\n\n## Installation\n\n### NuGet packages\n\nLinq2Acad is available on NuGet. There is a dedicated Linq2Acad package for each AutoCAD version. Simply add the package for your AutoCAD version to your C#/VB project in Visual Studio. Available packages:\n\n\u003ca href=\"https://www.nuget.org/packages/Linq2Acad-2024\"\u003e\n  \u003cimg src=\"https://img.shields.io/nuget/v/Linq2Acad-2024?label=Linq2Acad-2024\u0026style=plastic\" alt=\"Linq2Acad-2024\" /\u003e\n\u003c/a\u003e\n\u003ca href=\"https://www.nuget.org/packages/Linq2Acad-2023\"\u003e\n  \u003cimg src=\"https://img.shields.io/nuget/v/Linq2Acad-2023?label=Linq2Acad-2023\u0026style=plastic\" alt=\"Linq2Acad-2023\" /\u003e\n\u003c/a\u003e\n\u003cbr/\u003e\n\u003ca href=\"https://www.nuget.org/packages/Linq2Acad-2022\"\u003e\n  \u003cimg src=\"https://img.shields.io/nuget/v/Linq2Acad-2022?label=Linq2Acad-2022\u0026style=plastic\" alt=\"Linq2Acad-2022\" /\u003e\n\u003c/a\u003e\n\u003ca href=\"https://www.nuget.org/packages/Linq2Acad-2021\"\u003e\n  \u003cimg src=\"https://img.shields.io/nuget/v/Linq2Acad-2021?label=Linq2Acad-2021\u0026style=plastic\" alt=\"Linq2Acad-2021\" /\u003e\n\u003c/a\u003e\n\u003cbr/\u003e\n\u003ca href=\"https://www.nuget.org/packages/Linq2Acad-2020\"\u003e\n  \u003cimg src=\"https://img.shields.io/nuget/v/Linq2Acad-2020?label=Linq2Acad-2020\u0026style=plastic\" alt=\"Linq2Acad-2020\" /\u003e\n\u003c/a\u003e\n\u003ca href=\"https://www.nuget.org/packages/Linq2Acad-2019\"\u003e\n  \u003cimg src=\"https://img.shields.io/nuget/v/Linq2Acad-2019?label=Linq2Acad-2019\u0026style=plastic\" alt=\"Linq2Acad-2019\" /\u003e\n\u003c/a\u003e\n\u003cbr/\u003e\n\u003ca href=\"https://www.nuget.org/packages/Linq2Acad-2018\"\u003e\n  \u003cimg src=\"https://img.shields.io/nuget/v/Linq2Acad-2018?label=Linq2Acad-2018\u0026style=plastic\" alt=\"Linq2Acad-2018\" /\u003e\n\u003c/a\u003e\n\u003ca href=\"https://www.nuget.org/packages/Linq2Acad-2017\"\u003e\n  \u003cimg src=\"https://img.shields.io/nuget/v/Linq2Acad-2017?label=Linq2Acad-2017\u0026style=plastic\" alt=\"Linq2Acad-2017\" /\u003e\n\u003c/a\u003e\n\u003cbr/\u003e\n\u003ca href=\"https://www.nuget.org/packages/Linq2Acad-2016\"\u003e\n  \u003cimg src=\"https://img.shields.io/nuget/v/Linq2Acad-2016?label=Linq2Acad-2016\u0026style=plastic\" alt=\"Linq2Acad-2016\" /\u003e\n\u003c/a\u003e\n\u003ca href=\"https://www.nuget.org/packages/Linq2Acad-2015\"\u003e\n  \u003cimg src=\"https://img.shields.io/nuget/v/Linq2Acad-2015?label=Linq2Acad-2015\u0026style=plastic\" alt=\"Linq2Acad-2015\" /\u003e\n\u003c/a\u003e\n\n### How to upgrade from source code to NuGet\n\n1. Remove your existing Linq2Acad project completely from your existing Visual Studio solution (You should see a lot of red squiggly lines)\n2. Install the NuGet Package\n\n(If you add NuGet while already having a Linq2Acad project there, and THEN you subsequently remove the latter project - you might have a lot of problems)\n\n## API documentation\nThe best entry point into the API documentation is the class [AcadDatabase](docs/api/T_Linq2Acad_AcadDatabase.md#AcadDatabase-Class). An overview of all classes can be found [here](docs/api/Index.md#Linq2Acad-Namespace).\n\n## How it works?\n[This blog series](https://wtertinek.com/2016/07/06/linq-and-the-autocad-net-api-final-part) discusses:\n\n- the original problem this library seeks to solve,\n- the design / implementation decisions involved in deriving the API. \n\n## Contributing\nWe would love for you to contribute to Linq2Acad and help to make the life of AutoCAD plugin developers easier. We welcome ideas, suggestions and discussions to push the development forward. Implementation of bugfixes or new features are also always welcome. For details see the [contributing guidelines](.github/CONTRIBUTING.md).\n\n## License\nLinq2Acad is licended unter the [MIT License (MIT)](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwtertinek%2Flinq2acad","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwtertinek%2Flinq2acad","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwtertinek%2Flinq2acad/lists"}