Sharper.GstarCAD.Extensions
2024.1.0
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package Sharper.GstarCAD.Extensions --version 2024.1.0
NuGet\Install-Package Sharper.GstarCAD.Extensions -Version 2024.1.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Sharper.GstarCAD.Extensions" Version="2024.1.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Sharper.GstarCAD.Extensions --version 2024.1.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Sharper.GstarCAD.Extensions, 2024.1.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Sharper.GstarCAD.Extensions as a Cake Addin #addin nuget:?package=Sharper.GstarCAD.Extensions&version=2024.1.0 // Install Sharper.GstarCAD.Extensions as a Cake Tool #tool nuget:?package=Sharper.GstarCAD.Extensions&version=2024.1.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Sharper.GstarCAD.Extensions
GstarCAD Extension Library
The GstarCAD port of Gile.AutoCAD.Extension. This is an unofficial extension library enhanced for GstarCAD .NET SDK.
You can get GstarCAD SDK on the official website https://www.gstarcad.com/download/, or on the Nuget Gallery.
This library should help to write code in a more concise and declarative way.
Example with a method to erase lines in model space which are smaller than a given distance:
public void EraseShortLines(double minLength)
{
var db = Application.DocumentManager.MdiActiveDocument.Database;
using (var tr = db.TransactionManager.StartTransaction())
{
var blockTable = (BlockTable)tr.GetObject(db.BlockTableId, OpenMode.ForRead);
var modelSpace = (BlockTableRecord)tr.GetObject(blockTable[BlockTableRecord.ModelSpace], OpenMode.ForRead);
var lineClass = RXObject.GetClass(typeof(Line));
foreach (ObjectId id in modelSpace)
{
if (id.ObjectClass == lineClass)
{
var line = (Line)tr.GetObject(id, OpenMode.ForRead);
if (line.Length < minLength)
{
tr.GetObject(id, OpenMode.ForWrite);
line.Erase();
}
}
}
tr.Commit();
}
}
The same method can be written:
public void EraseShortLines(double minLength)
{
var db = Active.Database;
using (var tr = db.TransactionManager.StartTransaction())
{
db.GetModelSpace()
.GetObjects<Line>()
.Where(line => line.Length < minLength)
.UpgradeWrite()
.ToList()
.ForEach(line => line.Erase());
tr.Commit();
}
}
Deployment
This library is published as a nuget package in nuget.org.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET Framework | net40 is compatible. net403 was computed. net45 was computed. net451 was computed. net452 was computed. net46 was computed. net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 is compatible. net481 was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETFramework 4.0
- GstarCADNET (>= 17.2.0 && < 20.0.0)
-
.NETFramework 4.8
- GstarCADNET (>= 24.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.