Projekt neu angelegt.

This commit is contained in:
Eugen Höglinger 2020-02-26 15:11:42 +01:00
commit 7cc63cb415
8 changed files with 555 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/

1
NXSigningResource.res Normal file
View File

@ -0,0 +1 @@
NXAUTHBLKNT NXAUTHBLKNT

179
Program.cs Normal file
View File

@ -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<member_row_data.value_count; v++)
{
lwWriteLine($"{tab[v]}: {member_row_data.values[v]}"); //lwWriteLine(String.Format("{0}: {1}", tab[v], member_row_data.values[v]));
}
lwWriteLine("----");
}
}
//--------------------------------------------------------------------
ufs.Ui.SetStatus($"Finishing SimpleTests");
}
}

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

93
SimpleTests.csproj Normal file
View File

@ -0,0 +1,93 @@
<?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>SimpleTests</RootNamespace>
<AssemblyName>SimpleTests</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>
<ItemGroup>
<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.Xml" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="NXSigningResource.res" />
<Content Include="ReadMe.txt" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<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>
<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>

25
SimpleTests.sln Normal file
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}") = "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