Import only missing parameters from xml?

Import only missing parameters from xml?

BStreeper
Participant Participant
484 Views
4 Replies
Message 1 of 5

Import only missing parameters from xml?

BStreeper
Participant
Participant

Is there a way to import only the parameters in an xml that a file is missing?

or import the parameters from an xml without changing those parameters in a file, if they already exist?

Currently we are developing a set of standard parameters in our company. As we add to this list, updating the existing files is a hassle.

 

For now I have a very simple logic that I have added to a form providing an import "button" (script for rule below).

This works, but it also resets any existing parameters with he same name to the "default" state., requiring them to be manually re-updated.

 

Is there a way to import the parameters, without changing values it they already exist in a file?

 

oDoc = ThisDoc.Document
iLogicVb.Automation.ParametersXmlLoad(ThisDoc.Document, “file location\Standard-params.xml")

 

0 Likes
Accepted solutions (1)
485 Views
4 Replies
Replies (4)
Message 2 of 5

pcrawley
Advisor
Advisor

An external iLogic rule with Try/Catch statements would probably do the trick.

 

Try parameterName1 <> 0

      'create the parameter here.

Catch

 

Repeat for each parameter you add.

 

Being an external rule, you only have one file to update, and you can run the rule on parts created before you invented the parameter (and rule).  Only those parameters which fail the Try statement will be created.

 

Importing XML > my skill set sorry.

Peter
Message 3 of 5

BStreeper
Participant
Participant

Well, after going through line by line in the exported xml, I discovered how to do this with a bit of code editing. 

In the code if you see

 

<value>something entered in this spot</value>

 

 

replace that line with the code below

 

<value />

 

 

This tells the system that no "default" value was entered, and it just accepts whatever was in that spot. 

Not sure that this is the most efficient way to do this, but it does let me keep a centralized list of importable parameters on the server

Would love a better "less labor intensive" way.

Maybe an "Export Parameters with values" and an "Export Parameters with out values" option?  The without should auto put the above string code into the values area.


Edit: Nope that didn't work either 😞

0 Likes
Message 4 of 5

pcrawley
Advisor
Advisor
Accepted solution

Try re-posting over here: Inventor iLogic and VB.net Forum - Autodesk Community

You might have more luck hitting the right kind of forum members.

Peter
Message 5 of 5

BStreeper
Participant
Participant
0 Likes