Hymma.Solidworks.Addins
2018.1.9
Prefix Reserved
See the version list below for details.
Requires NuGet 2.5 or higher.
dotnet add package Hymma.Solidworks.Addins --version 2018.1.9
NuGet\Install-Package Hymma.Solidworks.Addins -Version 2018.1.9
<PackageReference Include="Hymma.Solidworks.Addins" Version="2018.1.9" />
paket add Hymma.Solidworks.Addins --version 2018.1.9
#r "nuget: Hymma.Solidworks.Addins, 2018.1.9"
// Install Hymma.Solidworks.Addins as a Cake Addin #addin nuget:?package=Hymma.Solidworks.Addins&version=2018.1.9 // Install Hymma.Solidworks.Addins as a Cake Tool #tool nuget:?package=Hymma.Solidworks.Addins&version=2018.1.9
Overview
Solidworks is knows to be easy to use. On the one hand, it is a feature-rich software that has a solution for most users requirements. On the other hand, it has a powerful UI to deliver those features. This package is focused on the UI side of things. It allows you create native looking addins for solidworks easily.
The Issue with Solidworks API
Solidworks API is well documented by Dassault Systems. But since it uses COM you should use primitive types like string
to interact with it. For example there is no Bitmap
object, you should format, resize and save the image following strict regulations and pass the file path to solidworks.
Fortunately Hymma.Solidworks.Addins
wraps solidworks API functions in a proper object. To put it other words, it acts as a proxy between your code and solidworks API. It uses .NET Framework
objects and events
. In the example above, you would use a Bitmap
object and the framework will format, resize and save the image and pass the address to solidworks.
Note
Hymma.Solidworks.Addins
uses%localappdata%
as the main folder for saving and accessing files.
Addin UIs
Solidworks API names particular sections of the UI and we have stick to that naming convention. Below you can see some of the main (most used) UI elements in a Solidworks addin.
Terminology 😒
Command
It is a button in one of the menu bars or the tab bar. It sends a signal to Solidworks to start a Feature
. Commands
are housed in the Command Group
which in turn is in a Tab
and(or) Menu
item.
Feature
When users create a 3D object, cut from it or modify it in any form they have used a feature.
Property Manager Page
Each feature in solidworks has its own Property Manager Page
. A Property Manager Page
hosts UI elements that allow users to define the feature. For example when user clicks on the Hole
button a property manager page will pop up on the left side of the screen. And they define the diameter and depth of the Hole
.
Quick Start
Create and register the addin
- In Visual Studio create a new
Class Library
targeting.Net Framework 4.7.2
or.NET Framework 4.8
. You should run Visual Studio as Admin. - Rename
Class1
to something meaningfull. (Optional) - Right-click on your project file >
Manage Nuget Packages
> InstallHymma.Solidworks.Addins
. Version starts with the version of solidworks. (i.e. nuget package version 2018.x.xxx targets solidworks version 2018 and newer) - Right-click on your project file > Properties > Debug > Start External Program >
C:\Program Files\SOLIDWORKS Corp\SOLIDWORKS\SLDWORKS.exe.
(Or wherever your solidworks exe is located) - While in your project properties > Build > Check
Register For COM Interop
> Platform TargetAny CPU
- While in your project properties > Signing > from the drop down on the bottom (Choose a strong name key file) > New > Assign a name and ok
- Add below
Attrubutes
to you main class
[Addin("Title_Of_Your_Addin", AddinIcon = "addin_icon.png (Or addin_icon if using resx)", Description = "Description_For_Addin", LoadAtStartup = true)]
[Guid("C69637E8-D32E-4C73-A3F6-5DB5DD70E0EF")]
[ComVisible(true)]
To Create a GUID go to
Tools
menu inVisual Studio
selectCreate Guid
then select the5th
item and press theCopy button
and exit.
AddinIcon is the name of the image that is either marked as Embedded Resource or is added to your project using
Resources
section of your project properties window. If you decided to use an embedded resource you must provide the extension otherwise just the name of the file will suffice. 6. Inherit fromAddinMaker
>Ctrl+.
on your class andImpliment abstract class
At this stage you could build your project and register the addin to COM. To confirm that >Win key + R
> Regedit
> browse to 'HKEY_LOCAL_MACHINE\SOFTWARE\SolidWorks\AddIns'
and you should find a folder with named with the guid value you provided.
Alternatively you could run this code in powershell
dir -Path 'HKLM:\SOFTWARE\SolidWorks\AddIns'
Add UI elements to your addin
Once you implemented the abstract AddinMaker
into your class, you can define the UI object in public override AddinUserInterface GetUserInterFace()
.
We strongly recommend you clone this repo and open the project and then browse to QRify
project. This project uses the Hymma.Solidworks.Addins
to make a sample addin. It is heavily commented and demostrates how UI elements are defined.
Additionally, we have created an SVG file of the PlantUML diagrams for all the types in this package. You can find instructions under the classDiagrams
folder 📂 to eaither re-compile them or simply download the file.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET Framework | net48 is compatible. net481 was computed. |
-
.NETFramework 4.8
- Hymma.Solidworks.Interop (>= 2018.1.4)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Hymma.Solidworks.Addins:
Package | Downloads |
---|---|
Hymma.Solidworks.Addins.Fluent
Framework to create Addins for SOLIDWORKS 2018 and later using fluent API. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
2018.2.3 | 77 | 7/25/2024 |
2018.2.2 | 94 | 7/24/2024 |
2018.2.1 | 105 | 7/22/2024 |
2018.2.0 | 111 | 7/22/2024 |
2018.1.9 | 99 | 7/22/2024 |
2018.1.8 | 116 | 6/28/2024 |
2018.1.7 | 115 | 6/21/2024 |
2018.1.6 | 104 | 6/10/2024 |
2018.1.5 | 106 | 6/3/2024 |
2018.1.4 | 94 | 5/3/2024 |
2018.1.3 | 98 | 5/1/2024 |
2018.1.2 | 121 | 4/20/2024 |
2018.1.1 | 124 | 4/20/2024 |
2018.0.0 | 512 | 2/13/2022 |
changed the dependencies