Link User Parameters by selecting the part file to link to

Link User Parameters by selecting the part file to link to

nowell.colsenXK53F
Enthusiast Enthusiast
415 Views
4 Replies
Message 1 of 5

Link User Parameters by selecting the part file to link to

nowell.colsenXK53F
Enthusiast
Enthusiast

I'm trying to write ilogic code to link user parameters between file that will allow me to select the PART I want to drive my parameters from? I have a code that will work but I need to put the file path and name in the code, I can't get it to work if I try and select the part. The file with the parameters is a .ipt and the parameters to be linked are _1 in the comments. I'm just missing the select file to link to in my code. 

0 Likes
416 Views
4 Replies
Replies (4)
Message 2 of 5

dalton98
Collaborator
Collaborator

This is a post on the pick tool. This might be what your looking for.

https://forums.autodesk.com/t5/inventor-ilogic-and-vb-net-forum/ilogic-pick-function/td-p/7550908

0 Likes
Message 3 of 5

WCrihfield
Mentor
Mentor

Hi @nowell.colsenXK53F.  Just in case you were looking for more of a file dialog, so that you can select a file, instead of the Pick function, some code like this might be useful to you.  It is a simple custom Function with no 'input' variables, that will open a file dialog (just like when you use Inventor's Open dialog), but it doesn't actually open the selected file.  Instead it just returns the full file name of the selected file.

Sub Main
	oFileName = SelectFile
	MsgBox("oFileName = " & oFileName,,"")
End Sub

Function SelectFile() As String
	Dim oFileDialog As Inventor.FileDialog
	ThisApplication.CreateFileDialog(oFileDialog)
	oFileDialog.DialogTitle = "Select A File."
	oFileDialog.InitialDirectory = ThisApplication.DesignProjectManager.ActiveDesignProject.WorkspacePath
	oFileDialog.Filter = "Autodesk Inventor Files (*.iam;*.dwg;*.idw;*.ipt:*.ipn;*.ide) | *.iam;*.dwg;*.idw;*ipt;*.ipn;*.ide | All files (*.*)|*.*"
	oFileDialog.MultiSelectEnabled = False
	oFileDialog.OptionsEnabled = False
	oFileDialog.InsertMode = False
	oFileDialog.CancelError = True
	Try
		oFileDialog.ShowOpen
		Return oFileDialog.FileName
	Catch
		Return ""
	End Try
End Function

If this solved your problem, or answered your question, please click ACCEPT SOLUTION.
Or, if this helped you, please click (LIKE or KUDOS) 👍.

If you want and have time, I would appreciate your Vote(s) for My IDEAS :bulb: or you can Explore My CONTRIBUTIONS

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 4 of 5

WCrihfield
Mentor
Mentor

Are you starting your rule/code while a part document is open and the active document, or do you have an assembly document open & active when you start the rule/code.  Is this code in a 'local' rule (saved within the document) or an external rule?  Which version of Inventor are you using (year)?  If you are using Inventor 2022, are there any ModelStates involved?

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 5 of 5

nowell.colsenXK53F
Enthusiast
Enthusiast
The file being Linked is open and the file that is being linked to is not open. the rule is external and running on Inventor 2018. No model states are being invoke.
0 Likes