iLogicVault.addFile parent/child relations ship

iLogicVault.addFile parent/child relations ship

nch97FTV
Explorer Explorer
58 Views
1 Reply
Message 1 of 2

iLogicVault.addFile parent/child relations ship

nch97FTV
Explorer
Explorer

Hallo All
I am working on creating a code snippet that copy designs into a specific folder, the reason for this is the fact that the build in vault code snippets does not have a specific option for specifying a new path to copy to but rather copies to the same locations as the original file

 

My solution to this is doing a lot of local filemanagement, getting the part and drawing from vault, copy the files, changing the drawing reference, etc. 

All of this is done at assembly level

 

All of this is working fine, but getting the files into vault via ilogic is proving a bit difficult

I can do it manually by simply right clicking on the assembly and under setting include children and include related files (marked by red in picture below)

nch97FTV_0-1756726412611.png

 

However I would like it to be done by ilogic automatically

I have been trying to use the iLogicVault.AddFile function, but it specifically states that it should not be used on Assemblies and Drawings because it does not build parent/child relations

I have tried it a couple of times and indeed it seems I cannot right click on the part and use "open drawing form vault"

 

Could someone elaborate on how "parent/child" is define in Ilogic/Inventor, I have tried to find the definition in the reference material but with no luck

 

Would a part file be the "parent" and the drawing a "child" or vice versa ? 

 

Is there any why by ilogic to add this parent/child relationship ?

0 Likes
59 Views
1 Reply
Reply (1)
Message 2 of 2

nch97FTV
Explorer
Explorer

Dim assemDoc As AssemblyDocument
assemDoc = ThisApplication.ActiveDocument
Dim userParams As UserParameters
userParams = assemDoc.ComponentDefinition.Parameters.UserParameters
Dim param As Parameter


'['Getting MidSection 00170987
Dim mVaultFile17 As String = iLogicVault.GetFileByFullFilePath("$/Designs/skitser/NCH/OmegaConveyorParts/00170987.ipt") 'add ..., True) to enable check-out of downloaded file.
Dim mVaultFile18 As String = iLogicVault.GetFileByFullFilePath("$/Designs/skitser/NCH/OmegaConveyorParts/00170987.idw") 'add ..., True) to enable check-out of downloaded file.

If mVaultFile17 Is Nothing Or mVaultFile18 Is Nothing Then
Logger.Error("Vault file not found - Please double check that file exists in Vault.")
Else
Dim mNumSchmName As String = "Default"
Dim mNewVaultNum As String = iLogicVault.GetNewNumber(mNumSchmName)
Dim newNum As String = mNewVaultNum

param = userParams.AddByValue("MidSection", newNum, kTextUnits)
Dim oPath = ThisDoc.Path

Dim copyNamePrt As String = oPath & "\" & newNum & ".ipt"
Dim copyNameDrw As String = oPath & "\" & newNum & ".idw"

ThisApplication.FileManager.CopyFile("C:\WF-LSS\Designs\skitser\NCH\OmegaConveyorParts\00170987.ipt", copyNamePrt)

ThisApplication.FileManager.CopyFile("C:\WF-LSS\Designs\skitser\NCH\OmegaConveyorParts\00170987.idw", copyNameDrw)

Dim oPartDoc As Document
Dim oDrawDoc As Document

oPartDoc = ThisApplication.Documents.Open(copyNamePrt, False)
oDrawDoc = ThisApplication.Documents.Open(copyNameDrw, False)

Dim filePathPart As String = oPath & "\" & newNum & ".ipt"
Dim filePathDraw As String = oPath & "\" & newNum & ".idw"

'[Change read/write status of part file
If System.IO.File.Exists(filePathPart) Then
' Create a FileInfo object
Dim fileInfo As New System.IO.FileInfo(filePathPart)
' Toggle read-only status
If fileInfo.IsReadOnly Then
fileInfo.IsReadOnly = False
Logger.Info("Read-only status removed.")
Else
'fileInfo.IsReadOnly = True
Logger.Info("File set to read-only.")
End If
Else
Logger.Info("File not found: " & filePathPart)
End If
']

'[Change read/write status of drawing file
If System.IO.File.Exists(filePathDraw) Then
' Create a FileInfo object
Dim fileInfo As New System.IO.FileInfo(filePathDraw)
' Toggle read-only status
If fileInfo.IsReadOnly Then
fileInfo.IsReadOnly = False
Logger.Info("Read-only status removed.")
Else
'fileInfo.IsReadOnly = True
Logger.Info("File set to read-only.")
End If
Else
Logger.Info("File not found: " & filePathDraw)
End If
']

oPartDoc.PropertySets.Item("Design Tracking Properties").Item("Part Number").Value = newNum
oDrawDoc.PropertySets.Item("Design Tracking Properties").Item("Part Number").Value = newNum

oDrawDoc.File.ReferencedFileDescriptors(1).ReplaceReference(copyNamePrt)

oPartDoc.Save()
oDrawDoc.Save()

oPartDoc.Close()
oDrawDoc.Close()

iLogicVault.AddFile(copyNameDrw,"$/Designs/skitser/NCH/GPS",False,copyNamePrt)

'Component.Replace("00170987:1", copyNamePrt, True) 'Replacing component

End If
']

0 Likes