Build the solution .dll for AutoCAD - Rhino 7 WIP

Hi everyone!

I hope someone might be able to give me some advice about an issue I am having with the Rhino7 WIP and AutoCAD.

I have followed the instructions on how to build the RhinoInside.AutoCAD.dll to run with the .NET application within Autocad but I couldn’t build it with Visual Studio 2017. Here I upload a screen capture of the bug when I tried to Build the solution (17 errors and 6 warnings).

I tried to build the solution for Revit and everything was Ok so I don’t know where the problem is.

Thanks for your help,

Franco.

Hi @franco.crudi,

What version of AutoCAD do you have installed? I believe I build this sample against AutoCAD 2019.

– Dale

Hi Dale,

Thanks for answering. I have installed AutoCAD 2019.

Hi @dale

I am having the exact same issue as @franco.crudi was having here.
I cannot seem to get the build talking to AutoCad 2019 which I have installed on my system , any help would be appreciated, this is the error I am getting…

issue

In order to debug the plug-in, the plug-in must be running. For the plug-in to run, AutoCAD must be running and have loaded the plug-in. To get AutoCAD running, set acad.exe as the your project Debug startup action.

image

– Dale

Thanks for that, I am totally new at this.
I made that change an ACAD launches which is promising! but I still get something like 30 errors in the build.
I am thinking that the problem I have is that when I use Netload in ACAD, I cannot find the .dll file that is needed.
Which I think this VS2017 project is building?

thanks so much for your help again

Found the issue,it was the reference paths! now it builds with no errors,
but when I run TestRhinoInside in auto-cad nothing happens

Hi @dale

Will RhinoInside work on AutoCad 2016 Basis?
I got the following error while compiling:

************** Exception Text **************
System.InvalidOperationException: The visual tree has been changed during a 'VisualTreeChanged' event.
   at System.Windows.Diagnostics.VisualDiagnostics.VerifyVisualTreeChangeCore(DependencyObject d)
   at System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
   at Autodesk.AutoCAD.ViewModel.CommandLine.CommandLineControl.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
   at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
   at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
   at System.Windows.DependencyObject.ClearValueCommon(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata)
   at System.Windows.DependencyObject.ClearValue(DependencyPropertyKey key)
   at System.Windows.BroadcastEventHelper.RemoveLoadedCallback(DependencyObject d, Object[] loadedPending)
   at System.Windows.BroadcastEventHelper.BroadcastLoadedEvent(Object root)
   at MS.Internal.LoadedOrUnloadedOperation.DoWork()
   at System.Windows.Media.MediaContext.FireLoadedPendingCallbacks()
   at System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()
   at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
   at System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget)
   at System.Windows.Interop.HwndTarget.OnResize()
   at System.Windows.Interop.HwndTarget.HandleMessage(WindowMessage msg, IntPtr wparam, IntPtr lparam)
   at System.Windows.Interop.HwndSource.HwndTargetFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
   at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
   at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)

Thanks,
Dmitriy

Hi @Dmitriy,

AutoCAD 2016 supports .NET. So there shouldn’t be any reason why you can’t get the project working.

Keep in mind the project was build for AutoCAD 2019. So you’ll need to do the following to get it to build:

1.) In the project’s properties -> application, change the target framework to .NET Framework 4.5.
2.) The project references 3 AutoCAD assemblies (accoremgd.dll, acdbmgd.dll, and admgd.dll). You will need to re-path these to your AutoCAD 2016 install location.
3.) Maybe more…

Hope this helps.

– Dale

Thanks, @dale

yes, I changed to 4.5 and also updated all AutoCAD assemblies.
Still the same error.

What should be added in the Post-build events? Regular code renaming .dll to .rhp?

Thanks,
Dmitriy

Nothing, the project builds a plug-in for AutoCAD not Rhino.

– Dale

Thanks @dale , it works now.
After running command in AutoCad, geometry (from TestCommands class) is being added.
Now the question: is it possible to open Rhino, similar as in Revit? Final aim is to get updates in AutoCad after these are completed in Rhino.

Thanks,
Dmitriy

I have no idea what this means. Can you provide more details on what you want to do or what problem you are trying to solve?

Also, keep in mind that AutoCAD can read Rhino 3dm files. Likewise, Rhino can read AutoCAD dwg files. This is not the case with Revit.

– Dale