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: 

Inventor 2024 Need help with Copy Vault File using Vault Numbering

1 REPLY 1
SOLVED
Reply
Message 1 of 2
acanx21
199 Views, 1 Reply

Inventor 2024 Need help with Copy Vault File using Vault Numbering

I have not been able to find much documentation about how to use this new rule in Inventor 2024. 

If I have iproperties that correspond to the different fields for the selected numbering scheme, what do I need to add where I highlighted the text red to make the code work? 

 

 

	'Set the name of the numbering scheme or use 'Default' to use the pre-set scheme
	Dim mNumSchmName As String = "Default"
	'Optionally collect input values for file the selected numbering scheme; use the order of the fields as configured in the scheme;
	Dim mNumInput As New System.Collections.Generic.List(Of String) 'add UDP.DisplayName, Value Pairs
	
	'returns full file name in local working folder (download enforces override, if local file exists)
	'returns "FileNotFound if file does not exist at indicated location
	Dim mVaultFile As String = iLogicVault.GetFileCopyBySourceFileNameAndAutoNumber("$/Designs/Inventor Sample Data/Fishing Rod Model/001012.ipt", mNumSchmName, , False) 'optionally add the mNumInput variable; note - the CheckOut flag is an option also; default = True.
	If mVaultFile Is Nothing Then
		Logger.Error("File copy not created; check that the file can get found first." )
	Else
		Logger.Info("File " & mVaultFile & " created As copy.")
			'add next action using the downloaded file here, e.g. Component.Replace("Part1:1", mVaultFile, True)
	End If

 

 

Tags (1)
Labels (3)
1 REPLY 1
Message 2 of 2
acanx21
in reply to: acanx21

Figured it out. I switched to the Get New Vault File Number code since that was closer to my end goal but the stuff I added below got me the next part number available in the specified numbering scheme

 

	'Set the name of the numbering scheme or use 'Default' to use the pre-set scheme. I set it to our numbering scheme "Project Parts"
	Dim mNumSchmName As String = "Project Parts"
	'Dim mNumSchmName As String = "Default"
	
'Getting my iproperties that correspond to fields in numbering scheme written to parameters proj = iProperties.Value("Project", "Project") class = iProperties.Value("Custom", "Class") prof = iProperties.Value("Custom", "Profile") 'Optionally collect input values for file the selected numbering scheme; use the order of the fields as configured in the scheme; Dim mNumInput As New System.Collections.Generic.List(Of String)
'Skipped fields for delimiters and auto-sequential but every other field got included below mNumInput.Add(proj) 'project mNumInput.Add(class) 'class mNumInput.Add(prof) 'profile
'converting to an array Dim mNumInputArray As String() = mNumInput.ToArray() 'Create single file number by scheme name and optional input parameters; returns new number or error message "GetNumberFailed" Dim mFileNumber As String = iLogicVault.GetNewNumber(mNumSchmName, mNumInputArray) If mFileNumber Is Nothing Then MsgBox("This didn't work") Else Dim mFullFileName As String = ThisDoc.Document.FullFileName newpath = ThisDoc.Path & "\"
'will change this to get the file extension from existing file but for now just defaulted to "ipt" ThisDoc.Document.SaveAs(newpath & mFileNumber & ".ipt", False) End If

 

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

Post to forums  

Technology Administrators


Autodesk Design & Make Report