Recently I just started using C# to develop something to work with Solidworks.
Someone please help me to get started...
Below just the code to change a dimension in a opened document(I added two COM reference just as they instructed here):
=========================================
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace ccccc
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
SldWorks.SldWorks swApp;
swApp = new SldWorks.SldWorks();
SldWorks.ModelDoc2 Part;
Part = swApp.ActivateDoc; //Cannot convert Object
Part.Parameter("D1@Sketch1").Systemvalue = 0.1;
//swApp.ExitApp();
//swApp = null;
}
}
}
======================================
However, Visual Studio complain about the code in red colour?!!
Please help how to write that part please... I just need to assign opened document to it, but it refuse to work!
SolidworksApi macros