Projektdateien hinzufügen.
This commit is contained in:
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Addin Type="Plugin">
|
||||
<ClassId>{3c81698c-7325-4de9-967a-c824767c025b}</ClassId>
|
||||
<ClientId>{3c81698c-7325-4de9-967a-c824767c025b}</ClientId>
|
||||
<DisplayName>MachinePlannerExportPlugin</DisplayName>
|
||||
<Description>a MachinePlannerExportPlugin</Description>
|
||||
<Assembly>MachinePlannerExportPlugin.dll</Assembly>
|
||||
</Addin>
|
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
|
||||
<assemblyIdentity name="MachinePlannerExportPlugin" version="1.0.0.0"></assemblyIdentity>
|
||||
<clrClass clsid="{3c81698c-7325-4de9-967a-c824767c025b}" progid="MachinePlannerExportPlugin.PluginServer" threadingModel="Both" name="MachinePlannerExportPlugin.PluginServer"></clrClass>
|
||||
<file name="MachinePlannerExportPlugin.dll" hashalg="SHA1"></file>
|
||||
</assembly>
|
@ -0,0 +1,85 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{A4FE3963-6962-427C-AB50-E1F156A4E1C9}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>MachinePlannerExportPlugin</RootNamespace>
|
||||
<AssemblyName>MachinePlannerExportPlugin</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<TargetFrameworkProfile />
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
</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>
|
||||
</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>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Autodesk.Forge.DesignAutomation.Inventor.Utils, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\Autodesk.Forge.DesignAutomation.Inventor.Utils.2.0.0\lib\netstandard2.0\Autodesk.Forge.DesignAutomation.Inventor.Utils.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="autodesk.inventor.interop, Version=23.0.0.0, Culture=neutral, PublicKeyToken=d84147f8b4276564, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||
<HintPath>$(PackagePath)\autodesk\autodesk.inventor.interop.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.IO.Compression" />
|
||||
<Reference Include="System.IO.Compression.FileSystem" />
|
||||
<Reference Include="System.IO.Log" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="PluginServer.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="SampleAutomation.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="MachinePlannerExportPlugin.X.manifest" />
|
||||
<Content Include="PackageContents.xml" />
|
||||
<Content Include="MachinePlannerExportPlugin.Inventor.addin">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- 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">
|
||||
<ItemGroup>
|
||||
<PluginBundle Include="$(TargetDir)*.*" />
|
||||
</ItemGroup>
|
||||
<Copy SourceFiles="$(ProjectDir)PackageContents.xml" DestinationFolder="$(TargetDir)..\Bundle\$(MSBuildProjectName).bundle" />
|
||||
<Copy SourceFiles="@(PluginBundle)" DestinationFolder="$(TargetDir)..\Bundle\$(MSBuildProjectName).bundle\Contents\" />
|
||||
<MakeDir Directories="$(ProjectDir)..\Output" />
|
||||
<ZipDirectory SourceDirectory="$(TargetDir)..\Bundle" DestinationFile="$(ProjectDir)..\Output\$(MSBuildProjectName).bundle.zip" Overwrite="true" />
|
||||
</Target>
|
||||
</Project>
|
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<ApplicationPackage SchemaVersion="1.0" Version="1.0" ProductCode="{3c81698c-7325-4de9-967a-c824767c025b}" Name="MachinePlannerExportPlugin" Description="MachinePlannerExportPluginPlugin Plugin" Author="Inventor IO Dev">
|
||||
<CompanyDetails Name="Autodesk, Inc" Phone="415.555.5555" Url="www.autodesk.com" Email="noreply@autodesk.com" />
|
||||
<Components>
|
||||
<!-- For Inventor Engine, "Platform" attribute must be "Inventor" -->
|
||||
<RuntimeRequirements OS="Win64" Platform="Inventor" />
|
||||
<!-- For Inventor Plug-in, the "Module" attribute must point to the .addin manifest file. -->
|
||||
<ComponentEntry LoadOnAutoCADStartup="False" LoadOnCommandInvocation="False"
|
||||
AppDescription="MachinePlannerExportPlugin App Package."
|
||||
ModuleName="./Contents/MachinePlannerExportPlugin.Inventor.addin" AppName="MachinePlannerExportPlugin"/>
|
||||
</Components>
|
||||
<EnvironmentVariables>
|
||||
</EnvironmentVariables>
|
||||
</ApplicationPackage>
|
@ -0,0 +1,61 @@
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
// Copyright (c) Autodesk, Inc. All rights reserved
|
||||
// Written by Forge Partner Development
|
||||
//
|
||||
// Permission to use, copy, modify, and distribute this software in
|
||||
// object code form for any purpose and without fee is hereby granted,
|
||||
// provided that the above copyright notice appears in all copies and
|
||||
// that both that copyright notice and the limited warranty and
|
||||
// restricted rights notice below appear in all supporting
|
||||
// documentation.
|
||||
//
|
||||
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
|
||||
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
|
||||
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
|
||||
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
|
||||
// UNINTERRUPTED OR ERROR FREE.
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using Inventor;
|
||||
|
||||
namespace MachinePlannerExportPlugin
|
||||
{
|
||||
[Guid("3c81698c-7325-4de9-967a-c824767c025b")]
|
||||
public class PluginServer : ApplicationAddInServer
|
||||
{
|
||||
// Inventor application object.
|
||||
private InventorServer _inventorServer;
|
||||
|
||||
public dynamic Automation { get; private set; }
|
||||
|
||||
public void Activate(ApplicationAddInSite addInSiteObject, bool firstTime)
|
||||
{
|
||||
Trace.TraceInformation(": MachinePlannerExportPlugin (" + Assembly.GetExecutingAssembly().GetName().Version.ToString(4) + "): initializing... ");
|
||||
|
||||
// Initialize AddIn members.
|
||||
_inventorServer = addInSiteObject.InventorServer;
|
||||
Automation = new SampleAutomation(_inventorServer);
|
||||
}
|
||||
|
||||
public void Deactivate()
|
||||
{
|
||||
Trace.TraceInformation(": MachinePlannerExportPlugin: deactivating... ");
|
||||
|
||||
// Release objects.
|
||||
Marshal.ReleaseComObject(_inventorServer);
|
||||
_inventorServer = null;
|
||||
|
||||
GC.Collect();
|
||||
GC.WaitForPendingFinalizers();
|
||||
}
|
||||
|
||||
public void ExecuteCommand(int CommandID)
|
||||
{
|
||||
// obsolete
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("MachinePlannerExportPlugin")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Autodesk Inc.")]
|
||||
[assembly: AssemblyProduct("MachinePlannerExportPlugin")]
|
||||
[assembly: AssemblyCopyright("Copyright © Autodesk Inc. 2019")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(true)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("f1c9d7e2-53a8-4e4e-af9e-931ca891715d")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
@ -0,0 +1,124 @@
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
// Copyright (c) Autodesk, Inc. All rights reserved
|
||||
// Written by Forge Partner Development
|
||||
//
|
||||
// Permission to use, copy, modify, and distribute this software in
|
||||
// object code form for any purpose and without fee is hereby granted,
|
||||
// provided that the above copyright notice appears in all copies and
|
||||
// that both that copyright notice and the limited warranty and
|
||||
// restricted rights notice below appear in all supporting
|
||||
// documentation.
|
||||
//
|
||||
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
|
||||
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
|
||||
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
|
||||
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
|
||||
// UNINTERRUPTED OR ERROR FREE.
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.InteropServices;
|
||||
using Autodesk.Forge.DesignAutomation.Inventor.Utils;
|
||||
using Autodesk.Forge.DesignAutomation.Inventor.Utils.Helpers;
|
||||
using Inventor;
|
||||
|
||||
namespace MachinePlannerExportPlugin
|
||||
{
|
||||
[ComVisible(true)]
|
||||
public class SampleAutomation
|
||||
{
|
||||
private readonly InventorServer inventorApplication;
|
||||
|
||||
public SampleAutomation(InventorServer inventorApp)
|
||||
{
|
||||
inventorApplication = inventorApp;
|
||||
}
|
||||
|
||||
public void Run(Document doc)
|
||||
{
|
||||
LogTrace("Run called with {0}", doc.DisplayName);
|
||||
}
|
||||
|
||||
public void RunWithArguments(Document doc, NameValueMap map)
|
||||
{
|
||||
LogTrace("Processing " + doc.FullFileName);
|
||||
|
||||
try
|
||||
{
|
||||
// Using NameValueMapExtension
|
||||
if (map.HasKey("intIndex"))
|
||||
{
|
||||
int intValue = map.AsInt("intIndex");
|
||||
LogTrace($"Value of intIndex is: {intValue}");
|
||||
}
|
||||
|
||||
if (map.HasKey("stringCollectionIndex"))
|
||||
{
|
||||
IEnumerable<string> strCollection = map.AsStringCollection("stringCollectionIndex");
|
||||
|
||||
foreach (string strValue in strCollection)
|
||||
{
|
||||
LogTrace($"String value is: {strValue}");
|
||||
}
|
||||
}
|
||||
|
||||
if (doc.DocumentType == DocumentTypeEnum.kPartDocumentObject)
|
||||
{
|
||||
using (new HeartBeat())
|
||||
{
|
||||
// TODO: handle the Inventor part here
|
||||
}
|
||||
}
|
||||
else if (doc.DocumentType == DocumentTypeEnum.kAssemblyDocumentObject) // Assembly.
|
||||
{
|
||||
using (new HeartBeat())
|
||||
{
|
||||
// TODO: handle the Inventor assembly here
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LogError("Processing failed. " + e.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
#region Logging utilities
|
||||
|
||||
/// <summary>
|
||||
/// Log message with 'trace' log level.
|
||||
/// </summary>
|
||||
private static void LogTrace(string format, params object[] args)
|
||||
{
|
||||
Trace.TraceInformation(format, args);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Log message with 'trace' log level.
|
||||
/// </summary>
|
||||
private static void LogTrace(string message)
|
||||
{
|
||||
Trace.TraceInformation(message);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Log message with 'error' log level.
|
||||
/// </summary>
|
||||
private static void LogError(string format, params object[] args)
|
||||
{
|
||||
Trace.TraceError(format, args);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Log message with 'error' log level.
|
||||
/// </summary>
|
||||
private static void LogError(string message)
|
||||
{
|
||||
Trace.TraceError(message);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Autodesk.Forge.DesignAutomation.Inventor.Utils" version="2.0.0" targetFramework="net48" />
|
||||
<package id="Newtonsoft.Json" version="13.0.3" targetFramework="net48" />
|
||||
</packages>
|
Reference in New Issue
Block a user