ā2023-07-04
04:00 AM
- last edited on
ā2024-09-26
12:23 PM
by
Doreena Deng
Been working with the latest API with the intent to make available some of the features of the API examples to Python scripts. My idea is that Python is much easier to work with and doesnāt require a recompilation anytime a change is made. Very easy to experiment with. I also donāt want to reinvent the wheel since most of the functions of interest are already contained within the examples. Unfortunately, they are not in a form which can be immediately used, requiring one to recreate and compile the AddOn in a form more specific to oneās needs. It is much, much easier to experiment with a Python script. However, the present Python API has almost no access to the functions demoed in the C++ API examples. And, Graphisoft has indicated that they have no intention of upgrading the Python API in the near future.
This why I would like to create parallel AddOn examples which would make those functions available. Actually, this is relatively straight forward, by just making the Graphisoft menu items available to a Python script and passing over the results.
However, there is a problem. Graphisoftās examples almost exclusively write their data/results to the session report via a variadic template (WriteReport). Completely worthless!! The data (output) is packed in a variadic argument and I am unable to unpack it or know how.
I tried using stdargs.h but just get a error on va_start of āva_start intrinsic only allowed in varagsā. I also asked Graphisoftās beta tech support to provide a solution but was just ignored. Understandable, since the beta site now has over 250 submittals. They are swamped.
Can anyone provide a means to unpack and use a variadic argument within a template which would provide access to all the results.
template<typename... Args>
void WriteReport (const char* format, Args&&... args)
{
ACAPI_WriteReport (format, false, std::forward<Args> (args)...);
}
Of course, I could just bypass the WriteReport function(s), but that would be a huge amount of work ā not practical.
Can anyone help. Help me, help you?
ā2023-07-11 09:56 AM - edited ā2023-07-11 10:11 AM
Using DevKit 27 Attribute_Test - VS 2019
ā2023-07-11 09:12 PM
For Attribute_Test we'll need the following template specializations:
// Template specializations here!
// Anything that doesn't support GS::ValueToUniString will need to be explicitly implemented similar to this:
template<>
void addToArray<char*> (char* cStr) {
container.Push (GS::UniString (cStr));
}
template<>
void addToArray<const char*> (const char* cStr) {
container.Push (GS::UniString (cStr));
}
template<>
void addToArray<const void*> (const void* printfStr) {
container.Push (GS::UniString ((const char*)printfStr));
}
template<>
void addToArray<const GS::uchar_t*> (const GS::uchar_t* printfStr) {
container.Push (GS::UniString (printfStr));
}
Unfortunately I probably won't have time the coming weeks to look into the other issue on how to setup the global container correctly.
ā2023-07-11 11:17 PM
Now i am getting the message that "addToArray is not a Template" Looks like a template to me.
I want to thank you for your help, I got a lot of new ideas now on how to approach this problem. i will continue my investigation.
Thanks again, i would not spend anymore of your time on this, I have a lot of new ideas now. Thanks again
ā2023-07-11 11:22 PM
You're welcome!
Just a last thought for the latest error: The code new code needs to go into the class at the same place where I've put previous template specializations. Maybe that's the issue for "addToArray is not a Template"