Matlab CurvesByTables implementation

Valued Contributor
Valued Contributor

I have been trying to use the CurvesByTables from Matlab. I am using Matlab to create blade shapes and output the curves to spreadsheets. It is a bit tedious to them import them one-by-one into Solid Edge.

 

Here is what I have so far

 

%-----------------------

objApp = actxserver('SolidEdge.Application') % Open instance of solidedge

objApp.Visible = 1                           % Makes the instance visible

 

% Opens an existing file

objPart = objApp.Documents.Open('F:\Block.par') % Opens a file that I created

 

% This sets up contructions before selecting curve by table

objcurve  = objPart.Constructions %sets up a construction method

objcurve1 = objcurve.CurvesByTables

 

% This does not work and gives the error ??? Invoke Error, Dispatch Exception: The parameter is incorrect.

objcurve2 = objcurve1.Add('F:\BlockCurve.xlsx')  % The spreadsheet exists and does work if I use it from inside Solid Edge

%-----------------------

 

The inputs for the Add parameter of CurvesByTables says that the other parameters are optional but even when I try to pass those I still get this error. I have seen that some others have had success with interfacing from Matlab.

 

Any help would be greatly appreciated.

Thanks

 

 

Posted by: Anthony Gannon
Post date: 11/29/2011 4:48:32 AM

5 REPLIES

RE: Matlab CurvesByTables implementation

Valued Contributor
Valued Contributor

I wonder if it has anything to do with you using an .xlsx rather than an .xls.  I know you said it works from Solid Edge GUI but their code does not necessarily call the API that we use.  The API we use may work differently in this case.  Worth a try anyways.

 

I also found this discussion where they show an example from support and they're using a .xls.

 

 

Posted by: Jason Newell
Post date: 12/2/2011 7:34:34 PM

RE: Matlab CurvesByTables implementation

Valued Contributor
Valued Contributor

There were two problems, thank you Jason for finding my second one.

 

Problem 1) I had to use the CurveByTable NOT CurveByTables

Problem 2) Even though *.xlsx spreadsheets work from within SolidEdge, only the older *.xls work using the API (thank you Jason)

 

Here is my now working code

 

%-----------------------

objApp = actxserver('SolidEdge.Application') % Open instance of solidedge

objApp.Visible = 1 % Makes the instance visible

 

% Opens an existing file

objPart = objApp.Documents.Open('F:\Block.par') % Opens a file that I created

 

% This sets up contructions before selecting curve by table

objcurve = objPart.Constructions %sets up a construction method

objcurve1 = objcurve.CurvesByTable  % 1st error here

 

% This works  but do not use *.xlsx spreadsheets, only *.xls spreadsheets.

objcurve2 = objcurve1.Add('F:\BlockCurve.xls') % The spreadsheet with the points I want

%-----------------------

 

 

 

Posted by: Anthony Gannon
Post date: 12/7/2011 1:11:29 PM

RE: Matlab CurvesByTables implementation

Valued Contributor
Valued Contributor

Awesome.  Glad you got it working.  Don't forget that you can always log an IR\ER with GTAC for the .xlsx issue.  That's about the only way it will get fixed in a future release.

 

 

Posted by: Jason Newell
Post date: 12/7/2011 1:23:04 PM

RE: Matlab CurvesByTables implementation

Valued Contributor
Valued Contributor

Hi,

I'm working with the object CuveByTable too and I need to know the code to edit an existing curve; does anybody know how to help me? In particular my curve is already linked with a .xls file and I need to update my curve when the coordinates in this file change.

 

 

Posted by: Guido Bonalumi
Post date: 12/14/2011 2:52:28 AM

RE: Matlab CurvesByTables implementation

Valued Contributor
Valued Contributor

HI MONTEREY

Can you send me your excel file ..need to see placements...a1k1s1@yahoo.com

thanks and regardsali

 

Posted by: ali kamran
Post date: 12/24/2011 11:07:01 PM