Add recursive component resolution for assembly dependencies

Assemblies reference other assemblies and parts internally; a flat
single-level copy into raw/ left Creo unable to load models ("Dati di
input non completi"). AssemblyComponentScanner heuristically extracts
component codes embedded as readable strings inside the otherwise
binary .asm files; each candidate is validated against the index (which
filters out scan noise), copied into raw/, and if it's itself an
assembly, queued for the same treatment until the whole tree resolves
to PRT leaves. PrtMancantiForm reports what was found and copied.

Also ignore Creo Distributed Batch job files (*.dxc).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
davideandClaude Sonnet 5 committed 2026-09-16 11:40:34 +02:00
1 parent 97d53a16dd
commit e56a3be5b4
4 files changed
+188 -2

No files matched your search

+68
View File
@@ -0,0 +1,68 @@
using System.Diagnostics;
namespace CadSearchGui;
/// <summary>Mostra l'esito della risoluzione ricorsiva dell'albero componenti: i PRT e i
/// sotto-assiemi trovati nell'indice e già copiati in "raw" a partire dagli assiemi iniziali.</summary>
public class PrtMancantiForm : Form
{
public PrtMancantiForm(List<(string Codice, string Tipo, string Percorso)> righe, int codiciNonTrovati, string cartellaRaw)
{
int numPrt = righe.Count(r => r.Tipo == "prt");
int numAsm = righe.Count(r => r.Tipo == "asm");
Text = "Componenti referenziati trovati";
ClientSize = new Size(720, 440);
StartPosition = FormStartPosition.CenterParent;
Font = new Font("Segoe UI", 9.5f);
var lblInfo = new Label
{
Dock = DockStyle.Top,
AutoSize = false,
Height = 44,
Padding = new Padding(12, 8, 12, 8),
Text = $"Copiati in \"{cartellaRaw}\": {numPrt} PRT e {numAsm} sotto-assiemi trovati nell'indice."
+ (codiciNonTrovati > 0
? $" {codiciNonTrovati} codici referenziati non corrispondono a nessun file indicizzato "
+ "(probabilmente disegni, o falsi positivi della scansione)."
: ""),
};
var grid = new DataGridView
{
Dock = DockStyle.Fill,
ReadOnly = true,
AllowUserToAddRows = false,
AllowUserToDeleteRows = false,
RowHeadersVisible = false,
SelectionMode = DataGridViewSelectionMode.FullRowSelect,
AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill,
};
grid.Columns.Add("codice", "Codice");
grid.Columns.Add("tipo", "Tipo");
grid.Columns.Add("percorso", "Percorso CAD");
grid.Columns["codice"]!.FillWeight = 20;
grid.Columns["tipo"]!.FillWeight = 10;
grid.Columns["percorso"]!.FillWeight = 70;
foreach (var (codice, tipo, percorso) in righe.OrderBy(r => r.Tipo).ThenBy(r => r.Codice))
{
grid.Rows.Add(codice, tipo, percorso);
}
var btnApriCartella = new Button { Text = "Apri cartella raw", Dock = DockStyle.Bottom, Height = 34 };
btnApriCartella.Click += (_, _) =>
{
try { Process.Start("explorer.exe", cartellaRaw); }
catch (Exception ex)
{
MessageBox.Show(this, $"Impossibile aprire Esplora risorse:\n{ex.Message}", "Errore",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
};
Controls.Add(grid);
Controls.Add(lblInfo);
Controls.Add(btnApriCartella);
}
}