Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
Empty file.
Binary file added .vs/Bounding Box/v17/.suo
Binary file not shown.
25 changes: 25 additions & 0 deletions Bounding Box.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.2.32630.192
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bounding Box", "Bounding Box\Bounding Box.csproj", "{50378D3F-7BC2-4DE1-8A70-425911D33F73}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{50378D3F-7BC2-4DE1-8A70-425911D33F73}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{50378D3F-7BC2-4DE1-8A70-425911D33F73}.Debug|Any CPU.Build.0 = Debug|Any CPU
{50378D3F-7BC2-4DE1-8A70-425911D33F73}.Release|Any CPU.ActiveCfg = Release|Any CPU
{50378D3F-7BC2-4DE1-8A70-425911D33F73}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {50F21616-631D-45C2-A2A9-24BF35E90852}
EndGlobalSection
EndGlobal
66 changes: 66 additions & 0 deletions Bounding Box/Bounding Box.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" 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>{50378D3F-7BC2-4DE1-8A70-425911D33F73}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Bounding_Box</RootNamespace>
<AssemblyName>Bounding Box</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</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>
<RegisterForComInterop>true</RegisterForComInterop>
</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="SolidWorks.Interop.sldworks">
<HintPath>..\..\..\..\..\..\Program Files\SOLIDWORKS Corp\SOLIDWORKS\SolidWorks.Interop.sldworks.dll</HintPath>
<EmbedInteropTypes>True</EmbedInteropTypes>
</Reference>
<Reference Include="SolidWorks.Interop.swcommands">
<HintPath>..\..\..\..\..\..\Program Files\SOLIDWORKS Corp\SOLIDWORKS\SolidWorks.Interop.swcommands.dll</HintPath>
<EmbedInteropTypes>True</EmbedInteropTypes>
</Reference>
<Reference Include="SolidWorks.Interop.swconst">
<HintPath>..\..\..\..\..\..\Program Files\SOLIDWORKS Corp\SOLIDWORKS\SolidWorks.Interop.swconst.dll</HintPath>
<EmbedInteropTypes>True</EmbedInteropTypes>
</Reference>
<Reference Include="SolidWorks.Interop.swpublished">
<HintPath>..\..\..\..\..\..\Program Files\SOLIDWORKS Corp\SOLIDWORKS\SolidWorks.Interop.swpublished.dll</HintPath>
<EmbedInteropTypes>True</EmbedInteropTypes>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="BoundingBox.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="PropertyManagerPage.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
7 changes: 7 additions & 0 deletions Bounding Box/Bounding Box.csproj.user
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
<StartAction>Program</StartAction>
<StartProgram>C:\Program Files\SOLIDWORKS Corp\SOLIDWORKS\SLDWORKS.exe</StartProgram>
</PropertyGroup>
</Project>
90 changes: 90 additions & 0 deletions Bounding Box/BoundingBox.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;

using SolidWorks.Interop.sldworks;
using SolidWorks.Interop.swcommands;
using SolidWorks.Interop.swconst;
using SolidWorks.Interop.swpublished;
using Microsoft.Win32;

namespace Bounding_Box
{
[ComVisible(true)]
[Guid("6929686F-1AC9-45A7-A08D-5D0436B0570B")]
public class BoundingBox : SwAddin
{
public SldWorks swApp;

private int swCookie;

public bool ConnectToSW(object ThisSW, int Cookie)
{

swApp = ThisSW as SldWorks;
swCookie = Cookie;

bool result = swApp.SetAddinCallbackInfo(0,this,swCookie);

int type;

type = swApp.AddMenu((int)swDocumentTypes_e.swDocNONE, "BoundingBoxAddin", -1);
type = swApp.AddMenu((int)swDocumentTypes_e.swDocPART, "BoundingBoxAddin", -1);
type = swApp.AddMenu((int)swDocumentTypes_e.swDocASSEMBLY, "BoundingBoxAddin", -1);

type = swApp.AddMenuItem4((int)swDocumentTypes_e.swDocPART, Cookie, "Show PMP Window@BoundingBoxAddin", -1, "ShowPMPWindow", "EnableMenu", "", "");
type = swApp.AddMenuItem4((int)swDocumentTypes_e.swDocASSEMBLY, Cookie, "Show PMP Window@BoundingBoxAddin", -1, "ShowPMPWindow", "EnableMenu", "", "");

return true;
}

public bool DisconnectFromSW()
{
return true;
}

public void ShowPMPWindow()
{

PropertyManagerPage pmp = new PropertyManagerPage(swApp);
pmp.Show();

}


#region SolidWorks Registration
[ComRegisterFunctionAttribute]
public static void RegisterFunction(Type t)
{


string path = String.Format(@"SOFTWARE\SolidWorks\AddIns\{0:b}", t.GUID);
RegistryKey key = Registry.LocalMachine.CreateSubKey(path);

key.SetValue(null, 1);
key.SetValue("Title", "Bounding Box");
key.SetValue("Description", "To get the Bounding Box dimension");




}

[ComUnregisterFunctionAttribute]
public static void UnregisterFunction(Type t)
{

string path = String.Format(@"SOFTWARE\SolidWorks\AddIns\{0:b}", t.GUID);
Registry.LocalMachine.DeleteSubKey(path);


}

#endregion


}
}
36 changes: 36 additions & 0 deletions Bounding Box/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
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("Bounding Box")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Bounding Box")]
[assembly: AssemblyCopyright("Copyright © 2022")]
[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(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("50378d3f-7bc2-4de1-8a70-425911d33f73")]

// 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")]
Loading