Copy Custom Parameters from one .ipt to Multiple.ipt's (Existing Files)

Copy Custom Parameters from one .ipt to Multiple.ipt's (Existing Files)

RockyBrown4134
Collaborator Collaborator
3,687 Views
23 Replies
Message 1 of 24

Copy Custom Parameters from one .ipt to Multiple.ipt's (Existing Files)

RockyBrown4134
Collaborator
Collaborator

Is ther a way to copy parameters from one part file to multiple part files? I have two parameters that I would like to add to multiple files at once.

 

The Example below, Cutlength already existin in the part files. I want to add the parameters FT and IN. My ultimate gole is to have feet and inches displayed in my parts list.

 

parameter.jpg

 

 

Thanks.

If this response answers your question, Please mark this response as "Accept as Solution"

Rocky Brown
AutoCAD 2020 / Inventor 2020 / Plant 3D
0 Likes
Accepted solutions (3)
3,688 Views
23 Replies
Replies (23)
Message 2 of 24

tschaeferZNBXX
Advisor
Advisor

I believe you have three options.

 

1. Save as a Template and use it to create any new models

2. Save copy as and change what is different

3. Create an excel file that has these parameters and link the file to that

Thomas "Matt" Schaefer
Engineering Tooling and Vault Manager for Material Handling Systems MHS


*AU Speaker 2018*
* AU Speaker 2017 *
==========================================================
Please use the "Accept as Solution" and "Give Kudos" functions as appropriate to further enhance the value of these forums.
0 Likes
Message 3 of 24

RockyBrown4134
Collaborator
Collaborator

@tschaeferZNBXX wrote:

I believe you have three options.

 

1. Save as a Template and use it to create any new models

2. Save copy as and change what is different

3. Create an excel file that has these parameters and link the file to that


FYI......

 

1) I have copied the parameters and they are in my template files.

2) I want to copy them to 1000+ existing files

 

If this response answers your question, Please mark this response as "Accept as Solution"

Rocky Brown
AutoCAD 2020 / Inventor 2020 / Plant 3D
0 Likes
Message 4 of 24

tschaeferZNBXX
Advisor
Advisor
Not sure but you might want to ask the Inventor Customization Forum, someone may have something written that can help without doing it one at a time.
Thomas "Matt" Schaefer
Engineering Tooling and Vault Manager for Material Handling Systems MHS


*AU Speaker 2018*
* AU Speaker 2017 *
==========================================================
Please use the "Accept as Solution" and "Give Kudos" functions as appropriate to further enhance the value of these forums.
Message 5 of 24

Curtis_Waguespack
Consultant
Consultant
Accepted solution

Hi RockyBrown4134,

 

Have a look at the attached file. Within it is an iLogic Form that will allow you to select some files and then batch process the creation of your parameters in those files. If you need to edit the parameter names or equation look at the ilogic rule called Create Parameters.

 

Batch Create Parameters.png 

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

 

 

EESignature

Message 6 of 24

RockyBrown4134
Collaborator
Collaborator

Curtis

 

I replied to the post in the Customization group copy-custom-parameters. I will also take a look at the file you attached.

 

Thanks.

If this response answers your question, Please mark this response as "Accept as Solution"

Rocky Brown
AutoCAD 2020 / Inventor 2020 / Plant 3D
0 Likes
Message 7 of 24

RockyBrown4134
Collaborator
Collaborator

FYI......

To give credit properly, I read a post Stevemattinly posted in feet-inches-in-part-list-column-workaround.

His reply had the parameters Length, FT, & IN defined. That is where I got the idea to redifine my Cutlength parameter and follow his thought process.

 

Thanks Steve for the insperation!

If this response answers your question, Please mark this response as "Accept as Solution"

Rocky Brown
AutoCAD 2020 / Inventor 2020 / Plant 3D
0 Likes
Message 8 of 24

Anonymous
Not applicable

You should be able to export the fx parameters from your template file and save it as an xml file.

 

save it as "master parameters.xml" or some such file name that explains that this is the master file.

 

Then when you open your old files that require the same parameters you should be able to import them from that same xml file.

 

The import and export function should be on the "Manage" tab within the drop down of the fx button

0 Likes
Message 9 of 24

RockyBrown4134
Collaborator
Collaborator

Curt;

I LIKE this! It's Sweet!

 

I have one thought, could the rule check for the parameter "Cutlength" before creating it? If it exists in the file, there is no need to re-create it.

 

I have not really explored iLogic that mutch. But I am inspired to learn more.

 

Thanks for you help.

If this response answers your question, Please mark this response as "Accept as Solution"

Rocky Brown
AutoCAD 2020 / Inventor 2020 / Plant 3D
0 Likes
Message 10 of 24

Curtis_Waguespack
Consultant
Consultant

@RockyBrown4134 wrote:

 

I have one thought, could the rule check for the parameter "Cutlength" before creating it? If it exists in the file, there is no need to re-create it.

 

 


Hi RockyBrown4134,

 

Yep, it should be doing that already, if it's not let me know. Or if you see it overwriting the value of that parameter when it already exists, let me know. But I think it should work as expected currently.

 

I set it up to check for and create each parameter in specific order, otherwise an error would occur when one parameter equation referenced a missing parameter.

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

EESignature

0 Likes
Message 11 of 24

RockyBrown4134
Collaborator
Collaborator

@Curtis_Waguespack wrote:

 

 

Yep, it should be doing that already, if it's not let me know. Or if you see it overwriting the value of that parameter when it already exists, let me know. But I think it should work as expected currently.

 

I set it up to check for and create each parameter in specific order, otherwise an error would occur when one parameter equation referenced a missing parameter.

 


Curt;

 

If the parameter Cutlength is in the part, the iLogic rule puts it in as Cutlegth_1 (see below). If the part does not have the paramerter, that's OK, I have to set the parameter anyway.

 

Thanks.

 

 

parameter2.jpg

 

 

If this response answers your question, Please mark this response as "Accept as Solution"

Rocky Brown
AutoCAD 2020 / Inventor 2020 / Plant 3D
0 Likes
Message 12 of 24

Curtis_Waguespack
Consultant
Consultant
Accepted solution

Hi RockyBrown4134,

 

Here's an updated version that handles this properly.

 

I am attempting to make this a bit more flexible, so that you can create parameters to be copied in this file and copy them out to the list of files, but I havne't had time today to get back to it.

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

EESignature

Message 13 of 24

RockyBrown4134
Collaborator
Collaborator

Curt;

 

Thanks! Works like a charm! I appreciate all of the assistance. This saved me alot of time!

 

Moderator: This is deserving of at least x10 Kudo's!

 

If this response answers your question, Please mark this response as "Accept as Solution"

Rocky Brown
AutoCAD 2020 / Inventor 2020 / Plant 3D
0 Likes
Message 14 of 24

tjvz85
Enthusiast
Enthusiast

Hi Curtis,

 

Is there a way to code the Part_Files_List and Action_List into a iLogic form, instead of having the parameter exist in a part or model file?

 

Basically, is it possible to have the Batch Copy Parameter form as a Global form, without needing the two parameters in the model file?

 

Regards and Kudo's for all your efforts

Theo

0 Likes
Message 15 of 24

Curtis_Waguespack
Consultant
Consultant

Hi @tjvz85 

 

I’d have to look at the code in the rule later to be sure, but typically what I do for an external rule is add a try/catch statement that first attempts to find the existing parameter in the active file and then creates it in the active file if not found.

 

When you bring up the global form and the parameter for the control doesn’t exist in the file, then the control ( meaning drop down box, radio button , etc ) is greyed out and has a strike though the text... so you’ll need to have a ‘Refresh Button’ that contains the try/catch statement to create the needed parameters at the beginning.

 

if you search the Inventor Customization forum you can likely find an example, but I’ll try and look back at this later when I’m in front of a computer.

 

i have a global batch form in place, so I’ll try to look later and see what other ‘gotcha’s might occur in converting this to a global form, but    it’s pretty straight forward.

 

Hope that helps, Curtis 

EESignature

Message 16 of 24

johnsonshiue
Community Manager
Community Manager

Hi @Curtis_Waguespack,

 

Would iLogic Export/Import XML Parameters work here?

Many thanks!



Johnson Shiue (johnson.shiue@autodesk.com)
Software Test Engineer
Message 17 of 24

tjvz85
Enthusiast
Enthusiast

Thanks @Curtis_Waguespack ,

 

I will check out the try/catch route in the meantime, but this still requires the parameters to be present in the file. Can I take it as fact that this must be the case, or do you think there is way to emulate those two parameters with code? Like an array for the Parts_Files_List and a option for the Action_List.

 

Let me know once you had a chance to look at your Global Batch Form.

 

Thanks for the advise

0 Likes
Message 18 of 24

Curtis_Waguespack
Consultant
Consultant
Accepted solution

@tjvz85 wrote:

Thanks @Curtis_Waguespack ,

 

I will check out the try/catch route in the meantime, but this still requires the parameters to be present in the file. Can I take it as fact that this must be the case, or do you think there is way to emulate those two parameters with code? Like an array for the Parts_Files_List and a option for the Action_List.

 

Let me know once you had a chance to look at your Global Batch Form.

 

Thanks for the advise


 

Hi @tjvz85 

You're correct, the controls in the ilogic forms require parameters as their basis, so unfortunately there is not a way to emulate the controls without having the parameters in the file like we can with for instance VBA forms.

 

... buttons use rules as their basis, so what I do is create a refresh rule/button to create the parameters needed for the other controls...

 

Within the rules that are used as the button there is the Try/Catch that creates the needed parameters.

 

So for a global form, the buttons are external rules, and the external rules contain the try/catch statements that create the needed parameters locally

 

If you look at the batch tool .ipt file attached in this thread and delete the two parameters ( Parts_Files_List and  Action_List ) from that part file, and then open the form you will see a strike through the parameters in the form, this is how the global version of this form would appear when first opened too:

 

image.png

 

If you click the Select Part Files button, it will run the rule called Select Part Files which contains two try/catch statements that will "refresh" the file and form by creating the needed parameters.

 

' Get the active document.  Assumes a part document is active.
Dim partDoc As PartDocument
partDoc = ThisApplication.ActiveDocument

' Get the UserParameters collection
Dim userParams As UserParameters
userParams = partDoc.ComponentDefinition.Parameters.UserParameters

'check for parameter and create if not found
Try
	oTest = Parameter("Part_Files_List") 
Catch
	'multi-value text parameter
	userParams.AddByValue("Part_Files_List", "< No Files >", UnitsTypeEnum.kTextUnits)
End Try
Parameter.Param("Part_Files_List").IsKey​ = True


Try
	oTest = Parameter("ActionList") 
Catch
	'multi-value text parameter
	userParams.AddByValue("ActionList", "Copy All Custom Parameters", UnitsTypeEnum.kTextUnits)
	MultiValue.SetList("ActionList", "Copy All Custom Parameters", "Delete All Custom Parameters")

End Try

'more code here....

 

So really this batch tool file has everything it needs to be made a global form already, but the rules would need to be made external rules and then the buttons recreated to use those external rules.

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

EESignature

Message 19 of 24

Curtis_Waguespack
Consultant
Consultant

@johnsonshiue wrote:

Would iLogic Export/Import XML Parameters work here?

Many thanks!



Hi @johnsonshiue , yep I think those methods would work very well too.

 

 

EESignature

0 Likes
Message 20 of 24

tjvz85
Enthusiast
Enthusiast

Thanks a lot for all your assistance @Curtis_Waguespack , you have been of great help.