Add-In not loading (Rider IDE)

Add-In not loading (Rider IDE)

MegaLutt
Observer Observer
303 Views
1 Reply
Message 1 of 2

Add-In not loading (Rider IDE)

MegaLutt
Observer
Observer

Hello! I'm a newby in programming, i have only 3 month in Inventor API via C# direct work, but now i need to make some Add-In's to work with specification. Unfortunatly, i'm JetBrains Rider IDE user, so i "re-make" VS original samples.

A found a few HOW-TO's and went through first steps, in result i can see my Add-In and information in Inventor, but as soon as i try to load it - nothing happens.
Also i connect to Inventor process to debug, but all Errors that i see are those in ref. What am i doing wrong? How can i see why my Add-In is visible, but not loading?

 

Ref:

System.Windows.Data Error: 40 : BindingExpression path error: 'Current' property not found on 'object' ''QuickAccessUndoButton' (HashCode=47915903)'. BindingExpression:Path=Current; DataItem='QuickAccessUndoButton' (HashCode=47915903); target element is 'ContentPresenter' (Name=''); target property is 'NoTarget' (type 'Object')
System.Windows.Data Error: 40 : BindingExpression path error: 'Current' property not found on 'object' ''QuickAccessRedoButton' (HashCode=22724462)'. BindingExpression:Path=Current; DataItem='QuickAccessRedoButton' (HashCode=22724462); target element is 'ContentPresenter' (Name=''); target property is 'NoTarget' (type 'Object')


My Add-In code:

using System;
using System.Runtime.InteropServices;
using Inventor;
using Microsoft.Win32;
using Application = Inventor.Application;

namespace SimpleSpecification
{
/// <summary>
/// This is the primary AddIn Server class that implements the ApplicationAddInServer interface
/// that all Inventor AddIns are required to implement. The communication between Inventor and
/// the AddIn is via the methods on this interface.
/// </summary>

[GuidAttribute("69B0E76B-C139-41C7-A88F-030ED1E19448"), ComVisible(true)]
public class AddIn : ApplicationAddInServer
{
// Inventor application object.
private Application? _mInventorApplication;

public AddIn(Application? mInventorApplication)
{
_mInventorApplication = mInventorApplication;
}

#region ApplicationAddInServer Members

public void Activate(ApplicationAddInSite addInSiteObject, bool firstTime)
{
// This method is called by Inventor when it loads the addin.
// The AddInSiteObject provides access to the Inventor Application object.
// The FirstTime flag indicates if the addin is loaded for the first time.

// Initialize AddIn members.
_mInventorApplication = addInSiteObject.Application;
MessageBox.Show("Success load!");
}

public void Deactivate()
{
// This method is called by Inventor when the AddIn is unloaded.
// The AddIn will be unloaded either manually by the user or
// when the Inventor session is terminated

// TODO: Add ApplicationAddInServer.Deactivate implementation
MessageBox.Show("Success unload!");
// Release objects.
_mInventorApplication = null;

GC.Collect();
GC.WaitForPendingFinalizers();
}

public void ExecuteCommand(int commandID)
{
// Note:this method is now obsolete, you should use the
// ControlDefinition functionality for implementing commands.
}

public object? Automation
{
// This property is provided to allow the AddIn to expose an API
// of its own to other programs. Typically, this would be done by
// implementing the AddIn's API interface in a class and returning
// that class object through this property.

get
{
// TODO: Add ApplicationAddInServer.Automation getter implementation
return null;
}
}

#endregion

}
}
0 Likes
304 Views
1 Reply
Reply (1)
Message 2 of 2

MegaLutt
Observer
Observer

Solved:
1) If you have no visual studio installed, install .Net Framework v4.5.1 and use it in your project (i used core net7.0, that was an issue).
2) Put your .addin file in
a) C:\Users\****\AppData\Roaming\Autodesk\Inventor 2023\Addins

AND

b) C:\ProgramData\Autodesk\Inventor 2023\Addins
3) be sure your .addin file have direct way to your .dll in <Assembly></Assembly> part!

0 Likes