Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Windows Form (C#) in "Add-In" does not work, but it works when it starts in Visual Studio

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
Hubert_Los
191 Views, 2 Replies

Windows Form (C#) in "Add-In" does not work, but it works when it starts in Visual Studio

Hello,

I have created a program in C# with "Windows Forms". Everything works when I start program in VS and use the active instance of Inventor :
"MarshalCore.GetActiveObject("Inventor.Application") as Inventor.Application"

I created a second application that adds this functionality to the ribbon. But the form does not work the same way as in the first program.

For example, a simple button that closes a form does nothing:

 

 

        private void btnClose_Click(object sender, EventArgs e)
        {
            this.Close();
        }

 

 

Another button that starts selecting lines in the drawing stops at the selected place and I can't select the line. (in first program it works) Should I somehow hide the form window? How to do it?

 

 

        private void btnCreateSymetricAnnotates_Click(object sender, EventArgs e)
        {

            selectedCurve = (DrawingCurveSegment)m_inventorApp.CommandManager.Pick(SelectionFilterEnum.kDrawingCurveSegmentFilter, "Select curve"); //stop here
.
.
.
         }

 

 





I would also like to ask how to get the Inventor.Application variable in the Add-In. Currently, I am still using :

 

 

m_inventorApp = MarshalCore.GetActiveObject("Inventor.Application") as Inventor.Application;

 

 

 

The code works, but maybe it would be correct to use another way?



Tags (3)
2 REPLIES 2
Message 3 of 3
Hubert_Los
in reply to: Hubert_Los

Hello,

I found where the problem was. I copied the windows form to the second project and something copied wrong. I don't know what yet, but when I created a new form it worked.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report