Transfer ipt´s parameters

Transfer ipt´s parameters

iva.btblan
Advocate Advocate
981 Views
8 Replies
Message 1 of 9

Transfer ipt´s parameters

iva.btblan
Advocate
Advocate

Transfer the information to other files.

I'm not getting.

Can anyone help me understand?

Thanks!

Iva.btblan

0 Likes
Accepted solutions (2)
982 Views
8 Replies
Replies (8)
Message 2 of 9

Sergio.D.Suárez
Mentor
Mentor

I can't open your file because I have Inventor 2020 installed.
Are you trying to copy a user parameter definition from one file to another file? Grettings!

 


Please accept as solution and give likes if applicable.

I am attaching my Upwork profile for specific queries.

Sergio Daniel Suarez
Mechanical Designer

| Upwork Profile | LinkedIn

0 Likes
Message 3 of 9

iva.btblan
Advocate
Advocate

Thanks for listening!

I need to transfer all parameters to other files.

I don't understand and I can't do it.

I'm sending the files again.

Can you help me?

0 Likes
Message 4 of 9

Martin-Winkler-Consulting
Advisor
Advisor

Use Parameter export / import as xml file.

You can choose in the options wether all parameters or only key parameters are exported.

 

3DCS-GmbH_Dienstag, 21. April 2020_15h08m16s_005_.jpg

Martin Winkler
CAD Developer
Did you find this post helpful? Feel free to like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.


EESignature

0 Likes
Message 5 of 9

iva.btblan
Advocate
Advocate

I have 546 files.

I want to transfer all information to everyone.

Performing the transfer one at a time is a lot of time wasted

0 Likes
Message 6 of 9

Martin-Winkler-Consulting
Advisor
Advisor

@iva.btblan 

Nice Tool, did you write it?

There is some code in Rule Create Parameter that throws an exception.

I do not understand the sense of this code.

Disable the code and try again.

 

3DCS-GmbH_Dienstag, 21. April 2020_17h28m54s_007_.jpg

Martin Winkler
CAD Developer
Did you find this post helpful? Feel free to like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.


EESignature

0 Likes
Message 7 of 9

iva.btblan
Advocate
Advocate

I would like to contact Mr. Curtis W.

About the material from that address:  https://forums.autodesk.com/t5/inventor-customization/copy-custom-parameters-from-one-ipt-to-multipl...

 

Fantastic subject and I want to take some questions.

 

Thanks!

0 Likes
Message 8 of 9

Sergio.D.Suárez
Mentor
Mentor
Accepted solution

Sorry for the delay in responding, I have been very busy this week.
I have seen several errors in the rules, and I have modified some approaches to adapt it to my working method.
First in your file, to access each part file from the list you define it through item (this will give the fullfilename of the file, this is a string) and you need to specify an integer to access each item in the multivaluelist.
On the other hand, when you defined a mass, you have had a conflict of units, that is why in your file the expression remains in red, to fix it I have placed the string "kg / cm ^ 3"

01.jpg
What I modify below is the focus, and I hope it is what you will need for parameter copying. Work with subroutines, remove the "create parameter" and "delete parameter" rules and enter them in the "batch rule". I did this to simplify the commands.

02.jpg
So, you first create the parameters you need, in your main file that contains the form. These parameters can be text, boolean or numeral. They can also be multivaluelist.
Once you have created all the parameters you can open the form and select all the part files to which the previously created user parameters will be copied.
Then run the rule and open the files to verify that the copying has been done correctly.

Here I show you the changes made in the Batch Rule

Sub main

oRUSure = MessageBox.Show("Are you sure you want to:  " & vbLf & "   " & Parameter("ActionList"), _
 "Start Batch Process?",MessageBoxButtons.YesNo,MessageBoxIcon.Question)

If oRUSure = vbNo Then Exit Sub

Dim doc As PartDocument = ThisDoc.Document
Dim oCD As PartComponentDefinition = doc.ComponentDefinition

'[ batch process the list Of files -----------------------------------------------------

If Parameter("Part_Files_List") = "< No Files >" Then 
	MessageBox.Show("There are no files in the list.", "iLogic",MessageBoxButtons.OK,MessageBoxIcon.Information)
	Exit Sub
End If

Dim invDoc As Document

For i As Integer = 0 To MultiValue.List("Part_Files_List").Count - 1
	'open the indexed file, false opens the file without generating the graphics
	invDoc = ThisApplication.Documents.Open(MultiValue.List("Part_Files_List").Item(i), False) 

	If Parameter("ActionList") = "Delete All Custom Parameters" Then
		For Each oParam As Inventor.Parameter In invDoc.componentdefinition.Parameters.UserParameters
			Try
			oParam.Delete
			Catch
			End Try
		Next
	Else ' Copy All Custom Parameters from main Document to InvDoc
		Try
			For Each oParam As Inventor.Parameter In oCD.Parameters.UserParameters
				If oParam.Name <> "Part_Files_List" And oParam.Name <> "ActionList" Then
					checkParam(oParam, invDoc.componentdefinition )
				End If
			Next
		Catch
		End Try
	End If
	invDoc.update
	invDoc.Save
	invDoc.close
Next
']

iLogicVb.UpdateWhenDone = True

MessageBox.Show("Batch processing files is complete.", "iLogic", MessageBoxButtons.OK, MessageBoxIcon.Information) 

End Sub 


Sub checkParam(oParam As Inventor.Parameter, RefCD As PartComponentDefinition)

Dim oUserParameters As UserParameters = RefCD.Parameters.UserParameters

Dim oList As New ArrayList, oExprList As ExpressionList

If oParam.ExpressionList.Count = 0 Then
	Try
		If oUserParameters(oParam.Name).Units = oParam.Units Then
			oUserParameters(oParam.Name).Expression = oParam.Expression
		Else
			oUserParameters(oParam.Name).Delete
			oUserParameters.AddByExpression(oParam.Name,oParam.Expression,oParam.Units)   ' AddByValue(oParam.Name, oParam.Value, oParam.Units)
		End If
	Catch
		oUserParameters.AddByExpression(oParam.Name,oParam.Expression,oParam.Units)' .AddByValue(oParam.Name, oParam.Value, oParam.Units)
	End Try
Else
	Try
		Dim List(0 To oParam.ExpressionList.Count - 1) As String
			
		For t As Integer = 0 To oParam.ExpressionList.Count-1
			List(t) = oParam.ExpressionList(t+1)
		Next
		
		Try
			If oUserParameters(oParam.Name).Units = oParam.Units Then
				oExprList = oUserParameters(oParam.Name).ExpressionList
				Call oExprList.SetExpressionList(List, False) 
				oUserParameters(oParam.Name).Expression = oParam.Expression
			Else
				oUserParameters(oParam.Name).Delete
				oUserParameters.AddByExpression(oParam.Name,oParam.Expression,oParam.Units)
				oExprList = oUserParameters(oParam.Name).ExpressionList
				Call oExprList.SetExpressionList(List, False)
				oUserParameters(oParam.Name).Expression = oParam.Expression
			End If
		Catch
			oUserParameters.AddByExpression(oParam.Name,oParam.Expression,oParam.Units)
			oExprList = oUserParameters(oParam.Name).ExpressionList
			Call oExprList.SetExpressionList(List, False)
			oUserParameters(oParam.Name).Expression = oParam.Expression
		End Try
	Catch
	End Try
End If

End Sub

I share the file for those who want to download and analyze it, but it is in the Inventor 2020 version and it says you have 2015, so put part of the main code snippet


Hope this helps with your problem, or throws in some new idea so you can solve it. Cheers!


Please accept as solution and give likes if applicable.

I am attaching my Upwork profile for specific queries.

Sergio Daniel Suarez
Mechanical Designer

| Upwork Profile | LinkedIn

0 Likes
Message 9 of 9

iva.btblan
Advocate
Advocate
Accepted solution

Thank you!
Wonderful!
I am very grateful for your help.

That help of yours was something of great joy.
Thank you!

0 Likes