Book a Demo

Author Topic: Trouble calling add-in method from Shape Script  (Read 6564 times)

Volkov

  • EA User
  • **
  • Posts: 21
  • Karma: +0/-0
    • View Profile
Trouble calling add-in method from Shape Script
« on: October 30, 2015, 09:06:06 am »
Hi guys,
Trying to call my add-in from the Shape Script to customise the picture according to add-in users' options. Failed! Trying to follow docs and samples but looks like EA just ignores the call. Add-in implemented with C# so almost no useful samples may be found, the accent on using VB :(

This is my Shape Script fragment calling the function 'isDecorated' in my add-in

Code: [Select]
println("#addin:MyAddInn, isDecorated, 'Y'#"); And this is test skeleton for this function

Code: [Select]
namespace TestAddIn
{

  [ComVisible(true)]
  public class AddIn
  {
    public dynamic isDecorated ( Repository repo, string guid, dynamic args )
    {
      MessageBox.Show("public string isDecorated()");
      return "isDecorated() called!";
    }
...
And of course, there is MyAddInn add-in definition in Windows registry. Other add-in functionality works just fine except this call from Shape Script.  
Looks like either that function never been called or I got trouble with number of parameters and their types.
Any help, please!!! Very urgent task has just stalled!

KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2919
  • Karma: +55/-3
    • View Profile
Re: Trouble calling add-in method from Shape Scrip
« Reply #1 on: October 30, 2015, 09:21:24 am »
Here is a forum post with a C# example that the poster says works: http://www.sparxsystems.com/cgi-bin/yabb/YaBB.cgi?num=1326759082/1#1
The Sparx Team
[email protected]

Volkov

  • EA User
  • **
  • Posts: 21
  • Karma: +0/-0
    • View Profile
Re: Trouble calling add-in method from Shape Scrip
« Reply #2 on: October 30, 2015, 09:30:32 am »
Hi KP,
And many thanks for your message!! Hope, this will be real solution of my trouble. Seems to me, good sample and couple of pages in docs would be just what doctor prescribed  ;D

Cheers!!

Volkov

  • EA User
  • **
  • Posts: 21
  • Karma: +0/-0
    • View Profile
Re: Trouble calling add-in method from Shape Scrip
« Reply #3 on: October 30, 2015, 08:56:41 pm »
Hi KP and everybody!
Tried to implement as shown in the sample from your message. No effect. Now my function's signature (Class method, indeed) aligned to sample's one looks like this:

Code: [Select]
public string isDecorated(EA.Repository repo, string guid, object arguments)but it's never called. Tested with VS2015 debugger attaching to EA process, too. No calls to my add-in assembly during shape drawing.
I'm really disoriented. What's wrong? :( Documentation regarding calling add-in from ShapeScript is almost useless. And no trace logs or whatever to know what went wrong.
Any help is highly appreciated!!!

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Trouble calling add-in method from Shape Scrip
« Reply #4 on: October 30, 2015, 09:30:42 pm »
Is your add-in registered correctly? EA_Connect should be called at least.

q.

Volkov

  • EA User
  • **
  • Posts: 21
  • Karma: +0/-0
    • View Profile
Re: Trouble calling add-in method from Shape Scrip
« Reply #5 on: October 30, 2015, 09:50:48 pm »
Hi,
All is ok now. It seems to me, that EA has some buggy cache inside. It is become obvious when one tries to change picture in Image Manageer without changing its name. Old picture will be drawn every time. Looks like something similar is for add-ins or profiles, too. I've just make changes to different profile element and all items start to work.
Very strange and definitely a bug.
Thanks for everyone!!