IN-Motion Fourbar Mechanism IN-Motion Header

IN-Motion Released for Autodesk Inventor 2010

Tagged Under : , , , , , , , ,

Posted in Autodesk Inventor, CAD, Entrepreneurship, IN-Motion, Inventor Customization, Personal, Visual C# by rajeev

We have released IN-Motion for Autodesk Inventor 2010. IN-Motion is an affordable Motion and Dynamic Simulator for Autodesk Inventor. We had launched IN-Motion for 2009 version of Inventor earlier this year. Autodesk has certified IN-Motion to work with Inventor 2009 and 2010. We are also developing for 2011 version and would be available soon after Autodesk launches its product line for 2011 versions. For a detailed info on IN-Motion, check out IN-Motion 2009 blog entry. Download IN-Motion with 30 days free trial and once you are satisfied with it, you can buy a license for lifetime at just US$ 200.

A screenshot of IN-Motion running on Autodesk Inventor 2010 is below.

Please keep checking this blog for more updates and tutorials on IN-Motion and also Dynamic Simulation using Autodesk Inventor. If you have any query, please email to the following

Aik-Siong Koh (askoh@askoh.com) and Rajeev Lochan (rajeev@ar-cad.com)

Happy IN-Motioning :)

IN-Motion Launched for Autodesk Inventor 2009

Tagged Under : , , , , , ,

Posted in Autodesk Inventor, CAD, Entrepreneurship, IN-Motion, Inventor Customization, Personal, Visual C# by rajeev

Update: IN-Motion Released and Certified for Autodesk Inventor 2010.

Yes !! Finally we made it. After the extensive development of IN-Motion, we have launched it for Autodesk Inventor 2009. View Full Press Release. Download IN-Motion with 30 free trials

IN-Motion is an inexpensive Motion and Dynamic Simulation Addin for Autodesk Inventor. It has been certified by Autodesk to work with Autodesk Inventor 2009 version. We are in the process of developing IN-Motion for Autodesk Inventor 2010 and it should be released soonIN-Motion Released and Certified for Autodesk Inventor 2010 .

Check out the video below to get an overview of IN-Motion.

The Main Features of IN-Motion are:

IN-Motion is packed with all the above mentioned features and is available for download with 30 free trials. Once you are satisfied with our Addin, you can buy a lifetime license for just US$ 200.

If you are an Autodesk Inventor user and wanted to learn Dynamic Simulation, we have free online video tutorials at http://www.ar-cad.com/in-motion/tutorials/index.html

Please keep checking this blog for more updates and tutorials on IN-Motion and also Dynamic Simulation using Autodesk Inventor. If you have any query, please email to the following

Aik-Siong Koh (askoh@askoh.com) and Rajeev Lochan (rajeev@ar-cad.com)

Happy IN-Motioning :)

Update: IN-Motion Released and Certified for Autodesk Inventor 2010.

Happy New Year 2010 !!!!

Posted in Miscellaneous, Personal, iit delhi by rajeev

What a great year 2009 was to me. I thoroughly enjoyed the roller-coaster ride.

  • It started off with development of IN-Motion (Motion and Dynamic Simulation Addin for Autodesk Inventor)
  • Shifted from Bangalore to Delhi. Joined Indian Institute of Technology Delhi, New Delhi as a Project Scientist.
  • Got married to my college sweetheart in June.
  • Appeared for MS(Research) interview at IITD and got through it :). M.S program started from July end.
  • Finished off first sem of MS with CGPA 8.0/10
  • Launched IN-Motion 2009 for Autodesk Inventor 2009
  • Working on launch of IN-Motion 2010.

I hope 2010 will remain equally good if not more :)

Wish you all a Very Happy New Year !!!

Play Safe :P

ZedGraph C# Graph Data Export to CSV Using a Custom Context Menu

Tagged Under : , ,

Posted in Visual C#, tutorials by rajeev

In continuation of my earlier post on ZedGraph example which plots a sinosoidal graph, I have extended it further to:

Add a new custom menu item in context menu(which appears on right click on the graph)

Export Graph plot data to CSV (coma separated values) file. Which can be opened by spreadsheets such as Microsoft Excel and Open Office calc.

For the custom context menu, the code has been derived from ZedGraph Wikipage. The following is the code of the Windows Form which has the ZedGraph control.


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using ZedGraph;
using System.IO;

namespace ZedGraphTest
{
public partial class Form1 : Form
{
private PointPairList m_pointPairList;
//CSV Writer
private StreamWriter m_CSVWriter;

public Form1()
{
InitializeComponent();
CreateGraph();
SetSize();

//csv
zedGraphControl.ContextMenuBuilder +=
new ZedGraphControl.ContextMenuBuilderEventHandler(MyContextMenuBuilder);
}

private void CreateGraph()
{
GraphPane myPane = zedGraphControl.GraphPane;

// Set the titles and axis labels
myPane.Title.Text = "ZedGraph Test";
myPane.XAxis.Title.Text = "theta (angle)";
myPane.YAxis.Title.Text = "Sin (theta)";

// Make up some data points from the Sine function
m_pointPairList = new PointPairList();
for (double x = 0; x <= 360; x += 10)
{
double y = Math.Sin(x * Math.PI / 180.0);

m_pointPairList.Add(x, y);
}
// Generate a blue curve with Plus symbols,
LineItem _myCurve1 = myPane.AddCurve("Sin (theta)",
m_pointPairList, Color.Blue, SymbolType.Plus);

// Fill the pane background with a color gradient
myPane.Fill = new Fill(Color.White, Color.FromArgb(220, 220, 255), 45F);

//Make the MajorGrids of Axes visible
myPane.XAxis.MajorGrid.IsVisible = true;
myPane.YAxis.MajorGrid.IsVisible = true;

// Calculate the Axis Scale Ranges
zedGraphControl.AxisChange();
}

private void Form1_Resize(object sender, EventArgs e)
{
SetSize();
}

private void SetSize()
{
zedGraphControl.Location = new Point(10, 10);
// Leave a small margin around the outside of the control
zedGraphControl.Size = new Size(this.ClientRectangle.Width - 20,
this.ClientRectangle.Height - 20);
}

private void MyContextMenuBuilder(ZedGraphControl control,
ContextMenuStrip menuStrip, Point mousePt,
ZedGraphControl.ContextMenuObjectState objState)
{
// create a new menu item
ToolStripMenuItem _item = new ToolStripMenuItem();
// This is the user-defined Tag so you can find this menu item later if necessary
_item.Name = "Export Data as CSV";
_item.Tag = "export_data_csv";
// This is the text that will show up in the menu
_item.Text = "Export Data as CSV";
// Add a handler that will respond when that menu item is selected
_item.Click += new System.EventHandler(ShowSaveAsForExportCSV);
// Add the menu item to the menu,as 3rd Item
menuStrip.Items.Insert(2, _item);
}

private void ShowSaveAsForExportCSV(object sender, System.EventArgs e)
{
try
{
//show saveAs CmdDlg
saveFileDialog1.Filter = "CSV files (*.csv)|*.csv";
saveFileDialog1.ShowDialog();
m_CSVWriter = new StreamWriter(saveFileDialog1.FileName);
WriteCSVToStream();
m_CSVWriter.Close();
MessageBox.Show("CSV File Saved", " ZedGraph ", MessageBoxButtons.OK);
}
catch (Exception ex)
{
m_CSVWriter.Close();
MessageBox.Show(ex.ToString());
}
}

private void WriteCSVToStream()
{
//First line is for Headers., X and Y Axis
string _xAxisHeader = CheckCSVString(zedGraphControl.GraphPane.XAxis.Title.Text);
string _yAxisHeader = CheckCSVString(zedGraphControl.GraphPane.YAxis.Title.Text);
m_CSVWriter.Write(_xAxisHeader + "," + _yAxisHeader + "\n");

//subsequent lines are having data
for (int i = 0; i < m_pointPairList.Count; i++)
{
m_CSVWriter.Write(m_pointPairList[i].X + "," + m_pointPairList[i].Y + "\n");
}
}

private string CheckCSVString(string _string)
{//Check to see if there are any characters that can disturb the CSV delimeters.
string _returnString = _string;
if (_string.IndexOfAny("\",\x0A\x0D".ToCharArray()) > -1)
{
_returnString = "\"" + _string.Replace("\"", "\"\"") + "\"";
}
return _returnString;
}

}
}

Zedgraph C# Graph Plot Example Application

Tagged Under : , ,

Posted in Visual C#, tutorials by rajeev

Update : Check out ZedGraph C# Graph Data Export to CSV Using a Custom Context Menu , It has code to make a custom context menu item and also export the graph plot data as CSV.

Zedgraph is a very good opensource C# graph plotting library. Check out more details at my earlier post on Zedgraph. I have gone a step forward and made availabe source code and exe of a sample Zedgraph application which lets you have Line Plot, Bar Graph and Pie Chart.

Download Source Code (Visual Studio 2005 project in C#)

Download EXE

Below are the Screenshots of the Window Application. Copy and paste 2 columns of data from your favorite spreadsheet(eg MS Excel, Open Office Calc etc). NewLine and Tab delimiters are identified and the data is sorted accordingly, and added to graph plots. The Zedgraph plot library is so easy to use, implement and extend that it just took an afternoon to come up with this Windows application, when I was trying to convince my cousin to use ZedGraph in his college project.

ZedGraph is also being used to plot graphs in IN-Motion, a Motion Simulation Addin for Autodesk Inventor which I am co-developing along with my mentor. We are using ZedGraph to plot Postition-Velocity-Acceleration data, and intend to use it further more in Force-Torque graphs etc. Thanks to ZedGraph team for such a wonderful effort :)

Figure 1: ZedGraph Sample Window Application

Figure 2: The plot data for Line Plot and BarGraph are copied from a spreadsheat (eg MS Excel) and pasted in the text area. The code then uses tab and newLine delimiters to arrange data for plotting.

Figure 3: Line Plot for the above data. Notice the Titles of the X and Y axes.

Figure 4: Bargraph for the above data.

Figure 5: Data for Pie Chart. Paste 2 columns from spreadsheet. You may also use normal textbox to get the data from the user.

Figure 6: Pie Chart for the above data.

Download Source Code (Visual Studio 2005 project in C#)

Download EXE

Free Autodesk Inventor Assembly Files

Tagged Under :

Posted in Autodesk Inventor, CAD by rajeev

Update: IN-Motion, a Motion and Dynamic Simulation Addin for Autodesk Inventor has been launched by us.

Update: Video tutorials on usage of IN-Motion for Dynamic Simulation of Autodesk Inventor Assemblies.

Today, I stumbled upon a website which publishes textbooks, predominantly on CAD. While browsing through it, I figured out that they have a set of free Inventor assemblies, that can be downloaded. They can be found on this page on CADCIM. Scroll Down to section Inventor Files. A set of tutorials in pdf can also be found at the following URLs.

http://www.cadcim.com/Students_Project/basic_projects.htm
http://www.cadcim.com/Students_Project/intermediate.htm
http://www.cadcim.com/Students_Project/advance_projects.htm

Apart from CADCIM, there are other places where you can download Inventor Assembly and Part files for free. Check out

Update: Free Inventor Assembly files (used for Motion and Dynamic Simulation)

I shall try to update this blog post whenever I find more resources about free Autodesk Inventor parts or assemblies.

Minimize forms along with Parent Application or Form in C#

Tagged Under : , ,

Posted in CAD, Inventor Customization, Visual C#, tutorials by rajeev

How to minimize forms that belong to a particular application, when the parent application (In my case Autodesk Inventor) is minimized ? When you create software or addins, you would want the forms/dialogs to be minimized and not floating around when parent application is minimized.

For that we need to deal with hWnd of parent application. “hWnd” stands for Window Handle, which is the API call to the window(parent application). Since we come across this too often in Inventor customization to make addins, I have created a Class and a couple of methods for better clarity. Before I go into details, lets see what are the different types of Forms/Dialogs you would deal while developing Windows based software.

1)Modal Forms or Dialog Box

Modal Form

The modal forms are used when you want the user to enter some values and unless the form/dialog is closed, he/she cannot interact with other controls in the application. All the MessageBox’s are of modal types. The image on the left is also an example of Modal forms. Here, the user has to enter/select details of Graph plots in our addin IN-Motion.


2. Modeless Form

The modeless forms are used when user can enter values into the form and also can interact with other controls in application, even when the form is not minimized. The image on the left is the Simulation playback deck in IN-Motion.


Coming back to our problem of minimizing forms with parent application, below is the code. If the user minimizes Inventor application(parent form), its child forms are also minimized.


//
//Declare and set..here m_inventorApplication is the application
//MainFrameHWND returns its handle.
//WindowsWrapperForForm is a Class, defined at the bottom
WindowsWrapperForForm m_windowsWrapperForForm = new
WindowsWrapperForForm((IntPtr)m_inventorApplication.MainFrameHWND);

//Declare and set a form .. ModalCmdDlg is our modal form
ModalCmdDlg m_modalCmdDlg = new ModalCmdDlg();

//Declare and set a form .. ModelessCmdDlg is our modeless form
ModelessCmdDlg m_modelessCmdDlg = new ModelessCmdDlg();

//Show Modal form
ShowModalForm(m_modalCmdDlg);

//Show Modeless form
ShowModelessForm(m_modelessCmdDlg);

//Methods
private void ShowModalForm(Form _modalCmdDlg)
{
_modalCmdDlg.Activate();
_modalCmdDlg.ShowInTaskbar = false;
//ShowDialog is used..for Modal forms
_modalCmdDlg.ShowDialog(m_windowsWrapperForForm);
}

private void ShowModelessForm(Form _modelessCmdDlg)
{
_modelessCmdDlg.Activate();
_modelessCmdDlg.ShowInTaskbar = false;
//Show is used..for Modeless forms
_modelessCmdDlg.Show(m_windowsWrapperForForm);
}

//Below is the code for Class WindowsWrapperForForm
//****************Class***************

class WindowsWrapperForForm : System.Windows.Forms.IWin32Window

{
private IntPtr m_hwnd;
public WindowsWrapperForForm(IntPtr handle)
{
m_hwnd = handle;
}
#region IWin32Window Members
public IntPtr Handle
{
get { return m_hwnd; }
}
#endregion
}
//****************EndClass*******************

Opensource C# Graph Plot Library - ZedGraph

Tagged Under : , ,

Posted in Inventor Customization, Visual C#, tutorials by rajeev

Update: Check out Zedgraph C# Graph Plot Example Application , I have an example ZedGraph Application (with sourcecode) to draw Line Plot, Bar Graph and Pie Chart.

Update 2: Check out ZedGraph C# Graph Data Export to CSV Using a Custom Context Menu , It has code to make a custom context menu item and also export the graph plot data as CSV.

ZedGraph C# Graph Library

I was searching for an opensource(hence free) Graph plotting library in C# (or VB.NET), so that it could be used in our IN-Motion addin for Autodesk Inventor. After some googling, I found 2 suitable open source libraries namely ZedGraph and NPlot. When both websites(read wiki) were compared, I found ZedGraph recently updated and also had great documentation to take off immediately. I readily downloaded the latest version of ZedGraph dll from its SourceForge project and followed the instructions on ZedGraph wiki.

Within no time, I was ready with ZedGraphTest example, whose screenshot is above. It is so simple that, without even exploring, I could accomplish basic graph plotting. Some of the plus points I see in ZedGraph are:

  • Not much tweaking of source-code is required for basic tasks.
  • All the plot elements (line, curve, panel, axes, plot-markers etc) can be set different colors. Even gradients can be set to have crazy as well as good looking Graphs
  • Different types of graphs (line,bar,pie etc) are possible with ease.
  • Using left click on the plot panel, the graph can be zoomed
  • Middle button can be used to pan the plot
  • Upon right click over the plot, a context menu appears which, out of the box has a lot of useful features such as saving the image, toggle the on-hover highligthing etc
The code for my ZedGraphTest is below. I have changed only CreateGraph() method, and the remaining code is same as in the example.


private void CreateGraph(ZedGraphControl zgc)
{
GraphPane myPane = zgc.GraphPane;

// Set the titles and axis labels
myPane.Title.Text = "ZedGraph Test";
myPane.XAxis.Title.Text = "theta (angle)";
myPane.YAxis.Title.Text = "Sin (theta)";

// Make up some data points from the Sine function
PointPairList _list1 = new PointPairList();
for (double x = 0; x <= 360; x += 10)
{
double y = Math.Sin(x * Math.PI / 180.0);
_list1.Add(x, y);
}
// Generate a blue curve with Plus symbols,
LineItem _myCurve1 =
myPane.AddCurve("Sin (theta)", _list1, Color.Blue,SymbolType.Plus);

// Fill the pane background with a color gradient
myPane.Fill = new Fill(Color.White, Color.FromArgb(220, 220, 255), 45F);

//Make the MajorGrids of Axes visible
myPane.XAxis.MajorGrid.IsVisible = true;
myPane.YAxis.MajorGrid.IsVisible = true;

// Calculate the Axis Scale Ranges
zgc.AxisChange();
}

So far, this library has been a boon to me as I dont have to reinvent the wheel again. Thanks a ton to ZedGraph guys :)

Free Autodesk Inventor Video Tutorial

Tagged Under : , ,

Posted in Autodesk Inventor, CAD by rajeev

Update: IN-Motion, a Motion and Dynamic Simulation Addin for Autodesk Inventor has been launched by us.

Update: Video tutorials on usage of IN-Motion for Dynamic Simulation of Autodesk Inventor Assemblies.

Free Autodesk Inventor Video Tutorial

Check out the free screencast on Autodesk Inventor, titled “Adding 3D with Autodesk Inventor” by Lynn Allen, Autodesk Technical Evangelist. She explains how Inventor is the best choice for AutoCAD users, which definitely helps AutoCAD users to make a transition to Inventor. I am pretty much impressed with the screencast as I could learn a lot from it. Though the Inventor version using which this screencast was created is old (compared to Inventor 2008 I am using), the knowledge transfer was pretty much effective. After watching this video, I could learn a lot of functionalities and features that Inventor has and most often which are under-used. Thanks Lynn for such a wonderful screencast.

IN-Motion: Motion Simulation Addin for Autodesk Inventor

Tagged Under : , , , ,

Posted in Autodesk Inventor, CAD, Inventor Customization, Personal by rajeev

Update: IN-Motion, a Motion and Dynamic Simulation Addin for Autodesk Inventor has been launched by us. Check out the below video for an Overview

Update: Video tutorials on usage of IN-Motion for Dynamic Simulation of Autodesk Inventor Assemblies.

For the past few months, along with my mentor (Aik-Siong Koh), I have been busy developing Motion Simulation addin for Autodesk Inventor. We have named it IN-Motion. Once we are done with the development, it would be available for Autodesk Inventor users, in the form of an addin. Upon installing IN-Motion, they will be able to simulate an assembly both kinematically and dynamically. The following screencasts show the progress we have achieved so far in this regard and very soon we will be launching IN-Motion.

1) Basic tutorial on getting started with IN-Motion. We start with a blank Inventor assembly and place components and apply constraint. Then we start IN-Motion, set rotation to a Insert Constraint (Revolute Joint) and then simulate the mechanism/assembly. Watch high resolution video at AR-CAD.


2) Tutorial on simulating a four-bar mechanism. This assembly has 2 grounded parts and 3 movable parts, with 4 Insert Constraints. IN-Motion allows us to give rotation to one of the Insert Constraints and then the simulation can be made to see the behavior of the imposed motion. Watch high resolution video at AR-CAD.


3) Tutorial on simulating an Elliptical Trammel. This assembly has 4 components. IN-Motion deals with Planar and Insert Constraints in this case and the simulation takes place for an imposed Rotation on one of the insert constraints. Watch high resolution video at AR-CAD.


4) Tutorial on simulating an Engine. We start with the engine assembly that gets shipped along with Autodesk Inventor. Right now, we are not dealing with the sub-assembly(Piston.iam) parts and constraints. We are considering the sub-assembly as a block/part. Upon user feedback, we may actually extend upon the sub-assembly parts. This is mainly because, a lot of processing takes place in our Motion Solver and the sub-assembly parts(if non-trivial) add up to the CPU load. Watch high resolution video at AR-CAD.


5) Tutorial on Dynamic Simulation of a pendulum in Autodesk Inventor, using IN-Motion. We take the pendulum from Tutorial 1 and instead of giving a rotation, we set the value of Gravitational force for the assembly. IN-Motion then passes the gravity to our Motion solver and the dynamic simulation of the assembly takes place. This example is the simplest form of dynamic simulation and complex assemblies can also be simulated for dynamics. We are working on getting velocity, acceleration and force data at any point in the assembly, in the form of a graph. Watch high resolution video at AR-CAD.