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: 

Check Out Drawings - Inventor 7 VB

0 REPLIES 0
Reply
Message 1 of 1
Anonymous
115 Views, 0 Replies

Check Out Drawings - Inventor 7 VB

I have a program that saves the part to the disk. On my PC, the process inclused checking out the part. On other user's machines, this does not happen. The only difference between the two is mine has native VB6 installed on it - which I hope is irrelevant since I am doing everything in VBA for Inventor 7. Is there some setting that is not setup properly on the other PCs? Or is there something I need to add to my code? What is happening is that if the part cannot be checked out, the user has to exit Inventor and reload it everytime a new part number is pulled. In other words, even manually checking out the part does not work! Any help that can be provided with this problem is greatly appreciated! Private Sub SavePartToDisk() ' Get Workgroup path ' Dim CPX As String - Make Public Dim len2 As Long Dim len3 As Long Dim JobPath As String Dim chx As String Dim chx2 As Integer Dim csx As Integer len2 = Len(CPX) ' Length of FileLocationsFile Debug.Print len2 For C = len2 To 1 Step -1 ' Evaluate string characters backwards chx = Mid(CPX, C, 1) ' Character Debug.Print ch If chx = "\" Then csx = C + 1 ' determine starting character after '\' chx2 = chx2 + 1 If chx = "\" And chx2 >= 2 Then Debug.Print chx & "!" Exit For End If End If Next C JobPath = Left(CPX, (csx - 1)) & "Parts\" Debug.Print JobPath ' Save Part to disk ' Dim oPartDoc2 As Inventor.Document - Make Public If ThisApplication.ActiveDocumentType = kPartDocumentObject Then Set oPartDoc2 = ThisApplication.ActiveDocument ElseIf ThisApplication.ActiveDocumentType = kAssemblyDocumentObject Then Set oPartDoc2 = ThisApplication.ActiveEditObject len3 = Len(oPartDoc2.FullFileName) Debug.Print len3 Debug.Print oPartDoc2.FullFileName Debug.Print Right(Left(oPartDoc2.FullFileName, (len3 - 5)), 4) End If ' Must define if in edit mode! Dim X As String If ThisApplication.ActiveDocumentType = kAssemblyDocumentObject Then X = oPartDoc2.DocumentType Debug.Print X If X <> "12290" Then MsgBox "A Component Must be Created or Edited before a New Part No can be Assigned." Exit Sub End If End If If ThisApplication.ActiveDocumentType = kPartDocumentObject Then If oPartDoc2.FullFileName = "" Then Call oPartDoc2.SaveAs(JobPath & PN & ".ipt", False) Else Dim ans As Integer ans = MsgBox("The Current File will be Lost if not Saved, Continue? ", vbYesNo) If ans = 6 Then Call oPartDoc2.SaveAs(JobPath & PN & ".ipt", False) ElseIf ans = 7 Then EP = 0 ' Do not Append PN, Update Properties or Get Next BN End If End If ElseIf ThisApplication.ActiveDocumentType = kAssemblyDocumentObject Then ans = MsgBox("The Current File will be Replaced if not Saved, Continue? ", vbYesNo) If ans = 6 Then Call oPartDoc2.SaveAs(JobPath & PN & ".ipt", False) MsgBox "The Part has been changed - the new Part Number is: " & PN & ". An Update will show the effected change." ElseIf ans = 7 Then EP = 0 ' Do not Append PN, Update Properties or Get Next BN End If End If End Sub
0 REPLIES 0

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

Post to forums  

Autodesk Design & Make Report