We want to use the converters for our application. We went through the documents and these are the nuget packages it suggests to use:
We need to use XUnitRevitUtils.2020 package to read revit file in xru object and pass document in ConvertToSpeckle function. but it has a dependency on ModPlus.Revit.API.2020. My project target framework is .Net Standard 2.0. (This is what we got to know from debugging he unit tests)
We get the following warning:
If anyone can guide us or provide any help for the same purpose, that shall be very nice of you.
Hey Ammad, welcome to our community!
Would love to know more about what you’re building , and feel free to Introduce yourself 🙆 if you’d like.
I can think of a few things that might be going on:
- make sure your using .NET Standard 2.0 and not any later ones (2.1 is already not compatible with .NET Framework 4.6)
- where and how are you getting that error? Is your code running as a Revit plugin? In what Revit version?
- there might be also an issue with our converter nugets and the xUnitRevit nugets targeting different verisons of the Revit API. I’d suggest unloading each separately and seeing what happend!
Amd23 and I work together.
We are trying to give a revit file path and Open document through this code:
var obj = new Objects.Converter.Revit.ConverterRevit(); Document doc = xru.OpenDoc(filepath); obj.ConvertToSpeckle(document);
We saw a similar code in the unit test in speckle code. xru class is defined in xUnitRevitUtils. when we use nuget package xUnitRevitUtils.2019 we get this error.
Our application uses .NET standard 2.0. Our code is not running as revit plugin.
Can you please let us know if there is an alternative to open the Revit file and pass in ConvertToSpeckle?
@fatematahir I’m afraid you cannot use the Revit API outside Revit.
Unfortunately Autodesk doesn’t want you to run their software headlessly, you can only pay and use their solutions instead
So, what do you suggest we use for our purpose? Basically what we what is that we simply read the revit file to speckle object and then transfer it to our own class?
Can you just guide us better?
As I went through the documentation I thought the comverterd will serve the purpose. But can you guide us better?
Hey @amd23 @fatematahir,
as Matteo pointed out, this is unfortunately a limitation Autodesk enforces on Revit users, to force us to use their proprietary automation solution aka Forge. There is technically no way to run the parts of the RevitAPI outside of the Revit application. So you have 2 options:
- cave in to the pressure, and run your automation on Forge, which if I’m not mistaken, could include using the speckle SKD to send your stuff to a server.
- do the same, with some clever hackery: create a new IExternalApplication plugin, (not an IExternalCommand) and register a custom handler on the Idling event like this: Idling Event
This way you can run arbitrary code once the app loads properly and reaches an idle (user can interact with it) state.
There’s also the Open Design Alliance solution. It’s anything but open, it costs a lot and it requires you to know C++: BimRv SDK | Open Design Alliance