### Create and Manage Stock Records in C# Source: https://context7.com/aoroberson/sigmanestplugin-sdk/llms.txt Demonstrates creating a new stock record, setting its properties, and saving it to the database. Includes examples of checking stock availability, existence, and updating quantities. ```csharp using SigmaNEST.Plugin; using System; ISTDatabase database = /* obtained from SigmaNEST */; // Create a new stock record IStockRec stock = database.NewStockRec(); stock.SheetName = "STEEL304-3MM-001"; stock.Material = "Steel 304"; stock.Thickness = 3.0; // Sheet dimensions stock.Length = 2500.0; // mm stock.Width = 1250.0; // mm stock.Area = 3125000.0; // sq mm // Inventory quantities stock.Quantity = 50; stock.QtyAvailable = 48; stock.QtyOnOrder = 0; stock.QtyReserved = 2; // Location and tracking stock.Location = "Warehouse-A"; stock.BinNumber = "A-12-3"; stock.HeatNumber = "HT-2024-0156"; stock.Mill = "ArcelorMittal"; stock.PrimeCode = "PRIME"; // Cost and weight stock.Cost = 125.50; // per sheet stock.Weight = 73.5; // kg per sheet // Dates stock.DateReceived = DateTime.Now.AddDays(-30); stock.DateCreated = DateTime.Now; // Sheet type and properties stock.SheetType = TSheetType.stPlate; stock.SpecialProperties = false; stock.Single = false; // Not a single-use sheet stock.Consignment = false; // Owned inventory stock.Reserved = false; // Edge distances for nesting stock.EdgeDistTop = 10.0; stock.EdgeDistBottom = 10.0; stock.EdgeDistLeft = 10.0; stock.EdgeDistRight = 10.0; // Custom data and instructions stock.SheetData1 = "Lot: 2024-A"; stock.SheetData2 = "Cert: C-123456"; stock.Remark = "First-in First-out"; stock.SpecialInstruction = "Check surface quality before use"; // Save to database if (stock.WriteToDatabase()) { Console.WriteLine($"Stock {stock.SheetName} added to inventory"); } // Check stock availability IStockTable stockTable = database.StockTable; int available = stockTable.QuantityAvailable("STEEL304-3MM-001"); int inProcess = stockTable.AbsQuantityInProcess("STEEL304-3MM-001"); Console.WriteLine($"Available: {available}, In Process: {inProcess}"); // Check if sheet exists if (stockTable.DoesSheetExistInStockTable("STEEL304-3MM-001")) { // Update quantity available stockTable.UpdateQuantityAvailable("STEEL304-3MM-001"); } // Read existing stock IStockRec existingStock = database.StockRec; existingStock.SheetName = "STEEL304-3MM-001"; if (existingStock.ReadFromDatabase()) { // Check if in process string progName = ""; int qtyInProc = 0; if (existingStock.IsInProcess(ref progName, ref qtyInProc)) { Console.WriteLine($"Sheet in program {progName}: {qtyInProc} sheets"); } // Rename sheet if (existingStock.RenameSheet("STEEL304-3MM-001-A")) { Console.WriteLine("Sheet renamed successfully"); } } ``` -------------------------------- ### Implement a Custom SigmaNEST Plugin Source: https://context7.com/aoroberson/sigmanestplugin-sdk/llms.txt Extend the SNPlugin base class to define plugin metadata, UI button locations, and execution callbacks. Ensure the class is marked with ComVisible and a unique GUID for proper COM registration. ```csharp using SigmaNEST.Plugin; using System; // Create a custom plugin by extending SNPlugin [ComVisible(true)] [Guid("YOUR-UNIQUE-GUID-HERE")] public class MyCustomPlugin : SNPlugin { public MyCustomPlugin(ISNApp app, ISNPokeIntf poke) : base(app, poke) { // Set plugin metadata Author = "Your Company"; Version = "1.0.0"; PlugInDescription = "My Custom Nesting Plugin"; PlugInExplenation = "Automates nesting workflows"; ButtonDescription = "Run Custom Nest"; DateCreated = DateTime.Now.ToOADate(); // Define where the button appears in SigmaNEST UI ButtonLocations = new int[] { SNPluginTypes.ButtonLocation_WorkSpace, SNPluginTypes.ButtonLocation_NestingManual }; // Authorization settings AuthorizationType = SNPluginTypes.AuthorizationType_None; // Set up callbacks for execution and configuration ExecuteCallback = OnExecute; ConfigCallback = OnConfigure; } private void OnExecute(string parameters) { // Access SigmaNEST application var app = SNApp; // Perform custom operations app.RefreshTreeView(); app.ExecuteBatchCommand("AUTONEST"); // Use Poke for advanced communication with SigmaNEST double d1 = 0, d2 = 0, d3 = 0; string s1 = "", s2 = "", s3 = ""; int result = Poke(ref d1, ref d2, ref d3, ref s1, ref s2, ref s3); } private void OnConfigure(string parameters) { // Get plugin configuration file path string configPath = GetConfigFile_PathNameExt("INI", 0); // Open configuration dialog } } ``` -------------------------------- ### Manipulating Parts Lists in SigmaNEST Source: https://context7.com/aoroberson/sigmanestplugin-sdk/llms.txt Demonstrates how to get a part by name, remove lead-ins/outs, delete a part, and remove parts by name from a SigmaNEST parts list. Ensure the part object is valid before attempting operations. ```csharp using SigmaNEST.Plugin; using System.Collections.Generic; using System.Drawing; // Get SigmaNEST application instance ISNApp snApp = /* obtained from plugin */; // Work with parts list ISNTaskObj task = /* obtained from task list */; ISNPartsList partsList = task.PartsList; // Get a part by name ISNPartObj part = partsList.GetByName("Bracket-A1"); if (part != null) { Console.WriteLine($"Found part: {part.Name}"); // Remove lead-ins and lead-outs from the part part.DeleteLeadInOut(); // Remove the part from its list bool removed = part.Remove(); } // Remove a part by name directly from the list bool success = partsList.RemoveByName("OldPart"); // Convert SigmaNEST list to .NET List List parts = partsList.ToList(); foreach (var p in parts) { Console.WriteLine($"Part: {p.Name}"); } ``` -------------------------------- ### Generating Bitmap Image of SigmaNEST Object Source: https://context7.com/aoroberson/sigmanestplugin-sdk/llms.txt Provides an example of how to obtain a bitmap image of a SigmaNEST object, specifying dimensions and drawing type. The generated bitmap can be used for previews or reports. ```csharp // Get bitmap image of a SigmaNEST object ISNObject nestObject = nest as ISNObject; Bitmap nestImage = nestObject.GetBmpImage( xSize: 800, ySize: 600, drawType: DrawTypeEum.Draw_All ); // Use the bitmap for reports, previews, etc. nestImage.Save(@"C:\Output\NestPreview.png"); ``` -------------------------------- ### Retrieve Database Field Length Constraints Source: https://context7.com/aoroberson/sigmanestplugin-sdk/llms.txt Access predefined constants on ISTDatabase to get the maximum lengths for common database fields. Use GetFieldLength for specific table and field names. ```csharp // Database field length constraints int maxWONumber = database.DBLenWONumber; int maxPartName = database.DBLenPartName; int maxSheetName = database.DBLenSheetName; int maxProgName = database.DBLenProgName; int maxQuoteNumber = database.DBLenQuoteNumber; int maxPartRemark = database.DBLenPartRemark; int maxDrawingNumber = database.DBLenDrawingNumber; // Get specific field length int fieldLen = database.GetFieldLength("Parts", "PartName"); ``` -------------------------------- ### Get Stock Record Enumerator Source: https://context7.com/aoroberson/sigmanestplugin-sdk/llms.txt Obtain an enumerator for stock records to iterate through them. This is useful for processing all available stock items. ```csharp // Get stock record enumerator for iteration IStockRecEnumerator stockEnum = database.GetStockRecEnumerator(); ``` -------------------------------- ### Create and Save a New Part Record Source: https://context7.com/aoroberson/sigmanestplugin-sdk/llms.txt Demonstrates creating a new part record, populating its properties with detailed information, and saving it to the database. Ensure ISTDatabase is obtained before use. ```csharp using SigmaNEST.Plugin; using System; using System.Collections.Generic; ISTDatabase database = /* obtained from SigmaNEST */; // Create a new part record IPartRec part = database.NewPartRec(); part.PartName = "Bracket-A1"; part.WONumber = "WO-2024-001"; part.PartFilename = @"C:\Parts\Bracket-A1.dxf"; part.DrawingNumber = "DWG-001-A"; part.RevisionNumber = "REV-B"; // Material specifications part.Material = "Steel 304"; part.Thickness = 3.0; // mm // Dimensions and weights part.PartLength = 250.0; part.PartWidth = 150.0; part.NetArea = 37500.0; part.RectArea = 37500.0; part.NetWeight = 0.885; // kg part.RectWeight = 0.885; // Quantities part.QtyOrdered = 100; part.QtyCompleted = 0; part.Priority = 1; part.MachNumber = 1; // Due date part.DueDate = DateTime.Now.AddDays(14); // Cost and pricing part.UnitCost = 12.50; part.MaterialCost = 8.25; part.ProcessCost = 3.50; part.OtherCost = 0.75; part.ShippingCost = 0.25; part.PriceModifier = 1.0; part.UnitPrice = 18.75; part.TotalPrice = 1875.00; // Processing information part.CuttingTime = 45.5; // seconds per part part.ProgrammedBy = "JSmith"; part.Remark = "Deburr all edges"; part.OtherOperations = "Bend,Paint"; // Custom data fields (Data1-Data14 available) part.Data1 = "Assembly-Main"; part.Data2 = "Customer Spec: CS-001"; part.Data3 = "Color: Blue"; // Save to database if (part.WriteToDatabase()) { Console.WriteLine($"Part {part.PartName} saved to database"); } ``` -------------------------------- ### Read and Query Existing Part Record Source: https://context7.com/aoroberson/sigmanestplugin-sdk/llms.txt Shows how to read an existing part record from the database by specifying its work order and part name. It then demonstrates calculating the remaining quantity to be produced. ```csharp // Read existing part IPartRec existingPart = database.PartRec; existingPart.WONumber = "WO-2024-001"; existingPart.PartName = "Bracket-A1"; if (existingPart.ReadFromDatabase()) { int remaining = existingPart.QtyOrdered - existingPart.QtyCompleted - existingPart.QtyInProcess; Console.WriteLine($"Remaining to produce: {remaining}"); } ``` -------------------------------- ### Manage INI Configuration Files with IniFile Source: https://context7.com/aoroberson/sigmanestplugin-sdk/llms.txt Use the IniFile class to read and write configuration settings with type-safe methods and support for various boolean output formats. ```csharp using SigmaNEST.Plugin; using System; using System.Collections.Generic; // Load or create an INI configuration file var ini = new IniFile(@"C:\SigmaNEST\Plugins\MyPlugin.ini"); // Read values with type-safe methods string serverName = ini.ReadString("Database", "Server", "localhost"); int port = ini.ReadInteger("Database", "Port", 5432); bool enableLogging = ini.ReadBool("Settings", "EnableLogging", false); float tolerance = ini.ReadFloat("Nesting", "Tolerance", 0.5f); DateTime lastRun = ini.ReadDateTime("Settings", "LastRun", DateTime.MinValue); // Write values with various boolean output formats ini.WriteString("Database", "Server", "production-server"); ini.WriteInteger("Database", "Port", 5433); ini.WriteBool("Settings", "EnableLogging", true, BoolStringType.Integer); // Writes: "1" ini.WriteBool("Settings", "Active", true, BoolStringType.StringTrueFalse); // Writes: "True" ini.WriteBool("Settings", "Verbose", false, BoolStringType.StringYesNo); // Writes: "No" ini.WriteBool("Settings", "Debug", true, BoolStringType.CharYN); // Writes: "Y" ini.WriteDateTime("Settings", "LastRun", DateTime.Now); ini.WriteDate("Settings", "InstallDate", DateTime.Today); ini.WriteFloat("Nesting", "Tolerance", 0.25f); // Work with sections string[] sections = ini.GetSections(); string[] keys = ini.GetKeys("Database"); string[] values = ini.GetValues("Database"); // Check if section exists if (ini.SectionExists("Advanced")) { List advancedKeys; ini.ReadSection("Advanced", out advancedKeys); } // Read all sections into a list List allSections; ini.ReadSections(out allSections); ``` -------------------------------- ### Create New Database Record Instances Source: https://context7.com/aoroberson/sigmanestplugin-sdk/llms.txt Use factory methods on the ISTDatabase interface to create new record objects for various SigmaNEST entities. Ensure ISTDatabase is obtained from SigmaNEST. ```csharp using SigmaNEST.Plugin; ISTDatabase database = /* obtained from SigmaNEST */; // Create new record instances IWORec workOrder = database.NewWORec(); IPartRec part = database.NewPartRec(); IProgramRec program = database.NewProgramRec(); IStockRec stock = database.NewStockRec(); IRemnantRec remnant = database.NewRemnantRec(); IMaterialRec material = database.NewMaterialRec(); IPIPRec pip = database.NewPIPRec(); // Part in Process ISIPRec sip = database.NewSIPRec(); // Sheet in Process IOrderRec order = database.NewOrderRec(); IOrderItemsRec orderItem = database.NewOrderItemsRec(); IGeoRec geo = database.NewGeoRec(); IAssocFileRec assocFile = database.NewAssocFileRec(); IAssocFileSetRec assocFileSet = database.NewAssocFileSetRec(); IStockReceivedRec stockReceived = database.NewStockReceivedRec(); IStockHistoryRec stockHistory = database.NewStockHistoryRec(); IArchivePacketRec archivePacket = database.NewArchivePacketRec(); IMaterialIACRec materialIAC = database.NewMaterialIACRec(); ITempRemnantNameRec tempRemnant = database.NewTempRemnantNameRec(); IToolAdapterRec toolAdapter = database.NewToolAdapterRec(); ``` -------------------------------- ### Manage NC Programs with IProgramRec Source: https://context7.com/aoroberson/sigmanestplugin-sdk/llms.txt Demonstrates creating, updating, and reading NC program records, including machine assignments and sheet processing details. ```csharp using SigmaNEST.Plugin; using System; using System.Collections; ISTDatabase database = /* obtained from SigmaNEST */; // Create a new program record IProgramRec program = database.NewProgramRec(); program.ProgramName = "NEST-2024-001"; program.TaskName = "Task-A1"; program.SheetName = "STEEL304-3MM-001"; program.RepeatID = 1; // Machine assignment program.MachineName = "Laser-001"; program.MachineID = 1; // Material specifications program.Material = "Steel 304"; program.Thickness = 3.0; program.SheetLength = 2500.0; program.SheetWidth = 1250.0; // Nesting efficiency program.UsedArea = 2812500.0; // sq mm program.ScrapFraction = 0.10; // 10% scrap // Quantities program.QtyInProcess = 5; program.StaticCount = 1; // Processing time and cost program.CuttingTime = 1250.5; // seconds program.PierceQty = 156; program.JobCost = 875.00; // Timestamps program.PostDateTime = DateTime.Now; program.CutStartTime = DateTime.Now.AddHours(2); program.CutEndTime = DateTime.Now.AddHours(3); // Multi-sheet handling program.Rem = true; // Creates remnant // Save to database if (program.WriteToDatabase()) { Console.WriteLine($"Program {program.ProgramName} saved"); } // Update program TUpdateResult result = program.UpdateProgram(allRepeats: true); // Get sheets in process string[] sipList = new string[100]; int sheetTotal = 0; program.GetSIPList(sipList, ref sheetTotal); Console.WriteLine($"Total sheets in process: {sheetTotal}"); // Get SIP records ArrayList sipRecList = new ArrayList(); program.GetSIPRecList(sipRecList); // Read existing program IProgramRec existingProgram = database.ProgramRec; existingProgram.ProgramName = "NEST-2024-001"; existingProgram.RepeatID = 1; if (existingProgram.ReadFromDatabase()) { Console.WriteLine($"Program uses sheet: {existingProgram.SheetName}"); Console.WriteLine($"Cutting time: {existingProgram.CuttingTime}s"); Console.WriteLine($"Is multi-sheet: {existingProgram.IsMultiSheet}"); } // Check if program exists in database if (program.DoesPrgnameExistInProgramDB()) { Console.WriteLine("Program already exists"); } // Change program name program.ChangeProgramName("NEST-2024-001-REV"); // Get program post date DateTime postDate = database.GetProgramPostDateTime("NEST-2024-001"); ``` -------------------------------- ### Database Record Factory Methods and Table Access Source: https://context7.com/aoroberson/sigmanestplugin-sdk/llms.txt Demonstrates the creation of new record objects using factory methods provided by the ISTDatabase interface and accessing existing records and table utilities. ```APIDOC ## Database Record Factory Methods The `ISTDatabase` interface provides factory methods for creating new record objects and accessing database tables. ### Method `ISTDatabase` interface methods ### Endpoint N/A (Interface methods) ### Parameters None ### Request Body None ### Request Example ```csharp using SigmaNEST.Plugin; ISTDatabase database = /* obtained from SigmaNEST */; // Create new record instances IWORec workOrder = database.NewWORec(); IPartRec part = database.NewPartRec(); IProgramRec program = database.NewProgramRec(); IStockRec stock = database.NewStockRec(); IRemnantRec remnant = database.NewRemnantRec(); IMaterialRec material = database.NewMaterialRec(); IPIPRec pip = database.NewPIPRec(); // Part in Process ISIPRec sip = database.NewSIPRec(); // Sheet in Process IOrderRec order = database.NewOrderRec(); IOrderItemsRec orderItem = database.NewOrderItemsRec(); IGeoRec geo = database.NewGeoRec(); IAssocFileRec assocFile = database.NewAssocFileRec(); IAssocFileSetRec assocFileSet = database.NewAssocFileSetRec(); IStockReceivedRec stockReceived = database.NewStockReceivedRec(); IStockHistoryRec stockHistory = database.NewStockHistoryRec(); IArchivePacketRec archivePacket = database.NewArchivePacketRec(); IMaterialIACRec materialIAC = database.NewMaterialIACRec(); ITempRemnantNameRec tempRemnant = database.NewTempRemnantNameRec(); IToolAdapterRec toolAdapter = database.NewToolAdapterRec(); // Access existing records via properties IWORec currentWO = database.WORec; IPartRec currentPart = database.PartRec; IProgramRec currentProgram = database.ProgramRec; IStockRec currentStock = database.StockRec; // Access table utilities IStockTable stockTable = database.StockTable; IPIPTable pipTable = database.PIPTable; IPartTable partTable = database.PartTable; IProgramTable programTable = database.ProgramTable; IArchivePacketTable archiveTable = database.ArchivePacketTable; // Get stock record enumerator for iteration IStockRecEnumerator stockEnum = database.GetStockRecEnumerator(); ``` ### Response N/A (Code execution) ### Success Response (200) N/A ### Response Example N/A ``` -------------------------------- ### Database Settings and Utility Methods Source: https://context7.com/aoroberson/sigmanestplugin-sdk/llms.txt Configures database settings and utilizes utility methods for operations like updating quantities and generating sheet names. ```APIDOC ## Database Settings and Utility Methods ### Method `ISTDatabase` interface properties and methods ### Endpoint N/A (Interface properties and methods) ### Parameters None ### Request Body None ### Request Example ```csharp // Settings database.SheetNamePrefix = "SHT-"; database.MinCoilSize = 100.0; database.RemoveSheetsWithZeroOrNegativeQty = true; database.ExportToSimtrans = true; // Utility methods database.UpdateAllQuantityAvailable(); string nextSheet = database.GetNextSheetName("SHT-", ref counter); // Assuming 'counter' is a defined variable // Disconnect when done database.Disconnect(); ``` ### Response N/A (Code execution) ### Success Response (200) N/A ### Response Example N/A ``` -------------------------------- ### Adding Parts to a Group and Refreshing SigmaNEST View Source: https://context7.com/aoroberson/sigmanestplugin-sdk/llms.txt Demonstrates adding a part to a part group using an extension method and refreshing the SigmaNEST application view to reflect changes. The refresh operation updates the UI, including the tree view and part tiles. ```csharp // Add parts to a part group ISNPartGroupObj partGroup = /* obtained from SigmaNEST */; partGroup.AddPart(part); // Extension method handles COM interop // Refresh SigmaNEST view after changes snApp.Refresh(); // Refreshes tree view, tiles parts, auto-scales, reloads config ``` -------------------------------- ### Define UI Button Locations and Authorization Source: https://context7.com/aoroberson/sigmanestplugin-sdk/llms.txt Use the SNPluginTypes constants to map plugin buttons to specific areas of the SigmaNEST interface and define required authorization levels. ```csharp using SigmaNEST.Plugin; // Available button locations in SigmaNEST UI int[] locations = new int[] { SNPluginTypes.ButtonLocation_Default, // 0 - Default location SNPluginTypes.ButtonLocation_WorkSpace, // 1 - Workspace area SNPluginTypes.ButtonLocation_CAD, // 2 - CAD mode SNPluginTypes.ButtonLocation_NestingManual, // 3 - Manual nesting SNPluginTypes.ButtonLocation_NestingNC, // 4 - NC nesting SNPluginTypes.ButtonLocation_NestingDetail, // 5 - Nesting detail view SNPluginTypes.ButtonLocation_PartMode, // 6 - Part mode SNPluginTypes.ButtonLocation_PartModeDetail,// 7 - Part mode detail SNPluginTypes.ButtonLocation_Help, // 8 - Help menu SNPluginTypes.ButtonLocation_Modify // 9 - Modify menu }; // Authorization types int noAuth = SNPluginTypes.AuthorizationType_None; // 0 - No authorization int licenseAuth = SNPluginTypes.AuthorizationType_LicenseFile; // 1 - License file required ``` -------------------------------- ### Define Materials with IMaterialRec Source: https://context7.com/aoroberson/sigmanestplugin-sdk/llms.txt Covers material definition, including physical properties, cost parameters, and Item Attribute Code (IAC) configurations. ```csharp using SigmaNEST.Plugin; ISTDatabase database = /* obtained from SigmaNEST */; // Create a new material record IMaterialRec material = database.NewMaterialRec(); material.Material = "Stainless Steel 316L"; material.MatGroupName = "Stainless Steel"; // Cost per unit (both metric and imperial) material.Costmm = 0.0025; // Cost per sq mm material.Costin = 1.6129; // Cost per sq in // Density (for weight calculations) material.Densitymm = 0.000008; // g/mm³ material.Densityin = 0.289; // lb/in³ // Shear strength (for punching calculations) material.Shearmm = 0.515; // kN/mm² material.Shearin = 74.7; // ksi // Die clearance (for punch tooling) material.DieClearancemm = 0.15; // mm material.DieClearancein = 0.006; // inches // Machinability index (affects cutting speeds) material.MachinabilityIndex = 0.85; // Cost by thickness flag material.CostByThickness = true; // Use in CTL (Cut-to-Length) operations material.UseInCTL = 1; // Save to database if (material.WriteToDatabase()) { Console.WriteLine($"Material {material.Material} created"); } // Read existing material IMaterialRec existingMaterial = database.MaterialRec; existingMaterial.Material = "Stainless Steel 316L"; existingMaterial.KeySet = MaterialRecKeySetEnum.MaterialRecKeySet_MaterialType; if (existingMaterial.ReadFromDatabase()) { Console.WriteLine($"Material ID: {existingMaterial.MatID}"); Console.WriteLine($"Group: {existingMaterial.MatGroupName}"); Console.WriteLine($"Cost/sq mm: {existingMaterial.Costmm}"); Console.WriteLine($"Density: {existingMaterial.Densitymm} g/mm³"); } // Material IAC (Item Attribute Code) for specific configurations IMaterialIACRec iacRecord = database.NewMaterialIACRec(); iacRecord.IAC = "SS316L-3MM"; iacRecord.Description = "316L Stainless 3mm sheet"; iacRecord.MatID = existingMaterial.MatID; iacRecord.Thickness = 3.0; iacRecord.UnitCost = 0.0028; // Premium cost for this configuration iacRecord.WriteToDatabase(); ``` -------------------------------- ### Configure Database Settings Source: https://context7.com/aoroberson/sigmanestplugin-sdk/llms.txt Modify various settings on the ISTDatabase interface to control SigmaNEST's behavior. These include sheet name prefixes, minimum coil sizes, quantity removal logic, and export options. ```csharp // Settings database.SheetNamePrefix = "SHT-"; database.MinCoilSize = 100.0; database.RemoveSheetsWithZeroOrNegativeQty = true; database.ExportToSimtrans = true; ``` -------------------------------- ### Managing Tasks, Sheets, and Nests in SigmaNEST Source: https://context7.com/aoroberson/sigmanestplugin-sdk/llms.txt Illustrates how to retrieve and remove tasks, sheets, and nests from their respective lists within SigmaNEST. Ensure the object exists before attempting removal. ```csharp // Work with tasks list ISNTasksList tasksList = /* obtained from SigmaNEST */; ISNTaskObj foundTask = tasksList.GetByName("MainTask"); if (foundTask != null) { // Remove task from list foundTask.Remove(); } // Work with sheets list ISNSheetsList sheetsList = /* obtained from SigmaNEST */; ISNSheetObj sheet = sheetsList.GetByName("STEEL-001"); if (sheet != null) { sheet.Remove(); } // Work with nests list ISNNestsList nestsList = /* obtained from SigmaNEST */; ISNNestObj nest = nestsList.GetByName("NEST-001"); // Matches by ProgramName if (nest != null) { // Get the parts list associated with this nest ISNPartsList nestParts = nest.PartsList(); // Remove nest from list nest.Remove(); } ``` -------------------------------- ### Bulk Operations on Tool Records Source: https://context7.com/aoroberson/sigmanestplugin-sdk/llms.txt Performs bulk deletion and copying of tool records using a list of tool IDs. Requires an initialized ISTDatabase object. ```csharp // Bulk tool operations List toolIds = new List { 1001, 1002, 1003 }; database.DeleteToolsFromDB(toolIds); database.CopyToolsInDBase(toolIds, 2); // Make 2 copies ``` -------------------------------- ### Read and Display Tool Record Information Source: https://context7.com/aoroberson/sigmanestplugin-sdk/llms.txt Accesses and displays detailed information about a specific punch tool from the database using its ID. Ensure ISTDatabase and IToolRec are properly initialized. ```csharp using SigmaNEST.Plugin; ISTDatabase database = /* obtained from SigmaNEST */; // Access tool management IToolRec tool = /* obtained from tool enumerator */; // Read tool from database tool.ToolID = 1001; if (tool.ReadFromDatabase()) { // Basic tool information Console.WriteLine($"Tool: {tool.ToolNumber}"); Console.WriteLine($"Description: {tool.Descr}"); Console.WriteLine($"Type: {tool.ToolType}"); Console.WriteLine($"Shape: {tool.ToolShape}"); // Holder and turret Console.WriteLine($"Holder Size: {tool.HolderSize}"); Console.WriteLine($"Turret Type: {tool.TurretType}"); // Tool parameters (shape-specific dimensions) Console.WriteLine($"Param1 (Length): {tool.ToolParam1}"); Console.WriteLine($"Param2 (Width): {tool.ToolParam2}"); Console.WriteLine($"Param3 (Radius): {tool.ToolParam3}"); // Pressure and clearance Console.WriteLine($"Max Pressure: {tool.MaxToolPressure}"); Console.WriteLine($"Stripper Height: {tool.StripperHeight}"); // Rotation settings Console.WriteLine($"Key Angles: {tool.KeyAngles}"); Console.WriteLine($"Key Type: {tool.KeyType}"); Console.WriteLine($"Symmetry: {tool.Symmetry}"); // Life tracking Console.WriteLine($"Hit Count: {tool.HitCount}"); Console.WriteLine($"Life Count: {tool.LifeCount}"); Console.WriteLine($"Sharpenings: {tool.Sharpenings}"); // Capability and availability Console.WriteLine($"Capability: {tool.Capability}"); Console.WriteLine($"Available: {tool.Available}"); Console.WriteLine($"Die Management: {tool.DieMgmt}"); // Associated die if (tool.DieID > 0) { Console.WriteLine($"Associated Die ID: {tool.DieID}"); } // Tolerances if (tool.UseToolSpecificTol) { Console.WriteLine($"Positive Tol: {tool.PositiveTol}"); Console.WriteLine($"Negative Tol: {tool.NegativeTol}"); } } ``` -------------------------------- ### Bulk Update Tool Records with Specific Fields Source: https://context7.com/aoroberson/sigmanestplugin-sdk/llms.txt Updates multiple tool records in bulk, allowing selective modification of fields like HolderSize and Capability. Use boolean flags to control which fields are updated. ```csharp // Bulk update tools database.UpdateToolsInDB( toolIds, DoHolderSize: true, DoStripper: false, DoFaceType: false, DoToolUse: false, DoDieMgmt: false, DoKeyType: false, DoCapability: true, DoAvailable: true, DoCheckPressure: false, HolderSize: 25.4, Stripper: 0, FaceType: 0, ToolUse: 0, DieMgmtInt: 0, KeyTypeInt: 0, CapabilityName: "Standard", SNKeyAngles: "", Available: true, CheckPressure: false ); ``` -------------------------------- ### Check Part Existence and Status Source: https://context7.com/aoroberson/sigmanestplugin-sdk/llms.txt Provides methods to check if a part already exists in a work order, if it's currently in process, and to retrieve compatible machine IDs. These methods help in managing part workflows and resource allocation. ```csharp // Check if part exists if (part.DoesWOAndPartExist()) { Console.WriteLine("Part already exists in work order"); } ``` ```csharp // Check if part is in process string[] programs = null; if (part.IsInProcess(ref programs)) { Console.WriteLine($"Part is being processed in: {string.Join(", ", programs)}"); } ``` ```csharp // Get compatible machine IDs for the part List compatibleMachines = new List(); if (part.GetCompatibleMachineIDs(compatibleMachines)) { Console.WriteLine($"Compatible machines: {string.Join(", ", compatibleMachines)}"); } ``` -------------------------------- ### Access Database Paths Source: https://context7.com/aoroberson/sigmanestplugin-sdk/llms.txt Retrieve the data path and sheets path from the ISTDatabase interface. These paths are essential for file operations within SigmaNEST. ```csharp // Database paths string dataPath = database.DataPath; string sheetsPath = database.SheetsPath; ``` -------------------------------- ### Execute Utility Methods Source: https://context7.com/aoroberson/sigmanestplugin-sdk/llms.txt Call utility methods on ISTDatabase to perform common operations such as updating quantities or generating the next sheet name. Note that GetNextSheetName requires a counter variable. ```csharp // Utility methods database.UpdateAllQuantityAvailable(); int counter = 0; string nextSheet = database.GetNextSheetName("SHT-", ref counter); ``` -------------------------------- ### Working with Nested Parts in SigmaNEST Source: https://context7.com/aoroberson/sigmanestplugin-sdk/llms.txt Shows how to retrieve nested parts by name and remove all instances of a nested part by name from a SigmaNEST nested parts list. Note that 'GetByName' returns a list of matching nested parts. ```csharp // Work with nested parts ISNNestedPartsList nestedPartsList = /* obtained from nest object */; List nestedParts = nestedPartsList.GetByName("Bracket-A1"); foreach (var np in nestedParts) { Console.WriteLine($"Nested part ID: {np.NestedPartID}"); } // Remove all instances of a nested part by name nestedPartsList.RemoveByName("Bracket-A1"); ``` -------------------------------- ### Database Field Length Constraints and Paths Source: https://context7.com/aoroberson/sigmanestplugin-sdk/llms.txt Retrieves database field length constraints and paths for data and sheets. ```APIDOC ## Database Field Length Constraints and Paths ### Method `ISTDatabase` interface properties and methods ### Endpoint N/A (Interface properties and methods) ### Parameters None ### Request Body None ### Request Example ```csharp // Database field length constraints int maxWONumber = database.DBLenWONumber; int maxPartName = database.DBLenPartName; int maxSheetName = database.DBLenSheetName; int maxProgName = database.DBLenProgName; int maxQuoteNumber = database.DBLenQuoteNumber; int maxPartRemark = database.DBLenPartRemark; int maxDrawingNumber = database.DBLenDrawingNumber; // Get specific field length int fieldLen = database.GetFieldLength("Parts", "PartName"); // Database paths string dataPath = database.DataPath; string sheetsPath = database.SheetsPath; ``` ### Response N/A (Code execution) ### Success Response (200) N/A ### Response Example N/A ``` -------------------------------- ### Access Database Table Utilities Source: https://context7.com/aoroberson/sigmanestplugin-sdk/llms.txt Utilize table utility interfaces provided by ISTDatabase to manage and query records within specific database tables. These interfaces offer methods for table-level operations. ```csharp // Access table utilities IStockTable stockTable = database.StockTable; IPIPTable pipTable = database.PIPTable; IPartTable partTable = database.PartTable; IProgramTable programTable = database.ProgramTable; IArchivePacketTable archiveTable = database.ArchivePacketTable; ``` -------------------------------- ### Interface with Work Order Records using IWORec Source: https://context7.com/aoroberson/sigmanestplugin-sdk/llms.txt The IWORec interface allows for creating, reading, and updating work order data within the SigmaNEST database. ```csharp using SigmaNEST.Plugin; using System; // Assuming database is obtained from SigmaNEST ISTDatabase database = /* obtained from SigmaNEST */; // Create a new work order IWORec workOrder = database.NewWORec(); workOrder.WoNumber = "WO-2024-001"; workOrder.CustomerName = "ACME Manufacturing"; workOrder.CustomerID = 12345; workOrder.WODate = DateTime.Now; workOrder.OrderDate = DateTime.Now.AddDays(-7); // Set shipping information workOrder.ShipVia = "FedEx Ground"; workOrder.QuoteNumber = "Q-2024-0542"; workOrder.OrderNumber = "ORD-789456"; workOrder.CustomerPO = "PO-ACME-2024"; // Set pricing information workOrder.TotalPartCost = 5250.00; workOrder.TotalPartPrice = 7875.00; workOrder.ShippingCost = 150.00; workOrder.TaxRate = 0.08; workOrder.Tax = 630.00; workOrder.Markup = 1.5; workOrder.TotalScrap = 125.50; // Work order priority and status workOrder.WoPriority = 1; // 1 = High priority workOrder.OnHold = false; workOrder.StatusID = 1; // Active // Custom data fields workOrder.WOData1 = "Rush Order"; workOrder.WOData2 = "Assembly Line B"; workOrder.SpecialInstruction = "Handle with care - precision parts"; // Save to database if (workOrder.WriteToDatabase()) { Console.WriteLine($"Work order {workOrder.WoNumber} created successfully"); } // Read existing work order IWORec existingWO = database.WORec; existingWO.WoNumber = "WO-2024-001"; if (existingWO.ReadFromDatabase()) { // Get part quantities int qtyOrdered, qtyCompleted, qtyInProcess; existingWO.GetPartQuantities(out qtyOrdered, qtyCompleted, qtyInProcess); Console.WriteLine($"Ordered: {qtyOrdered}, Completed: {qtyCompleted}, In Process: {qtyInProcess}"); } // Change work order number if (existingWO.ChangeWONumber("WO-2024-001-REV")) { Console.WriteLine("Work order number updated"); } // Check for duplicate work orders if (database.CheckDupWO("WO-2024-002")) { Console.WriteLine("Work order already exists"); } ``` -------------------------------- ### Access Existing Database Records Source: https://context7.com/aoroberson/sigmanestplugin-sdk/llms.txt Access existing records directly through properties of the ISTDatabase interface. These properties provide access to the current or primary record of each type. ```csharp // Access existing records via properties IWORec currentWO = database.WORec; IPartRec currentPart = database.PartRec; IProgramRec currentProgram = database.ProgramRec; IStockRec currentStock = database.StockRec; ``` -------------------------------- ### Update Tool Record and Write to Database Source: https://context7.com/aoroberson/sigmanestplugin-sdk/llms.txt Modifies the hit count of a tool record and saves the changes back to the database. This is typically done after a tool has been used. ```csharp // Update tool hit count after use tool.HitCount += 500; tool.WriteToDatabase(); ``` -------------------------------- ### Disconnect from Database Source: https://context7.com/aoroberson/sigmanestplugin-sdk/llms.txt Call the Disconnect method on ISTDatabase when finished to properly close the database connection. This is crucial for releasing resources. ```csharp // Disconnect when done database.Disconnect(); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.