just thinking through the equations a bit - I think you need to lock down one more variable, probably the hole to hole spacing...
you may also want to look at the fill pattern feature.
Attached is a part file showing how I would go about something like this.
The idea is to create a seed feature for what you want to repeat. You position this seed feature either in the middle or offset depending on if you need an even or odd quantity. You use equations to determine that. Then you pattern that feature in two directions - in this case opposite directions on the same axis.
To determine how much length you have available to place features, start with the total length of your plate and subtract the areas not available. In this case it would be the Minimum edge offset (X2 to subtract each end) plus your feature width (or half of your feature width X2 to subtract each end). Your feature width is the hole diameter.
To determine the quantity of features, divide your available length by the feature spacing and add 1 more. You can't have partial features, so use the int() function to return only the whole number portion.
There is a need to determine whether you need and odd or even quantity of features. The MOD() function is great for this but with the SW2012 and later equation manager, getting non-listed VBA functions to work can be tricky. I couldn't get the equation manager to accept a MOD() function so I came up with an alternative. If someone out there can get the MOD() working it will be a cleaner approach.
To determine odd vs. even we check if our quantity / 2 is a whole number. To do this we compare int(quantity/2) to (quantity/2). If (quantity/2) is not a whole number - odd - the int() function strips off the decimal and the two items being compared are not equal.
Read down through the equations and see if it makes sense.
Changing Qty of features.SLDPRT.zip 103.7 KB