Author:Akos Somorjai
Posted: Sun Dec 18, 2016 11:50 am (GMT+1)
Hi,
Could you please post the relevant part of your code?
That function usually gives that error code when it cannot build up the connection to ARCHICAD from the add-on. The API functions mostly run on the main thread of the application, triggered by some user event, so you cannot really throw API calls randomly at ARCHICAD; this won't work. Is this the case you refer to?
If so, then I can recommend two solutions: if you have a palette in ARCHICAD, then enable idle events for that, and call the API from that idle event handler (PanelIdle ()). If you don't have an interface, then use the ACAPI_Command_CallFromEventLoop () mechanism to get what you want.
I'm not sure how the handles allocated in the ACAPI_Element_GetMemo work with managed code, though.
Regards, Akos
Posted: Sun Dec 18, 2016 11:50 am (GMT+1)
mar_kq wrote: |
Hello, I am getting this error in my Addin: APIERR_REFUSEDCMD while attempting to get the Memo of Rooms(API_ZoneID), ONLY when I call my function from a managed WPF Control (mixed code). Are there any locks happening automatically when the API is used without an ArchiCAD UI trigger? What could be the problem here? I am a little confused. I have checked the GUIDs and they are unchanged as when I call the function from a Menu Command, also I can access all Informations at the "element.zone..." level and also the IFC Properties, just the memo throws this error. I would be very glad to get some suggestions. Thanks in advance! *DEVENV: Windows 10, VS2012, AC20 |
Hi,
Could you please post the relevant part of your code?
That function usually gives that error code when it cannot build up the connection to ARCHICAD from the add-on. The API functions mostly run on the main thread of the application, triggered by some user event, so you cannot really throw API calls randomly at ARCHICAD; this won't work. Is this the case you refer to?
If so, then I can recommend two solutions: if you have a palette in ARCHICAD, then enable idle events for that, and call the API from that idle event handler (PanelIdle ()). If you don't have an interface, then use the ACAPI_Command_CallFromEventLoop () mechanism to get what you want.
I'm not sure how the handles allocated in the ACAPI_Element_GetMemo work with managed code, though.
Regards, Akos