Problem with running sample as Revit Plugin

Hello,
I’m trying to make a C++ *.dll based on connect sample code. When I run this *.dll from my standalone C# application everything works fine. Then I changed my C# project from the standalone application to a Revit plugin *.dll and ran into a problem.
Connection to the NUCLEUS database was successful and it return me correct username but method

// stageUrl == "omniverse://localhost/Users/test/helloworld.usd"
UsdStageRefPtr gStage = UsdStage::CreateNew(stageUrl);

throw an exception.
I tried to catch it as std exception

catch (const std::exception &e)
{
	// e.what() == "string too long"
}

where what() method return “string too long”. I’m not sure if this exception tell me about some long string inside of this method or I’m catching wrong exception and what() contains trash without EoL symbol.
Please could you help me to understand why this method works fine on a standalone application and throw an exception on a Revit Plugin project?
Thanks,
Larion

Hello @lgvozditskiy! Welcome to the community! I messaged the development team about your problem. I will post back as soon as I have more information!

1 Like

Including @mgraham because she works on the Revit Connector and more experience with the C# side of things .

Are you passing the value for stageUrl the same way for both your standalone C# app and your Revit C# plugin?
If the value for stageUrl is hard coded in your C++ dll, does it work or fail for the standalone C# app or the Revit C# plugin?

stageUrl is hardcoded in the C++ dll. I’m using the same C++ dll in C# standalone and C# Revit plugin so the value is the same. Everything works when I’m calling C++ dll from the C# standalone application and fails when I’m calling it from the Revit plugin C# application.

Hey @lgvozditskiy , can you clarify what you’re trying to accomplish here? We offer a Revit connector for OV available in our launcher if you’re looking to siphon data out of your BIM models.

What I can say is that it is possible to call from a C# revit plugin to a C++ support dll and create a usd stage. If could be some project or solution setting that is causing the issue. Perhaps you could compare the settings for the standalone C# and the Revit C# projects

Ok, thank you for the fast answer. Good to know that it is problem on my side and it should work. Maybe it’s just some property that works on standalone and doesn’t want to work as a plugin because all I do to change C# standalone to C# plugin is change output type from executable to a DLL library. I’ll try to fix it and if you are interested I’ll write what was wrong.
Thanks,
Larion

1 Like