How to get the model filename in C++

I want to output the name of model to the text file. For example, I open a file ‘test.3dm’. Then I want export some information to a text file. How can I get the name of ‘test.3dm’ using C++.

You think you could use the CRhinoDoc::ActiveDoc() method to get a pointer to the active document, and then access the document’s file name using the CRhinoDoc::GetPathName()

@farouk.serragedine Thanks for your reply. I have successfully get the model file name based on your suggestion.

ON_wString file_str = context.m_doc.GetPathName()

Thank you again!
Qingxiang

1 Like

Glad I could help

Many thanks

Your suggestion is really helpful. Thanks for your warm-hearted help