What does this activeX error mean, how do i fix it?

Hi, Im attempting to use a finite element analysis program (infolytica Magnet), in conjunction with MAtlab R2011a by using activeX. I dont have much experience with activeX, however, i have found some code from the software distributor (Infolytica), which should allow both programs to communicate with each other. This code should open up the FEA software, and draw a line. code:
MN6 = actxserver ('Magnet.Application');
MN6.Visible = 'true';
% set MagNet constants
Consts = invoke(MN6, 'getConstants');
% open new document
dev = invoke(MN6, 'newDocument');
% draw a line on the screen
invoke(dev, 'newConstructionSliceLine', 3, 0, 5, 2)
error which i receive:
??? No public field Visible exists for class COM.Magnet_Application.
Error in ==> Matlab_server at 2
MN6.Visible = 'true';
Im not sure why this error is coming up. Any help, would be greatly appreciated.
regards, Daleel

1 件のコメント

Tik Deep
Tik Deep 2021 年 1 月 12 日
Try this
set(MN6,'Visible',1);
I tried to connect Matlab R2020b to MAgNet 2020.1 and it worked and I can create the line.
The same example that you wrote here is also availble in the Magnet knowledge base.

サインインしてコメントする。

回答 (2 件)

per isakson
per isakson 2012 年 8 月 8 日

0 投票

Try
methods( MN6 )
MN6.Visible = true;

4 件のコメント

Daleel Lilla
Daleel Lilla 2012 年 8 月 8 日
編集済み: Walter Roberson 2012 年 10 月 30 日
i tried it, this is the code:
MN6 = actxserver ('Magnet.Application');
methods( MN6 )
MN6.Visible = 'true';
% set MagNet constants
Consts = invoke(MN6, 'getConstants');
% open new document
dev = invoke(MN6, 'newDocument');
% draw a line on the screen
invoke(dev, 'newConstructionSliceLine', 3, 0, 5, 2)
and the output i get... but still get an error:
Methods for class COM.Magnet_Application:
addproperty get move set
constructorargs getStackCalculator propedit
delete interfaces release
deleteproperty invoke save
events load send
??? No public field Visible exists for class COM.Magnet_Application.
Error in ==> Matlab_server at 3
MN6.Visible = 'true';
Nothing was done in the FEA program... Thanx so much for the effort!
regards Daleel
per isakson
per isakson 2012 年 8 月 9 日
I should have proposed
properties( MN6 )
Is it case sensitive? Try
MN6.visible = 'true'
The value should it be char not logical?
Guillermo
Guillermo 2012 年 10 月 29 日
please try set(mn6, 'Visible', 1) instead mn6.Visible = true;
regards,
guillo
Image Analyst
Image Analyst 2012 年 11 月 26 日
No, you didn't try it. You continued to do
MN6.Visible = 'true';
while per said to do this:
MN6.Visible = true;
You're setting it to a string and he said to set it to a boolean. And your list shows methods, not properties. Try to get the properties to see if visible is one of them - it most likely is.

サインインしてコメントする。

Brian Keats
Brian Keats 2012 年 11 月 26 日

0 投票

mn6.set('visible','true')

製品

タグ

質問済み:

2012 年 8 月 8 日

コメント済み:

2021 年 1 月 12 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by