All Projects → luanshixia → Autocadcodepack

luanshixia / Autocadcodepack

Licence: mit
AutoCAD Code Pack: A powerful library that helps you to develop AutoCAD plugins using the AutoCAD .NET API

Projects that are alternatives of or similar to Autocadcodepack

Xeokit Sdk
Open source JavaScript SDK for viewing high-detail, full-precision 3D BIM and AEC models in the Web browser.
Stars: ✭ 316 (+52.66%)
Mutual labels:  cad, engineering
Drawkit
Vector and illustration framework for macOS
Stars: ✭ 299 (+44.44%)
Mutual labels:  drawing, cad
Librecad
LibreCAD is a cross-platform 2D CAD program written in C++11 using the Qt framework. It can read DXF and DWG files and can write DXF, PDF and SVG files. The user interface is highly customizable, and has dozens of translations.
Stars: ✭ 2,602 (+1157%)
Mutual labels:  drawing, cad
Librecad 3
LibreCAD 3 is a next generation 2D CAD application written to be modular, with a core independent from GUI toolkits. Scripting is possible with Lua.
Stars: ✭ 189 (-8.7%)
Mutual labels:  drawing, cad
Pyocct
Python bindings for OpenCASCADE via pybind11.
Stars: ✭ 87 (-57.97%)
Mutual labels:  cad, engineering
Leaflet Geoman
🍂🗺️ The most powerful leaflet plugin for drawing and editing geometry layers
Stars: ✭ 1,088 (+425.6%)
Mutual labels:  drawing, gis
range3
Range Software - Finite Element Analysis
Stars: ✭ 31 (-85.02%)
Mutual labels:  engineering, cad
Maker.js
📐⚙ 2D vector line drawing and shape modeling for CNC and laser cutters.
Stars: ✭ 1,185 (+472.46%)
Mutual labels:  drawing, cad
Freecad
This is the official source code of FreeCAD, a free and opensource multiplatform 3D parametric modeler. Issues are managed on our own bug tracker at https://www.freecadweb.org/tracker
Stars: ✭ 10,366 (+4907.73%)
Mutual labels:  cad, engineering
Zcad
Simple CAD program
Stars: ✭ 91 (-56.04%)
Mutual labels:  drawing, cad
Scribble.rs
A skribbl.io alternative - Play at https://scribblers-official.herokuapp.com/
Stars: ✭ 188 (-9.18%)
Mutual labels:  drawing
Whitebox Python
WhiteboxTools Python Frontend
Stars: ✭ 188 (-9.18%)
Mutual labels:  gis
Gama
Core plug-in projects of the GAMA platform
Stars: ✭ 196 (-5.31%)
Mutual labels:  gis
Node Occ
build BREP Solids with OpenCascade and NodeJS - 3D Modeling
Stars: ✭ 202 (-2.42%)
Mutual labels:  cad
Awesome Geospatial Companies
🌐 List of 500+ geospatial companies (GIS, Earth Observation, UAV, Satellite, Digital Farming, ..)
Stars: ✭ 184 (-11.11%)
Mutual labels:  gis
Cq Editor
CadQuery GUI editor based on PyQT
Stars: ✭ 183 (-11.59%)
Mutual labels:  cad
Geostats
A tiny and standalone javascript library for classification and basic statistics :
Stars: ✭ 183 (-11.59%)
Mutual labels:  gis
Cfdof
Computational Fluid Dynamics (CFD) for FreeCAD based on OpenFOAM solver
Stars: ✭ 181 (-12.56%)
Mutual labels:  cad
Earthenterprise
Google Earth Enterprise - Open Source
Stars: ✭ 2,425 (+1071.5%)
Mutual labels:  gis
Openglobus
JavaScript 3d maps and geospatial data visualization engine library.
Stars: ✭ 199 (-3.86%)
Mutual labels:  gis

AutoCAD Code Pack

Previously hosted on CodePlex.

AutoCAD Code Pack is a powerful library that helps you to develop AutoCAD plugins using the AutoCAD .NET API. It re-encapsulates the over-designed and old-fashioned classes and methods into easy-to-use static modules and functions. It also brings modern C# syntax like LINQ and lambdas (functional programming) to AutoCAD development. With all the features it provides, you can save over half the lines of your code.

The library was originally developed for AutoCAD R18 (2010, 2011, 2012) and .NET 3.5. We recently updated it to target AutoCAD R23 (2019) and .NET 4.7.1, thanks to the contribution from @lavantgarde. Due to the popularity of old AutoCAD versions, we also provide compatibility projects for R18 and R19.

View Test.cs for API usage examples.

Don't forget to star us! If you think this library is helpful, please tell others to have a try too. We can't wait to hear all your feedbacks.

Modules

The library consists of the following modules:

  • Draw to directly draw entities (with AutoCAD-command-like functions)
  • NoDraw to create in-memory entities
  • Modify to edit entities (with AutoCAD-command-like functions)
  • Annotation to draw annotations
  • DbHelper to manipulate the DWG database
  • QuickSelection to simplify entity manipulation with LINQ style coding experience (like jQuery, if you know some Web)
  • Interaction to handle user interactions
  • Algorithms to offer some mathematical helpers
  • MultiDoc to process cross-document scenarios
  • CustomDictionary to help you attach data to entities
  • SymbolPack to help you draw symbols like arrows, etc.
  • IronPython to allow you use IronPython in AutoCAD

A Quick Look

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

[CommandMethod("PolyClean0", CommandFlags.UsePickSet)]
public static void PolyClean0()
{
    var ids = Interaction.GetSelection("\nSelect polyline", "LWPOLYLINE");
    int n = 0;
    ids.QForEach<Polyline>(poly =>
    {
        if (poly.Length == 0)
        {
            poly.Erase();
            n++;
        }
    });
    Interaction.WriteLine("{0} eliminated.", n);
}

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

[CommandMethod("PolyClean0_Old", CommandFlags.UsePickSet)]
public static void PolyClean0_Old()
{
    string message = "\nSelect polyline";
    string allowedType = "LWPOLYLINE";
    Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
    PromptSelectionOptions opt = new PromptSelectionOptions
    {
        MessageForAdding = message
    };
    ed.WriteMessage(message);
    SelectionFilter filter = new SelectionFilter(
        new TypedValue[] 
        {
            new TypedValue(0, allowedType) 
        });
    PromptSelectionResult res = ed.GetSelection(opt, filter);
    if (res.Status != PromptStatus.OK)
    {
        return;
    }            
    ObjectId[] ids = res.Value.GetObjectIds();
    int n = 0;
    Database db = HostApplicationServices.WorkingDatabase;
    using (Transaction trans = db.TransactionManager.StartTransaction())
    {
        foreach (ObjectId id in ids)
        {
            Polyline poly = trans.GetObject(id, OpenMode.ForWrite) as Polyline;
            if (poly.Length == 0)
            {
                poly.Erase();
                n++;
            }
        }
        trans.Commit();
    }
    ed.WriteMessage("{0} eliminated.", n);
}

Examples

View Test.cs for detailed API usage examples.

PS: A useful tool for those who have a lot of huge DWGs and VS projects on disk

SharpDiskSweeper can help you find the point in disk to start cleaning up.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].