This post will give you directions about parameter value manipulation regarding library packages, using a replacement file, and the LP_XMLConverter tool.
This tutorial can help you if you:
- develop library parts containing text symbol parts for multiple platforms (Windows/OS X)
- develop library parts used in plans with different attribute sets
- have library parts needed for different customer, using different default settings (standards are not always the same in every market)
- have library parts purposed for both type of countries with metric/imperial systems (you can assign rounded values to metric parameters to look “good” in imperial units)
- just need an easy way to manipulate default values of your library parts
The things needed for this feat are the following:
- the LP_XMLConverter tool, and a little practice using it
- your library parts converted to .xml format
- a replacement file
The first 2 ingredients are ready if you use the tool as described here.
If you download the example materials, a template file for replacement becomes available as well.
Locate the first parameter in the library part you want to assign different default under certain circumstances. Use any code editor to open the .xml file.
In the example object, we have a surface parameter (“gs_top_mat”) for the table we want to set differently for one customer:
<Material Name="gs_top_mat"> <Description><![CDATA["Tabletop Surface"]]></Description> <Fix/> <Flags> <ParFlg_Child/> </Flags> <Value>77</Value> </Material>
In package “A” it is fine with 77, but in package “B”, 78 should be the right default surface.
First, assign a meaning keyword to the parameter’s value (Meaning=”TableTopSurface”):
<Material Name="gs_top_mat"> <Description><![CDATA["Tabletop Surface"]]></Description> <Fix/> <Flags> <ParFlg_Child/> </Flags> <Value Meaning="TableTopSurface">77</Value> </Material>
Notice we did not change the parameter value!
Next, create a new .xml file with the following content (or use the example template replacementdef_B.xml):
<ReplacementDef> <ReplacementItem Meaning="TableTopSurface" Value="78"/> </ReplacementDef>
This is the place where the changed value should be stored and set.
More parameters with different default settings for package “B” in the example:
- “bGlazed” should be OFF (
- “fontType” should have different types on WIN and OS X (
<ReplacementDef> <ReplacementItem Meaning="TableTopSurface" Value="78"/> <ReplacementItem Meaning="GlazingDisplay" Value="0"/> <ReplacementItem Meaning="FontStyle" WinValue="Arial Unicode MS" MacValue="Lucida Grande"/> </ReplacementDef>
Notice the format of different Windows and OS X replacement values.
We are all set now. Open a command prompt/terminal window, and use the LP_XMLConverter with the following input parameters to create package “A” (no replacement):
"pathOfLP_XMLConverterExecuteable" x2l -img "imageFolderPath" "xmlFolderPath" "binaryFolderPath_A"
"pathOfLP_XMLConverterExecuteable": the path of the converter on your computer
"imageFolderPath": the folder containing the images of the .xml library part (preview, UI, stb.). See Replacement_images in example.
"xmlFolderPath": the path of the .xml format library parts, containing the Meaning keywords. See folder Replacement_XML in example.
"binaryFolderPath_A": the path of the binary format library parts (they will be created with the defaults set in libpart .xml file). Use Replacement_BIN_A for example testing.
Next, do the same for package “B”, by adding the
-def "pathOfReplacementFile" input parameter for the tool:
"pathOfLP_XMLConverterExecuteable" x2l -def "pathOfReplacementFile" -img "imageFolderPath" "xmlFolderPath" "binaryFolderPath_B"
"pathOfReplacementFile": the path of the replacement definition file. Use replacementdef_B.xml for testing the example.
"binaryFolderPath_B": the path of the binary format library parts (they will be created with the defaults set in the replacement file). Use Replacement_BIN_B for example testing.
In the example, we will have the following result of the set defaults:
The font is different, the surface is different, and the glazing is OFF in package “B”.
Note: the object GUID is not changed during the process (so do not load both packages into the same ARCHICAD, else you get a duplicate warning).