Projekt neu angelegt.

This commit is contained in:
Eugen Höglinger 2020-02-27 15:22:10 +01:00
commit fe7187755a
23 changed files with 3748 additions and 0 deletions

32
.gitignore vendored Normal file
View File

@ -0,0 +1,32 @@
#Ignore thumbnails created by Windows
Thumbs.db
#Ignore files built by Visual Studio
*.obj
*.exe
*.pdb
*.user
*.aps
*.pch
*.vspscc
*_i.c
*_p.c
*.ncb
*.suo
*.tlb
*.tlh
*.bak
*.cache
*.ilk
*.log
[Bb]in
[Dd]ebug*/
*.lib
*.sbr
obj/
[Rr]elease*/
_ReSharper*/
[Tt]est[Rr]esult*
.vs/
#Nuget packages folder
packages/

BIN
Daten/DatenAusSAP.xlsx Normal file

Binary file not shown.

BIN
Daten/PartFamily.xlsx Normal file

Binary file not shown.

Binary file not shown.

BIN
Daten/Update1.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 117 KiB

BIN
Daten/Update1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 575 KiB

BIN
Daten/Update2.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

BIN
Daten/Update2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

BIN
Daten/Update3.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

BIN
Daten/Update3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 KiB

106
Excel.cs Normal file
View File

@ -0,0 +1,106 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Office.Interop.Excel; // zusätzlich ist der Projektverweis auf COM -> Microsoft Excel xx-Objectlibrary
namespace UpdateStandardPartFamilyMemberUsageStatus
{
class Excel
{
public Excel(string fileName)
{
FileName = fileName;
}
//oExcelApp benötigt den kompletten Namensraum, da andernfalls der Compiler den Unterschied zwischen
//"Microsoft.Office.Interop.Excel.Application" und "System.Windows.Forms.Application" nicht erkennen kann
private Microsoft.Office.Interop.Excel.Application oExcelApp = new Microsoft.Office.Interop.Excel.Application();
private Workbook oWorkbook = null;
private Worksheet oWorksheet = null;
Range oRange;
private string FileName { set; get; }
public int RangeColumns { private set; get; }
public List<object> ReadColumn(string columnName)
{
int colNo = ColumnNumber(columnName); //Spaltennummer
List<object> columnValues = new List<object>();
// Datei öffnen und aktives Blatt und benutzten Bereich auswählen
oWorkbook = oExcelApp.Workbooks.Open(FileName);
oWorksheet = (Worksheet)oWorkbook.ActiveSheet;
oRange = oWorksheet.UsedRange;
RangeColumns = oRange.Rows.Count;
for (int i = 2; i < RangeColumns + 1; i++)
{
columnValues.Add((oRange.Cells[i, colNo] as Range).Value);
}
return columnValues;
}
public void WriteColumn(string columnName, List<object> columnValues, List<bool> changeStatus)
{
// Datei öffnen und aktives Blatt und benutzten Bereich auswählen
oWorkbook = oExcelApp.Workbooks.Open(FileName);
oWorksheet = (Worksheet)oWorkbook.ActiveSheet;
oRange = oWorksheet.UsedRange;
RangeColumns = oRange.Rows.Count;
int colValue = ColumnNumber(columnName);
//Save Columns
for (int i = 1; i < RangeColumns - 1; i++)
{
if (columnValues[i] != null & (bool)changeStatus[i] == true)
{
(oWorksheet.Cells[i + 2, colValue] as Range).Value = columnValues[i];
(oWorksheet.Cells[i + 2, colValue + 1] as Range).Value = "Yes";
}
}
oWorkbook.Save();
}
public void CloseSheet()
{
if (oWorkbook != null)
{
oWorkbook.Close();
}
}
public int ColumnNumber(string columnName)
{
//Range oRange;
// Datei öffnen und aktives Blatt und benutzten Bereich auswählen
oWorkbook = oExcelApp.Workbooks.Open(FileName);
oWorksheet = (Worksheet)oWorkbook.ActiveSheet;
oRange = oWorksheet.UsedRange;
int colomnNo = -1;
string test;
for (int i = 1; i < oRange.Columns.Count; i++)
{
test = oWorksheet.Cells[1, i].Value;
if (oWorksheet.Cells[1, i].Value != null)
{
if (oWorksheet.Cells[1, i].Value.ToString().ToLower() == columnName.ToLower())
{
colomnNo = i;
}
}
}
return colomnNo; //-1 wenn Spalte nicht gefunden wurde
}
}
}

210
Form1.Designer.cs generated Normal file
View File

@ -0,0 +1,210 @@
namespace UpdateStandardPartFamilyMemberUsageStatus
{
partial class Form1
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Vom Windows Form-Designer generierter Code
/// <summary>
/// Erforderliche Methode für die Designerunterstützung.
/// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
this.buttonReadSapColumn = new System.Windows.Forms.Button();
this.dataGridViewExcelSAP = new System.Windows.Forms.DataGridView();
this.Object = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.VStat = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Status = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.openFileDialogExcel = new System.Windows.Forms.OpenFileDialog();
this.dataGridViewExcelReuse = new System.Windows.Forms.DataGridView();
this.Item = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.StatusOld = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.StatusNew = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Save = new System.Windows.Forms.DataGridViewCheckBoxColumn();
this.buttonSaveChanges = new System.Windows.Forms.Button();
this.labelSap = new System.Windows.Forms.Label();
this.labelFamily = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.dataGridViewExcelSAP)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.dataGridViewExcelReuse)).BeginInit();
this.SuspendLayout();
//
// buttonReadSapColumn
//
this.buttonReadSapColumn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.buttonReadSapColumn.Location = new System.Drawing.Point(12, 415);
this.buttonReadSapColumn.Name = "buttonReadSapColumn";
this.buttonReadSapColumn.Size = new System.Drawing.Size(120, 23);
this.buttonReadSapColumn.TabIndex = 0;
this.buttonReadSapColumn.Text = "Read SAP Columns";
this.buttonReadSapColumn.UseVisualStyleBackColor = true;
this.buttonReadSapColumn.Click += new System.EventHandler(this.buttonReadSapColumn_Click);
//
// dataGridViewExcelSAP
//
this.dataGridViewExcelSAP.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)));
this.dataGridViewExcelSAP.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dataGridViewExcelSAP.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.Object,
this.VStat,
this.Status});
this.dataGridViewExcelSAP.Location = new System.Drawing.Point(12, 29);
this.dataGridViewExcelSAP.Name = "dataGridViewExcelSAP";
this.dataGridViewExcelSAP.Size = new System.Drawing.Size(345, 380);
this.dataGridViewExcelSAP.TabIndex = 1;
//
// Object
//
this.Object.HeaderText = "Object";
this.Object.Name = "Object";
this.Object.Resizable = System.Windows.Forms.DataGridViewTriState.False;
this.Object.Width = 80;
//
// VStat
//
this.VStat.HeaderText = "VStat";
this.VStat.Name = "VStat";
this.VStat.ReadOnly = true;
this.VStat.Width = 120;
//
// Status
//
this.Status.HeaderText = "Status";
this.Status.Name = "Status";
this.Status.ReadOnly = true;
this.Status.Width = 80;
//
// dataGridViewExcelReuse
//
this.dataGridViewExcelReuse.AllowUserToDeleteRows = false;
this.dataGridViewExcelReuse.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)));
this.dataGridViewExcelReuse.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dataGridViewExcelReuse.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.Item,
this.StatusOld,
this.StatusNew,
this.Save});
this.dataGridViewExcelReuse.Location = new System.Drawing.Point(363, 29);
this.dataGridViewExcelReuse.Name = "dataGridViewExcelReuse";
this.dataGridViewExcelReuse.Size = new System.Drawing.Size(425, 380);
this.dataGridViewExcelReuse.TabIndex = 2;
//
// Item
//
this.Item.HeaderText = "Item";
this.Item.Name = "Item";
this.Item.ReadOnly = true;
//
// StatusOld
//
this.StatusOld.HeaderText = "Status old";
this.StatusOld.Name = "StatusOld";
this.StatusOld.ReadOnly = true;
this.StatusOld.Width = 110;
//
// StatusNew
//
this.StatusNew.HeaderText = "Status New";
this.StatusNew.Name = "StatusNew";
this.StatusNew.ReadOnly = true;
this.StatusNew.Width = 110;
//
// Save
//
this.Save.HeaderText = "Save";
this.Save.Name = "Save";
this.Save.Resizable = System.Windows.Forms.DataGridViewTriState.False;
this.Save.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
this.Save.Width = 40;
//
// buttonSaveChanges
//
this.buttonSaveChanges.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.buttonSaveChanges.Enabled = false;
this.buttonSaveChanges.Location = new System.Drawing.Point(667, 415);
this.buttonSaveChanges.Name = "buttonSaveChanges";
this.buttonSaveChanges.Size = new System.Drawing.Size(120, 23);
this.buttonSaveChanges.TabIndex = 4;
this.buttonSaveChanges.Text = "Save Changes";
this.buttonSaveChanges.UseVisualStyleBackColor = true;
this.buttonSaveChanges.Click += new System.EventHandler(this.buttonSaveChanges_Click);
//
// labelSap
//
this.labelSap.AutoSize = true;
this.labelSap.Location = new System.Drawing.Point(13, 13);
this.labelSap.Name = "labelSap";
this.labelSap.Size = new System.Drawing.Size(63, 13);
this.labelSap.TabIndex = 6;
this.labelSap.Text = "SAP Values";
//
// labelFamily
//
this.labelFamily.AutoSize = true;
this.labelFamily.Location = new System.Drawing.Point(363, 12);
this.labelFamily.Name = "labelFamily";
this.labelFamily.Size = new System.Drawing.Size(93, 13);
this.labelFamily.TabIndex = 7;
this.labelFamily.Text = "Part Family Values";
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 450);
this.Controls.Add(this.labelFamily);
this.Controls.Add(this.labelSap);
this.Controls.Add(this.buttonSaveChanges);
this.Controls.Add(this.dataGridViewExcelReuse);
this.Controls.Add(this.dataGridViewExcelSAP);
this.Controls.Add(this.buttonReadSapColumn);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MinimumSize = new System.Drawing.Size(808, 481);
this.Name = "Form1";
this.Text = "::::: Update Standard Part Family Member Usage Status :::::";
this.Load += new System.EventHandler(this.Form1_Load);
((System.ComponentModel.ISupportInitialize)(this.dataGridViewExcelSAP)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.dataGridViewExcelReuse)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button buttonReadSapColumn;
private System.Windows.Forms.DataGridView dataGridViewExcelSAP;
private System.Windows.Forms.OpenFileDialog openFileDialogExcel;
private System.Windows.Forms.DataGridView dataGridViewExcelReuse;
private System.Windows.Forms.Button buttonSaveChanges;
private System.Windows.Forms.DataGridViewTextBoxColumn Item;
private System.Windows.Forms.DataGridViewTextBoxColumn StatusOld;
private System.Windows.Forms.DataGridViewTextBoxColumn StatusNew;
private System.Windows.Forms.DataGridViewCheckBoxColumn Save;
private System.Windows.Forms.Label labelSap;
private System.Windows.Forms.Label labelFamily;
private System.Windows.Forms.DataGridViewTextBoxColumn Object;
private System.Windows.Forms.DataGridViewTextBoxColumn VStat;
private System.Windows.Forms.DataGridViewTextBoxColumn Status;
}
}

354
Form1.cs Normal file
View File

@ -0,0 +1,354 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Diagnostics;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Microsoft.Office.Interop.Excel; // zusätzlich ist der Projektverweis auf COM -> Microsoft Excel xx-Objectlibrary
using NXOpen;
using NXOpen.UF;
namespace UpdateStandardPartFamilyMemberUsageStatus
{
public partial class Form1 : Form
{
#region Version und Copyright
// Version und Copyright
string programName = Path.GetFileNameWithoutExtension(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase); //Den Programmnamen auslesen
string programVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();
static object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false);
string copyright = ((AssemblyCopyrightAttribute)attributes[0]).Copyright;
string icon = System.Windows.Forms.Application.StartupPath + "\\Info.bmp";
//Assembly Datum und Zeit
static DateTime value = AssemblyDateTime();
string date = value.ToShortDateString();
string time = value.ToLongTimeString();
private static DateTime AssemblyDateTime()
{
var version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
var buildDateTime = new DateTime(2000, 1, 1).Add(new TimeSpan(TimeSpan.TicksPerDay * version.Build + TimeSpan.TicksPerSecond * 2 * version.Revision));
//Tage seit dem 1. Januar 2000 und Sekunden seit Mitternacht, (multiplizier mit 2 ergibt das Original)
return buildDateTime;
}
#endregion
#region Programm-Info
/// <summary>
/// Contains the name of the program file
/// </summary>
public static string ProgramName { set; get; }
/// <summary>
/// Contains the version of the program file
/// </summary>
public static string ProgramVersion { set; get; }
/// <summary>
/// Contains the copyright notice
/// </summary>
public static string Copyright { set; get; }
private void SetProgramInfo()
{
//Name, Version und Copyright setzen
ProgramName = programName;
ProgramVersion = programVersion;
Copyright = copyright;
}
#endregion
//Spalten Namen
const string colObject = "Objekt";
const string colVStatus = "VStat";
const string colItemNumber = "ItemNumber";
const string colStatus = "Status";
//int colomnStatus = 0;
int oRangeSap;
//int oRangeReuse;
//string fileNameReuse = "";
public static List<string> SapObject { set; get; }
public static List<string> SapVStat { set; get; }
public static List<string> PfItem { set; get; }
public static List<string> PfStatusOld { set; get; }
public static List<string> PfStatusNew { set; get; }
////oExcelApp benötigt den kompletten Namensraum, da andernfalls der Compiler den Unterschied zwischen
////"Microsoft.Office.Interop.Excel.Application" und "System.Windows.Forms.Application" nicht erkennen kann
//private Microsoft.Office.Interop.Excel.Application oExcelApp = new Microsoft.Office.Interop.Excel.Application();
//private Workbook oWorkbook = null;
//private Worksheet oWorksheet = null;
public Form1()
{
SetProgramInfo(); //Name, Version und Copyright setzen
InitializeComponent();
Session theSession = Session.GetSession();
Part dispPart = theSession.Parts.Display;
Part workPart = theSession.Parts.Work;
UFSession theUFSession = UFSession.GetUFSession();
lw = theSession.ListingWindow;
}
private void Form1_Load(object sender, EventArgs e)
{
this.MaximumSize = new Size(808, Screen.PrimaryScreen.Bounds.Height - 30); //Um 30 kleiner, weil sonst der untere Rand hinter der Start-Leiste verschwindet
this.Text = String.Concat("::::: ", ProgramName, " ::::: -- V", ProgramVersion, " - ", Copyright.Replace("Copyright ", ""), " --");
lwWriteLine("Selection Window opened.");
}
private void buttonReadSapColumn_Click(object sender, EventArgs e)
{
buttonReadSapColumn.Enabled = false;
if (!ReadSapColumns())
{
buttonReadSapColumn.Enabled = true;
return;
}
buttonReadSapColumn.Enabled = false;
ReadReuseColumns();
buttonSaveChanges.Enabled = true;
}
private void buttonSaveChanges_Click(object sender, EventArgs e)
{
List<object> columnItem = new List<object>();
List<object> columnStatusOld = new List<object>();
List<object> columnStatusNew = new List<object>();
buttonSaveChanges.Enabled = false;
//Alle Änderungen in eine Liste schreiben
int range = dataGridViewExcelReuse.Rows.Count;
while (dataGridViewExcelReuse.Rows[range - 1].Cells[0].Value == null)
{
range--; //Leerzeilen am Listenende entfernen
}
columnItem.Clear();
columnStatusOld.Clear();
columnStatusNew.Clear();
for (int i = 0; i < range; i++)
{
if ((bool)dataGridViewExcelReuse.Rows[i].Cells[3].Value & !String.IsNullOrEmpty(dataGridViewExcelReuse.Rows[i].Cells[2].Value.ToString()))
{
columnItem.Add(dataGridViewExcelReuse.Rows[i].Cells[0].Value);
columnStatusOld.Add(dataGridViewExcelReuse.Rows[i].Cells[1].Value);
columnStatusNew.Add(dataGridViewExcelReuse.Rows[i].Cells[2].Value);
}
}
Program.PfItem = columnItem;
Program.PfStatusOld = columnStatusOld;
Program.PfStatusNew = columnStatusNew;
CleanUpView();
this.Close();
}
private bool ReadSapColumns()
{
List<object> columnObject = new List<object>();
List<object> columnVstat = new List<object>();
List<object> columnStat = new List<object>();
//Datei öffnen
string fileName = ReadFileName("Browse SAP Excel File");
if (String.IsNullOrEmpty(fileName))
{
return false;
}
lwWriteLine($"SAP Excel sheet {fileName} selected.");
lwWriteLine("Determining 'usage status' values from the SAP Excel sheet.");
var excel = new Excel(fileName);
columnObject = excel.ReadColumn(colObject);
columnVstat = excel.ReadColumn(colVStatus);
columnStat = TranslateColumnValue(excel.RangeColumns, columnVstat);
oRangeSap = excel.RangeColumns;
dataGridViewExcelSAP.Rows.Add(excel.RangeColumns - 2); //Feld anlegen
for (int i = 0; i < excel.RangeColumns - 1; i++)
{
dataGridViewExcelSAP.Rows[i].Cells[0].Value = columnObject[i];
dataGridViewExcelSAP.Rows[i].Cells[1].Value = columnVstat[i];
dataGridViewExcelSAP.Rows[i].Cells[2].Value = columnStat[i];
}
excel.CloseSheet();
lwWriteLine("Showing determined and calculated values.");
return true;
}
private string ReadFileName(string title)
{
openFileDialogExcel = new OpenFileDialog();
openFileDialogExcel.Title = title;
openFileDialogExcel.DefaultExt = "xlsx";
openFileDialogExcel.Filter = "Excel file (*.xlsx)|*.xlsx|All files (*.*)|*.*";
openFileDialogExcel.FilterIndex = 1;
openFileDialogExcel.CheckFileExists = true;
openFileDialogExcel.CheckPathExists = true;
openFileDialogExcel.ShowDialog();
return openFileDialogExcel.FileName;
}
private void ReadReuseColumns()
{
List<object> columnItemNumber = new List<object>();
List<object> columnStatusOld = new List<object>();
List<object> columnStatusNew = new List<object>();
List<bool> changeStatus = new List<bool>();
lwWriteLine("Determining child members.");
//Datei holen
columnItemNumber = Program.PfItem;
columnStatusOld = Program.PfStatusOld;
columnStatusNew = MatchValues(columnItemNumber.Count, columnItemNumber, columnStatusOld);
changeStatus = MatchChangeStatus(columnStatusOld, columnStatusNew);
lwWriteLine("Determining old and new values and mark changes.");
dataGridViewExcelReuse.Rows.Add(columnItemNumber.Count - 1); //Feld anlegen
for (int i = 0; i < columnItemNumber.Count; i++)
{
dataGridViewExcelReuse.Rows[i].Cells[0].Value = columnItemNumber[i];
dataGridViewExcelReuse.Rows[i].Cells[1].Value = columnStatusOld[i];
dataGridViewExcelReuse.Rows[i].Cells[2].Value = columnStatusNew[i];
dataGridViewExcelReuse.Rows[i].Cells[3].Value = changeStatus[i];
}
lwWriteLine("Showing determined and calculated values.");
buttonSaveChanges.Enabled = true;
}
private List<object> TranslateColumnValue(int rangeColumns, List<object> columnVstat)
{
string temp = "";
List<object> newValues = new List<object>();
for (int i = 0; i < rangeColumns - 1; i++)
{
temp = columnVstat[i].ToString();
temp = temp.Remove(temp.LastIndexOf(")"));
temp = temp.Remove(0, temp.IndexOf("(") + 1);
newValues.Add(temp);
}
return newValues;
}
private List<object> MatchValues(int range, List<object> columnItemNumber, List<object> columnStatusOld)
{
List<object> columnStatusNew = new List<object>();
string value = "";
for (int i = 0; i < range; i++)
{
//Zeilenweise die 'ItemNumber' einlesen. Wenn der Wert nicht '<Kein Wert>' ist, dann in der SAP Liste Spalte 1 durchsuchen ob der Wert existiert. Existiert der Wert, dann den Wert aus 'Status' in 'StatusNew' schreiben und 'ChangeStatus' setzen.
if (columnItemNumber[i] != null)
{
if (columnItemNumber[i].ToString() != "<Kein Wert>")
{
value = DetermineValue(oRangeSap, columnItemNumber[i].ToString());
columnStatusNew.Add(String.Concat("\"", value, "\""));
if (columnStatusNew[i].ToString() == "\"\"")
{
columnStatusNew[i] = "";
}
}
else
{
columnStatusNew.Add(null);
}
}
else
{
columnStatusNew.Add(columnItemNumber[i]);
}
}
return columnStatusNew;
}
private List<bool> MatchChangeStatus(List<object> columnStatusOld, List<object> columnStatusNew)
{
List<bool> changeStatus = new List<bool>();
int range = columnStatusOld.Count;
for (int i = 0; i < range; i++)
{
if (columnStatusNew[i] == null || columnStatusNew[i].ToString() == "" || columnStatusOld[i].ToString() == columnStatusNew[i].ToString())
{
changeStatus.Add(false);
}
else
{
changeStatus.Add(true);
}
}
return changeStatus;
}
private string DetermineValue(int range, string value)
{
string newValue = "";
for (int j = 0; j < range - 1; j++)
{
if (dataGridViewExcelSAP.Rows[j].Cells[0].Value != null)
{
if (dataGridViewExcelSAP.Rows[j].Cells[0].Value.ToString() == value)
{
newValue = dataGridViewExcelSAP.Rows[j].Cells[2].Value.ToString();
break;
}
}
}
return newValue;
}
private void CleanUpView()
{
dataGridViewExcelSAP.Rows.Clear();
dataGridViewExcelReuse.Rows.Clear();
}
ListingWindow lw;
private void lwWriteLine(string line)
{
lw.Open(); lw.WriteLine(line); lw.Close();
}
}
}

2146
Form1.resx Normal file

File diff suppressed because it is too large Load Diff

1
NXSigningResource.res Normal file
View File

@ -0,0 +1 @@
NXAUTHBLKNT NXAUTHBLKNT

455
Program.cs Normal file
View File

@ -0,0 +1,455 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Windows.Forms;
using NXOpen;
using NXOpen.UF;
using UpdateStandardPartFamilyMemberUsageStatus;
using NXOpen.PartFamily;
public class Program
{
// class members
private static Session s;
private static UI ui;
private static UFSession ufs;
public static Program theProgram;
public static bool isDisposeCalled;
public static List<object> PfItem { set; get; }
public static List<object> PfStatusOld { set; get; }
public static List<object> PfStatusNew { set; get; }
#region UG...
//------------------------------------------------------------------------------
// Constructor
//------------------------------------------------------------------------------
public Program()
{
try
{
s = Session.GetSession();
ui = UI.GetUI();
ufs = UFSession.GetUFSession();
isDisposeCalled = false;
}
catch (NXOpen.NXException)
{
// ---- Enter your exception handling code here -----
// UI.GetUI().NXMessageBox.Show("Message", NXMessageBox.DialogType.Error, ex.Message);
}
}
//------------------------------------------------------------------------------
// Explicit Activation
// This entry point is used to activate the application explicitly
//------------------------------------------------------------------------------
[DebuggerStepThrough] public static int Main(string[] args)
{
int retValue = 0;
try
{
theProgram = new Program();
//TODO: Add your application code here
theProgram.DoIt(args);
theProgram.Dispose();
}
catch (NXOpen.NXException)
{
// ---- Enter your exception handling code here -----
}
return retValue;
}
//------------------------------------------------------------------------------
// Following method disposes all the class members
//------------------------------------------------------------------------------
[DebuggerStepThrough] public void Dispose()
{
try
{
if (isDisposeCalled == false)
{
//TODO: Add your application code here
}
isDisposeCalled = true;
}
catch (NXOpen.NXException)
{
// ---- Enter your exception handling code here -----
}
}
[DebuggerStepThrough] public static int GetUnloadOption(string arg)
{
//Unloads the image explicitly, via an unload dialog
//return System.Convert.ToInt32(Session.LibraryUnloadOption.Explicitly);
//Unloads the image immediately after execution within NX
return System.Convert.ToInt32(Session.LibraryUnloadOption.Immediately);
//Unloads the image when the NX session terminates
// return System.Convert.ToInt32(Session.LibraryUnloadOption.AtTermination);
}
[DebuggerStepThrough] public void StartDebugger()
{
if (!System.Diagnostics.Debugger.IsAttached)
System.Diagnostics.Debugger.Launch();
}
#endregion
ListingWindow lw;
int MemberCount { set; get; }
private void lwWriteLine(string line)
{
lw.Open(); lw.WriteLine(line); lw.Close();
}
public void DoIt(string[] args)
{
ufs.Ui.SetStatus($"Starting SimpleTests");
//StartDebugger();
//--------------------------------------------------------------------
List<object> pfItem = new List<object>();
List<object> pfStatusOld = new List<object>();
Session theSession = Session.GetSession();
Part dispPart = theSession.Parts.Display;
Part workPart = theSession.Parts.Work;
NXOpen.PartFamily.TemplateManager templateManager = workPart.NewPartFamilyTemplateManager();
UFSession theUFSession = UFSession.GetUFSession();
lw = theSession.ListingWindow;
int iColPartName = -1;
bool is_family_template;
theUFSession.Part.IsFamilyTemplate(dispPart.Tag, out is_family_template);
WriteHeader();
if ((is_family_template == false))
{
return;
}
int family_count;
Tag[] families;
theUFSession.Part.AskFamilies(dispPart.Tag, out family_count, out families);
int colPartNumber = -1;
int colUsageStatus = -1;
for (int ii = 0; (ii <= (family_count - 1)); ii++)
{
UFFam.FamilyData family_data;
theUFSession.Fam.AskFamilyData(families[ii], out family_data);
int member_count = family_data.member_count;
Hashtable tab = new Hashtable();
MemberCount = family_data.attribute_count + 1;
if ((iColPartName == -1))
{
for (int jj = 0; (jj <= (family_data.attribute_count - 1)); jj++)
{
UFFam.AttributeData attribute_data;
theUFSession.Fam.AskAttributeData(family_data.attributes[jj], out attribute_data);
tab.Add(jj, attribute_data.name);
if (attribute_data.name == "DB_PART_NO")
{
colPartNumber = jj;
}
if (attribute_data.name == "usage_status")
{
colUsageStatus = jj;
}
}
}
pfItem.Clear();
pfStatusOld.Clear();
for (int kk = 0; (kk <= (member_count - 1)); kk++)
{
UFFam.MemberData member_row_data;
theUFSession.Fam.AskMemberRowData(families[ii], kk, out member_row_data);
pfItem.Add(member_row_data.values[colPartNumber]);
pfStatusOld.Add(member_row_data.values[colUsageStatus]);
}
PfItem = pfItem;
PfStatusOld = pfStatusOld;
}
//Form mit den Tabellen aufrufen
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
WriteNewValus(); //Anzeigen welche Werte in die PartFamily zurückgeschrieben werden
//Werte in die PartFamily zurückschreiben
for (int ii = 0; (ii <= (family_count - 1)); ii++)
{
UFFam.FamilyData family_data;
theUFSession.Fam.AskFamilyData(families[ii], out family_data);
int member_count = family_data.member_count;
Hashtable tab = new Hashtable();
if ((iColPartName == -1))
{
for (int jj = 0; (jj <= (family_data.attribute_count - 1)); jj++)
{
UFFam.AttributeData attribute_data;
theUFSession.Fam.AskAttributeData(family_data.attributes[jj], out attribute_data);
tab.Add(jj, attribute_data.name);
if (attribute_data.name == "DB_PART_NO")
{
colPartNumber = jj;
}
if (attribute_data.name == "usage_status")
{
colUsageStatus = jj;
}
}
}
//Werte in die Kinderteile schreiben
WriteMembers(member_count, families, ii, colPartNumber, colUsageStatus);
//Part Speichern
theUFSession.Part.Save();
lwWriteLine(" ");
lwWriteLine("Part saved in the meantime.");
//Family Member aktualisieren
UpdateMembers();
templateManager.Dispose();
//Part Speichern
theUFSession.Part.Save();
lwWriteLine(" ");
lwWriteLine("Part saved.");
lwWriteLine(" ");
lwWriteLine("+-----------------------------------------+");
lwWriteLine("| Update process finished successfully!!! |");
lwWriteLine("+-----------------------------------------+");
}
//--------------------------------------------------------------------
ufs.Ui.SetStatus($"Finishing SimpleTests");
}
private void WriteHeader()
{
lwWriteLine("Update SAP usage status:");
lwWriteLine("------------------------");
lwWriteLine("The following 3 easy steps will update the 'usage status' in a part family master and its child members.");
lwWriteLine("1. Select button 'Read SAP Columns' and chooes the Excel sheet where the informatio are stored.");
lwWriteLine(" Attention: Make sure that the columns 'Object' and 'VStat' always exist.");
lwWriteLine("2. The system reads all necessary information from the Excel sheet, calculates the status and");
lwWriteLine(" displays them all in the left table. Please be patient, this will take some time.");
lwWriteLine(" The system then determines the existing child members with the saved status settings,");
lwWriteLine(" assigns them the new status values and displays all this information in the right table.");
lwWriteLine("3. All recognized changes are already selected in the right column. If you do not want to");
lwWriteLine(" accept all changes, you can deselect them here. If you are satisfied with the selection,");
lwWriteLine(" press the 'Save Changes' button. All changes will be applied, the child members will be");
lwWriteLine(" updated and the master part will be saved.");
lwWriteLine("That's it.");
lwWriteLine(" ");
lwWriteLine("The status of the individual steps are displayed below:");
lwWriteLine("-------------------------------------------------------");
}
private void WriteNewValus()
{
//Anzeigen welche Werte in die PartFamily zurückgeschrieben werden
lwWriteLine(" ");
lwWriteLine("The following changes will be made:");
lwWriteLine("-----------------------------------");
for (int i = 0; i < PfItem.Count; i++)
{
lwWriteLine(String.Concat(PfItem[i].ToString(), ": ", PfStatusOld[i].ToString(), " --> ", PfStatusNew[i].ToString()));
}
if (PfItem.Count == 0)
{
lwWriteLine("No changes are made.");
}
lwWriteLine(" ");
}
private void WriteValueToFamily(string dbPartNo, string value, int memberCount, int i)
{
NXOpen.Session theSession = NXOpen.Session.GetSession();
NXOpen.Part workPart = theSession.Parts.Work;
NXOpen.Part displayPart = theSession.Parts.Display;
// ----------------------------------------------
// Menu: Tools->Part Families...
// ----------------------------------------------
NXOpen.PartFamily.TemplateManager templateManager;
templateManager = workPart.NewPartFamilyTemplateManager();
templateManager.EditPartFamily();
NXOpen.PartFamily.FamilyAttribute familyAttribute1;
familyAttribute1 = templateManager.GetPartFamilyAttribute(NXOpen.PartFamily.FamilyAttribute.AttrType.Name, "DB_PART_NO");
NXOpen.PartFamily.FamilyAttribute familyAttribute2;
familyAttribute2 = templateManager.GetPartFamilyAttribute(NXOpen.PartFamily.FamilyAttribute.AttrType.Name, "OS_PART_NAME");
NXOpen.PartFamily.FamilyAttribute[] keyattrs1 = new NXOpen.PartFamily.FamilyAttribute[2];
keyattrs1[0] = familyAttribute1;
keyattrs1[1] = familyAttribute2;
string[] attrvalues1 = new string[2];
attrvalues1[0] = dbPartNo;
attrvalues1[1] = dbPartNo;
NXOpen.PartFamily.MemberIdentifier memberIdentifier;
memberIdentifier = templateManager.CreateMemberIdentifier(keyattrs1, attrvalues1, "ETC4_DesignSTD");
NXOpen.PartFamily.InstanceDefinition instanceDefinition;
instanceDefinition = templateManager.GetInstanceDefinitionUsingMemberIdentifier(memberIdentifier);
memberIdentifier.Dispose();
NXOpen.PartFamily.FamilyAttribute familyAttribute3;
familyAttribute3 = templateManager.GetPartFamilyAttribute(NXOpen.PartFamily.FamilyAttribute.AttrType.Expression, "usage_status");
instanceDefinition.SetValueOfAttribute(familyAttribute3, value);
instanceDefinition.Dispose();
templateManager.SavePartFamily();
templateManager.Dispose();
}
private void WriteMembers(int member_count, Tag[] families, int ii, int colPartNumber, int colUsageStatus)
{
//Werte in die Kinderteile schreiben
NXOpen.Session theSession = NXOpen.Session.GetSession();
NXOpen.Part workPart = theSession.Parts.Work;
NXOpen.Part displayPart = theSession.Parts.Display;
UFSession theUFSession = UFSession.GetUFSession();
int family_count;
theUFSession.Part.AskFamilies(displayPart.Tag, out family_count, out families);
lwWriteLine(" ");
lwWriteLine("Writing values into part family:");
lwWriteLine("--------------------------------");
for (int kk = 0; (kk <= (member_count - 1)); kk++)
{
UFFam.MemberData member_row_data;
theUFSession.Fam.AskMemberRowData(families[ii], kk, out member_row_data);
for (int i = 0; i < PfItem.Count; i++)
{
if (member_row_data.values[colPartNumber] == PfItem[i].ToString())
{
if (PfStatusNew[i].ToString().Contains("\""))
{
WriteValueToFamily(PfItem[i].ToString(), PfStatusNew[i].ToString(), MemberCount, i);
}
else
{
WriteValueToFamily(PfItem[i].ToString(), String.Concat("\"", PfStatusNew[i].ToString(), "\""), MemberCount, i);
}
lwWriteLine($"{PfItem[i]}: Value {member_row_data.values[colUsageStatus]} was written successfully.");
}
}
}
lwWriteLine(" ");
lwWriteLine("Part family saved.");
}
private void UpdateMembers()
{
lwWriteLine(" ");
lwWriteLine("Update and save all members:");
lwWriteLine("----------------------------");
NXOpen.Session theSession = NXOpen.Session.GetSession();
NXOpen.Part workPart = theSession.Parts.Work;
NXOpen.Part displayPart = theSession.Parts.Display;
// ----------------------------------------------
// Menu: Tools->Part Families...
// ----------------------------------------------
NXOpen.Session.UndoMarkId markId1;
markId1 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Visible, "Start");
NXOpen.PartFamily.TemplateManager templateManager1;
templateManager1 = workPart.NewPartFamilyTemplateManager();
theSession.SetUndoMarkName(markId1, "Part Families Dialog");
NXOpen.Session.UndoMarkId markId2;
markId2 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Invisible, "Enter Spreadsheet");
templateManager1.EditPartFamily();
NXOpen.PartFamily.FamilyAttribute[] familyAttribute1 = new NXOpen.PartFamily.FamilyAttribute[PfItem.Count];
NXOpen.PartFamily.FamilyAttribute[] familyAttribute2 = new NXOpen.PartFamily.FamilyAttribute[PfItem.Count];
NXOpen.PartFamily.MemberIdentifier[] memberIdentifier1 = new NXOpen.PartFamily.MemberIdentifier[PfItem.Count];
NXOpen.PartFamily.InstanceDefinition[] instanceDefinition1 = new NXOpen.PartFamily.InstanceDefinition[PfItem.Count];
for (int i = 0; i < PfItem.Count; i++)
{
// ----------------------------------------------
// Dialog Begin Part Family Warning
// ----------------------------------------------
familyAttribute1[i] = templateManager1.GetPartFamilyAttribute(NXOpen.PartFamily.FamilyAttribute.AttrType.Name, "DB_PART_NO");
/*NXOpen.PartFamily.FamilyAttribute familyAttribute2*/;
familyAttribute2[i] = templateManager1.GetPartFamilyAttribute(NXOpen.PartFamily.FamilyAttribute.AttrType.Name, "OS_PART_NAME");
NXOpen.PartFamily.FamilyAttribute[] keyattrs1 = new NXOpen.PartFamily.FamilyAttribute[2];
keyattrs1[0] = familyAttribute1[i];
keyattrs1[1] = familyAttribute2[i];
string[] attrvalues1 = new string[2];
attrvalues1[0] = PfItem[i].ToString();
attrvalues1[1] = PfItem[i].ToString();
memberIdentifier1[i] = templateManager1.CreateMemberIdentifier(keyattrs1, attrvalues1, "ETC4_DesignSTD");
instanceDefinition1[i] = templateManager1.GetInstanceDefinitionUsingMemberIdentifier(memberIdentifier1[i]);
memberIdentifier1[i].Dispose();
}
NXOpen.PartFamily.InstanceDefinition[] instdefstoupdate1 = new NXOpen.PartFamily.InstanceDefinition[PfItem.Count];
for (int i = 0; i < PfItem.Count; i++)
{
instdefstoupdate1[i] = instanceDefinition1[i];
}
int[] errorcodes1;
errorcodes1 = templateManager1.SaveFamilyAndUpdateMembers(false, instdefstoupdate1);
for (int i = 0; i < PfItem.Count; i++)
{
instanceDefinition1[i].Dispose();
lwWriteLine($"{PfItem[i]} was updated and saved successfully.");
}
lwWriteLine(" ");
lwWriteLine("All change were done successfully.");
}
}

View File

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// Allgemeine Informationen über eine Assembly werden über die folgenden
// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
// die einer Assembly zugeordnet sind.
[assembly: AssemblyTitle("Update Standard Part Family Member Usage Status")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Update Standard Part Family Member Usage Status")]
[assembly: AssemblyCopyright("Copyright © 2019 by Eugen Höglinger")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Durch Festlegen von ComVisible auf FALSE werden die Typen in dieser Assembly
// für COM-Komponenten unsichtbar. Wenn Sie auf einen Typ in dieser Assembly von
// COM aus zugreifen müssen, sollten Sie das ComVisible-Attribut für diesen Typ auf "True" festlegen.
[assembly: ComVisible(false)]
// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird
[assembly: Guid("4f64cc57-8239-4cdf-a266-4ce88f65b0e1")]
// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
//
// Hauptversion
// Nebenversion
// Buildnummer
// Revision
//
// Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden,
// übernehmen, indem Sie "*" eingeben:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.*")]
//[assembly: AssemblyFileVersion("1.0.0.0")]

63
Properties/Resources.Designer.cs generated Normal file
View File

@ -0,0 +1,63 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace SimpleTests.Properties {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SimpleTests.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
}
}

101
Properties/Resources.resx Normal file
View File

@ -0,0 +1,101 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 1.3
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">1.3</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1">this is my long string</data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
[base64 mime encoded serialized .NET Framework object]
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
[base64 mime encoded string representing a byte array form of the .NET Framework object]
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>1.3</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

61
ReadMe.txt Normal file
View File

@ -0,0 +1,61 @@
========================================================================
NX_OPEN : SimpleTests Project Overview
========================================================================
NX12 Open C# Wizard has created this SimpleTests project for you as a starting point.
This file contains a summary of what you will find in each of the files that make up your project.
SimpleTests.vbproj
This is the main project file for projects generated using an Application Wizard.
It contains information about the version of the product that generated the file, and
information about the platforms, configurations, and project features selected with the
Application Wizard.
Executing User Exit Functions
-----------------------------
For execution of each user exit, corresponding Environment Variable need to be set with the full path
of the dll.
The following environment variables are used to point to user exit executables.
Alternatively a single Environment Variable USER_DEFAULT can be set for all the Entry point.
User Exit Environment Variable Entry Point
Open Part USER_RETRIEVE ufget
New Part USER_CREATE ufcre
Save Part USER_FILE ufput
Save Part As USER_SAVEAS ufsvas
Import Part USER_MERGE ufmrg
Execute GRIP Program USER_GRIP ufgrp
Add Existing Part USER_RCOMP ufrcp
Export Part USER_FCOMP uffcp
Component Where-used USER_WHERE_USED ufusd
Plot File USER_PLOT ufplt
2D Analysis Using Curves USER_AREAPROPCRV uf2da
User Defined Symbols USER_UDSYMBOL ufuds
Open CLSF USER_CLS_OPEN ufclso
Save CLSF USER_CLS_SAVE ufclss
Rename CLSF USER_CLS_RENAME ufclsr
Generate CLF USER_CL_GEN ufclg
Postprocess CLSF USER_POST ufpost
Create Component USER_CCOMP ufccp
Change Displayed Part USER_CDISP ufcdp
Change Work Part USER_CWORK ufcwp
Remove Component USER_DCOMP ufdcp
Reposition Component USER_MCOMP ufmcp
Substitute Component Out USER_SCOMP1 ufscpo
Substitute Component In USER_SCOMP2 ufscpi
Open Spreadsheet USER_SPRD_OPN ufspop
Close Spreadsheet USER_SPRD_CLO ufspcl
Update Spreadsheet USER_SPRD_UPD ufspup
Finish Updating Spreadsheet USER_SPRD_UPF ufspuf
Replace Reference Set USER_RRSET ufrrs
Rename Component USER_NCOMP ufncp
NX Startup USER_STARTUP ufsta
Access Genius Library Management System USER_GENIUS ufgen
Execute Debug GRIP USER_GRIPDEBUG ufgrpd
Execute User Function USER_UFUN ufufun
Initialize new operation USER_CREATE_OPER ufnopr
Re-initialize an existing operation USER_CREATE_OPER ufnopr
CAM Startup USER_CAM_STARTUP ufcams

BIN
Update1.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 117 KiB

View File

@ -0,0 +1,158 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>UpdateStandardPartFamilyMemberUsageStatus</RootNamespace>
<AssemblyName>UpdateStandardPartFamilyMemberUsageStatus</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<ProjectGuid>{16F6EFC6-A76E-4BFB-A9D6-A197E117BA9E}</ProjectGuid>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>Update1.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.CSharp" />
<Reference Include="NXOpen, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(UGII_BASE_DIR)\nxbin\managed\NXOpen.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="NXOpen.UF, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(UGII_BASE_DIR)\nxbin\managed\NXOpen.UF.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="NXOpen.Utilities, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(UGII_BASE_DIR)\nxbin\managed\NXOpen.Utilities.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="NXOpenUI, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(UGII_BASE_DIR)\nxbin\managed\NXOpenUI.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Content Include="Update1.ico" />
<EmbeddedResource Include="NXSigningResource.res" />
<Content Include="ReadMe.txt" />
</ItemGroup>
<ItemGroup>
<Compile Include="Excel.cs" />
<Compile Include="Form1.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Form1.Designer.cs">
<DependentUpon>Form1.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="Form1.resx">
<DependentUpon>Form1.cs</DependentUpon>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<COMReference Include="Microsoft.Office.Core">
<Guid>{2DF8D04C-5BFA-101B-BDE5-00AA0044DE52}</Guid>
<VersionMajor>2</VersionMajor>
<VersionMinor>8</VersionMinor>
<Lcid>0</Lcid>
<WrapperTool>primary</WrapperTool>
<Isolated>False</Isolated>
<EmbedInteropTypes>True</EmbedInteropTypes>
</COMReference>
<COMReference Include="Microsoft.Office.Interop.Excel">
<Guid>{00020813-0000-0000-C000-000000000046}</Guid>
<VersionMajor>1</VersionMajor>
<VersionMinor>9</VersionMinor>
<Lcid>0</Lcid>
<WrapperTool>primary</WrapperTool>
<Isolated>False</Isolated>
<EmbedInteropTypes>True</EmbedInteropTypes>
</COMReference>
<COMReference Include="Office">
<Guid>{21A56163-9798-4AB6-B550-56238ADBACFB}</Guid>
<VersionMajor>4</VersionMajor>
<VersionMinor>0</VersionMinor>
<Lcid>0</Lcid>
<WrapperTool>primary</WrapperTool>
<Isolated>False</Isolated>
<EmbedInteropTypes>True</EmbedInteropTypes>
</COMReference>
<COMReference Include="stdole">
<Guid>{00020430-0000-0000-C000-000000000046}</Guid>
<VersionMajor>2</VersionMajor>
<VersionMinor>0</VersionMinor>
<Lcid>0</Lcid>
<WrapperTool>primary</WrapperTool>
<Isolated>False</Isolated>
<EmbedInteropTypes>True</EmbedInteropTypes>
</COMReference>
<COMReference Include="VBIDE">
<Guid>{0002E157-0000-0000-C000-000000000046}</Guid>
<VersionMajor>5</VersionMajor>
<VersionMinor>3</VersionMinor>
<Lcid>0</Lcid>
<WrapperTool>primary</WrapperTool>
<Isolated>False</Isolated>
<EmbedInteropTypes>True</EmbedInteropTypes>
</COMReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>@echo off
set tgt=C:\CAD\Local_NX12_NXTC\NXOPEN
&gt;NUL 2&gt;&amp;1 "%25UGII_BASE_DIR%25\NXBIN\SignDotNet.exe" "$(TargetPath)"
&gt;NUL 2&gt;&amp;1 xcopy /I /F /Y "$(TargetDir)\*.*" "%25tgt%25\application\"
&gt;NUL 2&gt;&amp;1 xcopy /I /F /Y "$(TargetDir)\BlockStyler\*.*" "%25tgt%25\application\"
&gt;NUL 2&gt;&amp;1 xcopy /I /F /Y "$(TargetDir)\images\*.*" "%25tgt%25\application\"
echo $(TargetName) -^&gt; %25tgt%25
exit 0</PostBuildEvent>
</PropertyGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29411.108
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UpdateStandardPartFamilyMemberUsageStatus", "UpdateStandardPartFamilyMemberUsageStatus.csproj", "{16F6EFC6-A76E-4BFB-A9D6-A197E117BA9E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{16F6EFC6-A76E-4BFB-A9D6-A197E117BA9E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{16F6EFC6-A76E-4BFB-A9D6-A197E117BA9E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{16F6EFC6-A76E-4BFB-A9D6-A197E117BA9E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{16F6EFC6-A76E-4BFB-A9D6-A197E117BA9E}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {EE98AB37-3C3F-47B1-BD40-8A6C4F866DFC}
EndGlobalSection
EndGlobal