Part Builder Context Solution Part 1
Ok, at last, the end of the journey. We covered getting the model values out of an existing part. The remaining issue lies with what to do now that we have a mandatory context added to the structure type. Each time we create a new form of that structure type, that variable will be added to the Part XML file with all the other OEM required variables, such as “SHBTh”. This would not be a problem except that we still cannot get our non-OEM variables forced into the part model parameters.
As you may recall from earlier discussions, adding an existing catalog parameter to the model parameters is verboten. Consequently without some assistance, each new part would require yet another context parameter to be created in the list. Eventually the list of copies of the same variables would be ridiculous.
What we did figure out is that we can link a required context parameter that is created in the part XML, to a parameter we used in the model parameters.
The basic outline is as follows:
- Create the new part, using the proper structure type.
- Validate the part and save it.
- Create the model to its completion, adding any model parameters as needed.
- Configure the Required Context Parameter to be a range or a list as desired.
- Save the part and exit.
- Edit the Part XML, and change the MODEL parameter’s equation to equal the Required Context Parameter.
- Save the file and perform a catalog regen, and a catalog validation.
- Check the part validation file to confirm all is well. If it says there is a duplicate parameter, return to the Part XML, find the parameter definition that is a duplicate, and delete it so that only one parameter definition remains
Duplicate parameters sometimes occur when returning to edit the part file, configuring parameters, and then saving. The application will often add an additional body definition for any ranged model parameters that had their equations edited at the XML level.
In subsequent test of the same parts, the catalog seems to update, and the parameter change is accepted, and further edits in the part builder do not create this phenomenon.
Once the catalog regens good, the part can be added to the Parts List. Remember to restart Civil 3D just to be sure everything goes well.
In the image below, notice the Part Builder model parameter that shows bAng = SWAng.
SWAng was a temporary value I used to illustrate this example. We can use anything here, and I encourage you to use a numerical value instead. That is one less variable to deal with. We will replace value ‘SWAng’ in the XML file with the parameter ‘JLESl’, a REQUIRED context parameter that I created for this example. When I created and validated the new part, ‘JLESl’ came into the XML file configurations. Of course we cannot access it in the model, but we can configure it in the Parameter configurations:
Now that the configuration is complete, we can save and exit Part Builder. After opening the XML file, we verify the Context Parameter ‘JLESl’ is properly ranged, and then find the model parameter we want to control.
Now that bAng is pointed to JLESl (instead of whatever it might have been) the part list will look to the range to feed the model.
One thing that will always occur is that the model CONTINUES to believe that the model parameter equals whatever we had in the model. Each time we go back to part builder, and then save the part, the part builder rewrites the model definition to the state in the part builder model. Just remember if you have to make a revision, to go back into the Part XML file, and change the model parameter to equal the ranged context parameter. This should not be a problem since after getting the part configured, you will likely never return to it again.
This may sound like a great deal of work, but if you evaluate the steps, you are really only having to editht he XML 1 time, for 1 little change. That is all it takes, and it will:
- Allow you to make all the parts you want using the same Required Context Parameter
- Keep you from constantly editing the Context lists.
Just get the context list the way you want, and never have to go back to it either…..
….unless you created a new Part Structure Type……Forget it!!!!, I’m not going there….at least not for awhile.