Hi,
I have got the C# code to edit design table. Now I want to convert it to C++ code because my main program was written in C++. Can anybody give me some help? Thanks.
The C# code works:
ModelDoc2 swDoc = default(ModelDoc2);
bool boolstatus = false;
swDoc = ((ModelDoc2)(swApp.ActiveDoc));
boolstatus =swDoc.Extension.SelectByID2("Design Table", "DESIGNTABLE",0, 0, 0, false, 0, null, 0);
//Open Solidworks Design Table
swDoc.InsertFamilyTableEdit();
//Gets ActiveSheet to Modify
Excel.Application oXL;
Excel.Workbook oWB;
Excel.Worksheet oSheet;
//Start Excel and get Application object.
oXL =(Excel.Application)Marshal.GetActiveObject("Excel.Application");
oXL.Visible= false;
oWB =(Excel.Workbook)oXL.ActiveWorkbook;
oSheet =(Excel.Worksheet)oWB.ActiveSheet;
…….
oSheet.Cells[6,4] = "3330"; //Cell Location [row,col]
…….
//Close Design Table
swDoc.CloseFamilyTable();
For C++ code:
#include "excel.cpp";
_Application _app;
Workbooks books;
_Workbooks book;
Worksheets sheets;
_Worksheet sheet;
Range range;
LPDISPATCH lpDisp;
pSwModel->Extension->SelectByID2("Design Table", "DESIGNTABLE", 0, 0, 0, false, 0, NULL, 0);
//Open Solidworks Design Table
pSwModel->InsertFamilyTableEdit();
CComPtr
IDispatchPtr lpDisp0 = pSwModel->GetDesignTable();
......
(how to get the cell of worksheet to edit ?)
.....
pSwModel->CloseFamilyTable();
SolidworksApi/macros