Using Matlab functions in C# (2009 a)
1. Create a m-file function which encapsulate your subroutine, and save it to a folder: 2. Add this folder to Matlab path: in Matlab, File > SetPath 3. In MATLAB command window, type “deploytool” 4....
View ArticleCreate Splines using SolidWorks
SolidWorks generally has two sets of spline functions: The spline curve passes through the given points, i.e. spline fitting, (the curve S1 in the below figure) The given points are the control points...
View ArticleSolidWorks API: Loading/getting Simulation (CosmosWorks) object, failure?
As the SolidWorks 2009 Simulation API help states, the typical use of Cosmos Works begins by creating an instance of the ICosmosWorks class: private object iCosWorks = null; iCosWorks = (ICosmosWorks)...
View ArticleUsing C# to program CosmosWorks (Simulation)
Thanks go to Mahir Abrahim at General Atomics for his VB code, and I have converted it to equivalent C# code, with some additions of code from Simulation Manual. private CwAddincallback pCWAddin =...
View ArticleBind class object instances using PropertyGrid
1. Design a class with public field 2. Add attributes to the class and class members 3. Add a PropertyGrid control to a form, and set the “SelectedObject” Property to an instance of an object, that is...
View ArticleDriveBar control for C#
List All the drives on your machine using C# DriveBar control: 1. Drag a DriveBar control to the form, and it appeas like below: 2. Set the images for these drives: 3. Now the drive bar looks-just...
View ArticleVisualStudio 2010 Resources
Training Kit of Visual Studio 2010 Beta 2 and .NET Framework 4 Beta 2. Download it here. Visual Studio 2010 and .NET Framework 4 Training Course@ Channel 9 Windows 7 Online Training @ Channel 9...
View ArticleUsing Matlab functions in C# (2009b)
Matlab has changed a bit of the command “deploytool” in 2009a and 2009b. To see how to use matlab functions in 2009a, see my previous post here. In 2009b, this has changed a bit and this post will show...
View ArticleP/Invoke “DllNotFoundException” Exception
When calling C functions with InterOp Invoke, although the C DLL is already in the same folder as the target assembly, however, it is common to see the “DllNotFoundException” Exception. One of the most...
View ArticleSerialPort (Com1,2…) Communication in C#
Traditional programming Com1 and Com2 is generally tedious. With DotNet, this becomes trivial. In the toolbox, component tab, drag a SerialPort object onto the form: 1: static SerialPort ComPort = new...
View ArticleSolidWorks SN Editor
In case you have multiple SolidWorks serial number, say, some belong to the Educational License, and others are commercial keys. Or when you have multiple versions of SolidWorks installed...
View ArticleLING operation (union, intersect, except) and IEquatable
Consider you want to use the union, intersect or except methods using the LINQ feature: 1: public static VoronoiCell operator +(VoronoiCell A, VoronoiCell B) 2: { 3: VoronoiCell CombinedCell=new...
View ArticleKill a process inside VisualStudio.net
In developing some addin projects, the output assembly is hosed by another process, and sometimes, after code editing, you wish to recomplile the code and run it again. Unfortunately, you are not...
View ArticleProtected: Step-bystep C# Rhinocerous Tutorial
This post is password protected. You must visit the website and enter the password to continue reading. Posted in CAD, Dotnet/C#
View ArticleDeveloping AutoCAD addin/plugin using C#
In Visual Studio .NET, create a class library solution and project. Add Reference from the Project menu or Solution Explorer, browse to the \inc or \incx64 directory of the ObjectARX SDK and select...
View ArticleExtending Unigraphics NX using C# (I) Manual approach
Create a library project in C#; Add a class with 2 methods like below: class TestAtt { public static void Main() { Session theSession = Session.GetSession(); theSession.ListingWindow.Open();...
View ArticleExtending Unigraphics NX using C# (II) Using the Wizard
UgNX provides app wizard for developers to program the extension addins or plugins. The problem is that these wizards are not always successfully installed to the system. For instance, on my Windows 7...
View ArticleExtending Unigraphics NX using C# (III) Accessing entities
In Unigraphics, there are two files which are especially for programmers. The .net reference, in the folder %UGDir\UGDOC\html_files\nxopen_net_ref.chm, which contains all the class references; The .net...
View ArticleVS2010: “Type or namespace name could not be found”, problem & solution
I recently converted a VS2008 project to VS2010. An interesting probelm is that the project compiles and runs well in VS2008, however, when compiling in VS2010, errors occur: “The type or namespace...
View ArticleExtending Unigraphics NX using C# (IV) : Recording journals
The concept of journaling is similar as the recording macros in SolidWorks. Before clicking the record journal button on the Jorunal Toolbar: Do the following: Then start recording journals, click...
View Article