MATLAB: How to pass an object array to activex (SolidEdge) activexMATLABmethodobjectsolidedge In the output of methods SolidEdgeFrameworkSupport.ComplexStrings2d -full can you show us the signature for AddByObjects? Best Answer MathWorks support and documentation were not so useul I suggest to improve them.Anyway I was able to solve the problem after many attempts changing the approach from COM to .NET. Now this code works:clear;close all; clc;% Loading .NET librariesSEF = NET.addAssembly('C:\Program Files\Solid Edge ST5\Custom\SELibrary\bin\Interop.SolidEdgeFramework.dll');SEFS = NET.addAssembly('C:\Program Files\Solid Edge ST5\Custom\SELibrary\bin\Interop.SolidEdgeFrameworkSupport.dll');SED = NET.addAssembly('C:\Program Files\Solid Edge ST5\Custom\CustomSensor\bin64\Interop.SolidEdgeDraft.dll');% Connecting with SolidEdgeobjType = System.Type.GetTypeFromProgID('SolidEdge.Application');objApp = SolidEdgeFramework.Application(System.Activator.CreateInstance(objType));objApp.Visible = true;% Creating new documentobjDoc = SolidEdgeDraft.DraftDocument(objApp.Documents.Add('SolidEdge.DraftDocument'));objSheet = objDoc.ActiveSheet;% Get the ComplexStrings2d object on the active sheetobjCompStrn = objSheet.ComplexStrings2d;% Draw few lines on the active sheetobjL1 = objSheet.Lines2d.AddBy2Points(0.1,0.1,0.2,0.2);objL2 = objSheet.Lines2d.AddBy2Points(0.2,0.2,0.4,0.2);objL3 = objSheet.Lines2d.AddBy2Points(0.4,0.2,0.5,0.1);% Store the Line objects in an ArrayobjBObjs = NET.createArray('System.Object',3);objBObjs(1) = objL1;objBObjs(2) = objL2;objBObjs(3) = objL3;% Create a ComplexString2d objectobjCompStrn.AddByObjects(3, objBObjs) Related SolutionsMATLAB: How to rename a sheet in Excel using the COM interface in MATLAB You can rename an Excel sheet using the "Name" property of a sheet object. For example the following renames the first sheet of an Excel file:filename = 'C:\SomeExcelFile.xls';% Open Excel Automation serverExcel = actxserver('Excel.Application');% Make Excel visibleExcel.Visible=1;% Open Excel fileWorkbook = Excel.Workbooks.Open(filename);% Get the list of sheets in the workbookSheets = Excel.ActiveWorkbook.Sheets;% Rename the first sheetSheets.Item(1).Name = 'This is sheet 1';The following code then saves the Workbook, quits Excel and removes the COM server:% Save the fileWorkbook.Save();% Quit Excel, remove the COM server and delete the related objectsExcel.Quit();Excel.delete();clear Excel;clear Workbook;clear Sheets; MATLAB: How to generate a complex matrix of different rows and column One approach:a=5*rand(15,1);b=-8*rand(15,1);%creationComp=repmat(complex(a,b),1,3);%%shuffleComp(:,2)=Comp(randperm(size(Comp,1)),2)Comp(:,3)=Comp(randperm(size(Comp,1)),3) Related QuestionCreating empty ui control componentWhen using Excel as an ActiveX server, why does the excel.exe process still exist after I close ExcelMust a function in the methods block of a class have an input argumentAutofill range in excel using MatlabApplying a border to Excel cells when using COM
Best Answer