Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
woodstylee3
in reply to: mikazakov

Hi, you appear to be trying to write to the active design project. I tend to find once files have been opened this is locked, and cannot be written to. It is also not always the file selected within the design project manager. Below is my code which is a bit messy but works, to get the currently selected project from the Context data passed with the button press..

 

Private Sub load_proj_options(Context As NameValueMap) Handles ss_OptButton.OnClick

 Dim x As Integer = 1

 Dim ds As String

 Dim dp As DesignProject = Nothing

 Do Until x = Context.Count

  If Context.Name(x) = "ProjectFileName" Then

     ds = Context.Item(x)

     x = x + 1

  End If

 Loop

 For Each design_project As Inventor.DesignProject In GlobalVars.m_inventorApplication.DesignProjectManager.DesignProjects

  If design_project.FullFileName = ds Then

     dp = design_project

  End If

 Next

 If Not (IsNothing(dp)) Then

   Dim n As New Proj_editor(dp)

      n.ShowDialog()

 End If

End Sub