commit 7cc63cb415a190584c65e7aa99b44fabd1b82b5d Author: Eugen Höglinger Date: Wed Feb 26 15:11:42 2020 +0100 Projekt neu angelegt. diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5a5f80a --- /dev/null +++ b/.gitignore @@ -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/ diff --git a/NXSigningResource.res b/NXSigningResource.res new file mode 100644 index 0000000..1bc8a22 --- /dev/null +++ b/NXSigningResource.res @@ -0,0 +1 @@ +NXAUTHBLKNT NXAUTHBLKNT diff --git a/Program.cs b/Program.cs new file mode 100644 index 0000000..cce7bca --- /dev/null +++ b/Program.cs @@ -0,0 +1,179 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Diagnostics; +using NXOpen; +using NXOpen.UF; + +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; + + #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; + + private void lwWriteLine(string line) + { + lw.WriteLine(line); lw.Close(); lw.Open(); + } + + public void DoIt(string[] args) + { + ufs.Ui.SetStatus($"Starting SimpleTests"); + StartDebugger(); + + //-------------------------------------------------------------------- + + + Session theSession = Session.GetSession(); + Part dispPart = theSession.Parts.Display; + Part workPart = theSession.Parts.Work; + UFSession theUFSession = UFSession.GetUFSession(); + lw = theSession.ListingWindow; + lw.Open(); lw.Close(); lw.Open(); + int iColPartName = -1; + bool is_family_template; + theUFSession.Part.IsFamilyTemplate(dispPart.Tag, out is_family_template); + lwWriteLine(("Part Family Template: " + is_family_template.ToString())); + if ((is_family_template == false)) + { + return; + } + + int family_count; + Tag[] families; + theUFSession.Part.AskFamilies(dispPart.Tag, out family_count, out families); + lwWriteLine(("Part Families: " + family_count.ToString())); + 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; + lwWriteLine(("Part Family Name: " + family_data.name)); + + 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); + lwWriteLine($"Attribute {jj} : {attribute_data.name} = {attribute_data.value}"); + + tab.Add(jj, attribute_data.name); + } + } + + 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 v=0; v +// 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. +// +//------------------------------------------------------------------------------ + +namespace SimpleTests.Properties { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // 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() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [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; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/Properties/Resources.resx b/Properties/Resources.resx new file mode 100644 index 0000000..4fdb1b6 --- /dev/null +++ b/Properties/Resources.resx @@ -0,0 +1,101 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/ReadMe.txt b/ReadMe.txt new file mode 100644 index 0000000..c3e826e --- /dev/null +++ b/ReadMe.txt @@ -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 \ No newline at end of file diff --git a/SimpleTests.csproj b/SimpleTests.csproj new file mode 100644 index 0000000..9a5b7e5 --- /dev/null +++ b/SimpleTests.csproj @@ -0,0 +1,93 @@ + + + + Debug + AnyCPU + Library + Properties + SimpleTests + SimpleTests + v4.5 + {16F6EFC6-A76E-4BFB-A9D6-A197E117BA9E} + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + false + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + false + + + + False + $(UGII_BASE_DIR)\nxbin\managed\NXOpen.dll + False + + + False + $(UGII_BASE_DIR)\nxbin\managed\NXOpen.UF.dll + False + + + False + $(UGII_BASE_DIR)\nxbin\managed\NXOpen.Utilities.dll + False + + + False + $(UGII_BASE_DIR)\nxbin\managed\NXOpenUI.dll + False + + + + + + + + + + + + + True + True + Resources.resx + + + + + ResXFileCodeGenerator + Resources.Designer.cs + + + + + @echo off +set tgt=C:\CAD\Local_NX12_NXTC\NXOPEN +>NUL 2>&1 "%25UGII_BASE_DIR%25\NXBIN\SignDotNet.exe" "$(TargetPath)" +>NUL 2>&1 xcopy /I /F /Y "$(TargetDir)\*.*" "%25tgt%25\application\" +>NUL 2>&1 xcopy /I /F /Y "$(TargetDir)\BlockStyler\*.*" "%25tgt%25\application\" +>NUL 2>&1 xcopy /I /F /Y "$(TargetDir)\images\*.*" "%25tgt%25\application\" +echo $(TargetName) -^> %25tgt%25 +exit 0 + + + \ No newline at end of file diff --git a/SimpleTests.sln b/SimpleTests.sln new file mode 100644 index 0000000..afc6ab0 --- /dev/null +++ b/SimpleTests.sln @@ -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}") = "SimpleTests", "SimpleTests.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