Files
ViewDesignEngine/dotnet/VdeSharp/Assembly.cs
T
茂之钳 5e2812a6f3
CI / Build & Test (push) Failing after 33s
CI / Release Build (push) Failing after 35s
Build & Test / build-and-test (push) Has been cancelled
Build & Test / python-bindings (push) Has been cancelled
feat(v6.2): Blender addon + .NET/C# bindings + developer docs + plugin system
v6.2.1 — Blender Integration Addon:
- 5 files, 1,732 lines: __init__, operators (9 ops), panels (4 panels)
- preferences, vde_bridge (subprocess CLI bridge)
- Import/Export STEP, primitives, boolean, SDF→Mesh

v6.2.2 — .NET/C# Bindings (VdeSharp):
- 8 files: NativeMethods (50+ P/Invoke), BrepModel, MeshData, SdfEngine, Assembly
- C API extended with 20 new functions (STEP I/O, Boolean, SDF, Assembly)
- vde_capi rebuilt as SHARED library
- Example: import STEP → boolean → export

v6.2.3 — Developer Docs + Plugin System:
- 7 docs: architecture, contributing, API overview, building, testing, plugin-system
- plugin_system.h/.cpp: PluginInterface, PluginManager, dlopen/LoadLibrary
- README.md updated with v6 features
- Syntax-check passed (GCC 10.2.1, -Wall -Wextra -Wpedantic)
2026-07-26 22:24:40 +08:00

47 lines
1.2 KiB
C#

namespace VdeSharp;
/// <summary>
/// Managed wrapper for VDE Assembly.
/// Represents a hierarchical assembly of BrepModel parts.
/// </summary>
public class Assembly : IDisposable
{
private readonly nint _ctx;
internal nint _handle;
private bool _disposed;
/// <summary>
/// Creates a new assembly with the given name.
/// </summary>
public Assembly(nint ctx, string name)
{
_ctx = ctx;
_handle = NativeMethods.vde_assembly_create(ctx, name);
}
/// <summary>
/// Adds a part (BrepModel) to the root of this assembly.
/// The part is deep-copied into the assembly.
/// </summary>
/// <returns>1 on success</returns>
public int AddPart(string name, BrepModel body)
{
return NativeMethods.vde_assembly_add_part(_handle, name, body._handle);
}
/// <summary>
/// Returns the total number of part nodes in this assembly.
/// </summary>
public int PartCount => NativeMethods.vde_assembly_part_count(_handle);
public void Dispose()
{
if (!_disposed && _handle != nint.Zero)
{
NativeMethods.vde_assembly_free(_handle);
_handle = nint.Zero;
_disposed = true;
}
}
}