How would I go about using these API commands to link the stock sizes to my BOM? Currently I have to measure each part and then manually enter the stock size. I would rather have it automated if possible.
This is how I do it. Once I have my part modeled I measure the x-y-z lengths. Do not do this is a sketch. Just use the measure tool to dimension. The dimensions will show on the part. Next I create a custom property called overall size. I populate the custom property by clicking the dimensions in the graphics area. Next go to the annotaions folder at the top of the tree and right mouse click. Select turn off annotaions. The dimesions dissapear. You need to create a custom BOM template with a field for the value in my case the field is called "overall size" When you insert the BOM into a drawing that field will be automatically populated with the dimensions you picked. You can also use the custom property in other places like the drawing title block.
The dimensions are fully linked to the part and if the part changes the dimensions will update to reflect the change. Other than a macro this is the only way I know of doing this.
Sorry. I said "just use the measure tool to dimesion". That was incorrect. Dimension the part using the dimension tool (same one you would use if dimensioning a sketch)just don't do it in a sketch.
An alternative to Rockguy's method is to start the main body of the model with the "stock size" lump of material and then manipulate or "machine" it as you would on the shop floor.
The stock size lump xyz dimensions can then be referenced (as Rockguy states)into the customized BOM or anywhere else you require.