I have some structural tubing which I have patterned. I have a macro that renames the description of the cut list item to the file name (disregarding the .sldflp) from the profile file location. This works for a weldment feature but fails on the patterned instances of that feature since those instances don't actually have a file location for that profile. Is there a way to look at the parent weldment feature from which the patterned instances were created? What I would like to do is if a body in the ith cut list item was created by a pattern, the code would look at the driving parent weldment feature that was used in the pattern feature. Once I point to this parent, I can get the file location of the profile used in the weldment feature from which I get the description and use in my cut list properties.
Looking at the example file that I've attached, you can see in the cut list properties that the description for TUBE-SQUARE, 3 X 3 X 0.25 and TS3x3x0.25 are not the same. Both should be TUBE-SQUARE, 3 X 3 X 0.25. The reason why the description does not get formatted as I intended was mentioned above; the cut list item is a patterned instance, hence no profile file location.
Initially, I would change the cut list description to read what the cut list item name was, i.e TUBE-SQUARE, 3 X 3 X 0.25. I then began to think, what if a part has say 100 structural members and the creator of the part got lazy and didn't name the cut list items accordingly? This is when I decided to go the route of using the file name of the weldment profile used to create the description of the cut list item property. This way, the formatting of the description and name will always be the same between like cut list items.
UPDATE:
I found a solution. I check to see if the parent feature GetTypeName="WeldMemberFeat". If it is, then I look at the data from the parent feature .GetDefinition. Now I can get the file name.
SolidworksApi/macros