Book a Demo

Author Topic: Shape script "addin" property  (Read 4931 times)

Uffe

  • EA Practitioner
  • ***
  • Posts: 1859
  • Karma: +133/-14
  • Flutes: 1; Clarinets: 1; Saxes: 5 and counting
    • View Profile
Shape script "addin" property
« on: January 29, 2013, 08:20:30 pm »
Hi!

Does anyone have an example of how to use the "addin" property in a shape script?

All I can find in the help file is "addin (value returned from an Add-In)," but it doesn't say anything more on the syntax, nor can I find any hint in the Add-In API reference.

How is it called from the shape script, how is it received in the Add-In and what is the Add-In supposed to return?

Cheers,


/Uffe
My theories are always correct, just apply them to the right reality.

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Shape script "addin" property
« Reply #1 on: January 29, 2013, 11:43:30 pm »
I was curious looking into the shape script documentation. But there's not a single sentence about the exec_addin. However, I remember the discussions about that method. Did you find anything documented?

q.

[edit] I once posted this link :-X http://www.sparxsystems.com/cgi-bin/yabb/YaBB.cgi?num=1326759082/1#1
« Last Edit: January 29, 2013, 11:52:46 pm by qwerty »

Aaron B

  • EA Administrator
  • EA User
  • *****
  • Posts: 941
  • Karma: +18/-0
    • View Profile
Re: Shape script "addin" property
« Reply #2 on: January 30, 2013, 12:33:08 pm »
The help included with EA 10.0.1005 gives the following description:

returns a value from an invoked add-in function - syntax: addin:<addin_name>, <function_name>, <parameter> [, <parameter> ...]

and the following example shape script which also describes the expected method signature in the add-in:

Code: [Select]
// GET A VALUE RETURNED BY AN ADD-IN
shape main
{
       //Draw a simple rectangle
       Rectangle(0,0,100,100);
 
       //Print string value returned from Add-In "MyAddin",
       //Function "MyExample" with two string parameters
       Print("#ADDIN:MyAddin, MyExample, param1, param2#");
}
 
// METHOD SIGNATURE FOR ADD-IN FUNCTION:
// Public Function MyExample(Repository As EA.Repository,
// eaGuid As String, args As Variant) As Variant

Uffe

  • EA Practitioner
  • ***
  • Posts: 1859
  • Karma: +133/-14
  • Flutes: 1; Clarinets: 1; Saxes: 5 and counting
    • View Profile
Re: Shape script "addin" property
« Reply #3 on: January 31, 2013, 02:01:38 am »
Great, thanks!

I can confirm that this works in 9.3 (933) as well.
Working in C#, my method signature looks like this:
Code: [Select]
public string MyExample(EA.Repository repository,
                        string elementGuid, Object args)
However, I could only get it to work in Print() statements - if I stick the exact same call in either of the two HasProperty() queries, the Add-In is never triggered.

By design?

/Uffe
My theories are always correct, just apply them to the right reality.

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Shape script "addin" property
« Reply #4 on: January 20, 2014, 10:43:13 pm »
I'm currently playing around with that. Unfortunately I can only work with Perl and  I know there are some limitations. So I only see repository and guid. I do not see any of the parameters passed. So here my questions:

- are the parameters seen in any way from some Cxx language?
- what kind of parameter (object type) is used?

Thanks.

q.