Re: How do I access another api using Ironpython and VS2017

jpahto@...
 

I have defined the search path for Solidworks\api\redist on VS2017.

I have defined in code:
   clr.Addreference("Solidworks.Interop.sldworks")
   import Solidworks.Interop.sldworks as swApp
   swApp.SldWorks.ActivateDoc() # Activate the currently open document on Solidworks
   Title = swApp.ModelDoc2.GetTitle()  # Idea is to get the file name as string

On __init__:
   self.ent = self.FindName('ShowFileName') # Get textbox name
   self.ent.Text = Title  # Show file name as textbox text

It feels like I'm not creating an instance to access the class correctly. This feels \\\// logically correct way for me, but I do not yet understand correctly the idea behind .NET and IronPython.
If I comment all the lines and release them one by one, the WPF Application stops working after I release the ActivateDoc line.

Join users@ironpython.groups.io to automatically receive all group messages.