I'm trying to delete, programatically, a specific dimensions on a specific sheet of my drawing based on a model parameter. I imagine it would be pretty straightforward to refer to generaldimensions.item(?).delete but how do I know what the index number of the dimension I want is? The only samples I can find either generacially access item(1) or use a for each loop to get all dimensions.
Solved! Go to Solution.
One hackish option might be to cache all dimensions, then change the model parameter and se which dimension changes and delete it. Prolly not gonna work in general.
You can use attributes to "tag" the drawing dimensions of interest. There is an excellent introduction to attributes at Brian Ekins' blog here. You will have to add an attribute to each of the drawing dimension in question. The attribute value should identify the controlling model parameter by name.
Your program will have to loop through all drawing dimensions' attribute sets to find relevant attributes. Upon finding one, it should look up the value of the model parameter and determine whether to delete the drawing dimension (e.g. delete if parameter value = 0, preserve otherwise).
I can try to dig up a code snippet if you like.
That was the clue I needed! I didn't know about attributes. It's a rather clumsy mechanism (having to read and write the attributes programtically) but it works well once it's in place. I think my boss will be happy with this set up, thanks!
Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register
Start with some of our most frequented solutions to get help installing your software.