[SOLVED] Opening text file into add-on
Anonymous
Not applicable
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2017-05-11
04:00 PM
- last edited on
‎2023-07-12
08:47 PM
by
Doreena Deng
‎2017-05-11
04:00 PM
Hi everybody!
I am new to archicad and C++. I am developing the add-on on x-code 8.3.2. The add-on is for my company, which will import materials and build ups from text file. Now I have a struggle and I can't find any method in the API for opening simple file dialog. The closest thing I find is APIIo_​OpenPictureDialogID, but it doesn't suite my needs. Am I missing something here?
All the best, Julian
I am new to archicad and C++. I am developing the add-on on x-code 8.3.2. The add-on is for my company, which will import materials and build ups from text file. Now I have a struggle and I can't find any method in the API for opening simple file dialog. The closest thing I find is APIIo_​OpenPictureDialogID, but it doesn't suite my needs. Am I missing something here?
All the best, Julian
Labels:
- Labels:
-
Add-On (C++)
5 REPLIES 5

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2017-05-12 05:48 PM
‎2017-05-12
05:48 PM
Hi Julian,
This simple GetOpenFile function opens a file dialog for you.
Regards,
Tibor
static bool GetOpenFile (IO::Location* dloc, const char* fileExtensions, const GS::UniString& filterText) { if (dloc == nullptr) return false; FTM::TypeID retID; FTM::FileTypeManager ftman ("MyManager"); FTM::FileType type (nullptr, fileExtensions, 0, 0, 0); FTM::TypeID id = FTM::FileTypeManager::SearchForType (type); if (id == FTM::UnknownType) id = ftman.AddType (type); DG::FileDialog dlg (DG::FileDialog::OpenFile); // Open only 1 file UIndex i = dlg.AddFilter (id, DG::FileDialog::DisplayExtensions); dlg.SetFilterText (i, filterText); if (!dlg.Invoke ()) return false; *dloc = dlg.GetSelectedFile (); return true; } // ----------------------------------------------------------------------------- // Usage: IO::Location selectedTextFileLoc; if (!GetOpenFile (&selectedTextFileLoc, "Text File", "*.txt")) return;
This simple GetOpenFile function opens a file dialog for you.
Regards,
Tibor
Anonymous
Not applicable
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2017-05-15 10:02 AM
‎2017-05-15
10:02 AM
Hey Tibor,
Thank you very much !!
Thank you very much !!
Anonymous
Not applicable
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2017-05-15 11:41 AM
‎2017-05-15
11:41 AM
I have another question and I don't want to open a new thread for it. For debugging purposes I want to log some data. I'm opening the report window from File > Info > Session Report. Is this the right way to open it?
Also I'm using WriteReport_Alert() method, but I only get the popup, without logging the data into the report window of archicad. I am using the demo version of Archicad, so is it possible that ACAPI_WriteReport() doesn't work with the demo version of archicad and doesn't want to write to that file?
Thanks in advance, Julian
Also I'm using WriteReport_Alert() method, but I only get the popup, without logging the data into the report window of archicad. I am using the demo version of Archicad, so is it possible that ACAPI_WriteReport() doesn't work with the demo version of archicad and doesn't want to write to that file?
Thanks in advance, Julian
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2017-05-18 11:40 AM
‎2017-05-18
11:40 AM
jcimentarov wrote:Well, depends on where you want to see the log, I would recommend using a simple DBPrintf () call, which writes to the system.log in Console.
I have another question and I don't want to open a new thread for it. For debugging purposes I want to log some data. I'm opening the report window from File > Info > Session Report. Is this the right way to open it?
Also I'm using WriteReport_Alert() method, but I only get the popup, without logging the data into the report window of archicad. I am using the demo version of Archicad, so is it possible that ACAPI_WriteReport() doesn't work with the demo version of archicad and doesn't want to write to that file?
Thanks in advance, Julian
ACAPI_WriteReport shouldn't behave differently in the DEMO version, but you can always order a developer license.
Best, Akos
Anonymous
Not applicable
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2017-05-24 10:17 AM
‎2017-05-24
10:17 AM
A DBPrintf () call from my add-on doesn't write anything in the system.log ... Is there anything specific that I need to do in order to make it work ?
All the best, Julian
All the best, Julian