Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X
I've got a feature for a flat pattern and in the model tree it shows two associated bend notes. Is there a way to access these notes using the J-link API to get the angles of the bends? or is there a different method to get bend quantity and bend angles for a sheet metal pattern?
I've tried inputting a solid, getting the features that are from the flat pattern, getting each feature and listing the sub types and then filtering by model items of the model item type axis which gives me the bend notes I believe which I have used for the bend quantity but now I just need the angle.
For Creo Parametric 9.0.4.0.
The Code I've used so far is in the picture attached
Solved! Go to Solution.
Hey Chris,
Thanks for the idea and help, unfortunately Creo doesn't report any other model items besides some dimensions, edges and planars under the flat pattern. However I did get it to work by listing all the model items for the solid rather than the flat pattern and selected all the ITEM_DTL_NOTE's and got all the text lines and filtered them with only the ones starting with "bend" then to get the angle, just an if statement if it contains "90_00" to get if the bend is 90 degrees.
Hi, so if I'm reading this correctly, you're getting a Solid in another method and using it as the input to this method. I guess that's the sheet metal part in question?
From that Solid you're getting all of the features with the feature type "flat pattern" (FEATTYPE_FLAT_PAT) into a Features object type. Then you're iterating through the Features to obtain the Feature and then using the method ListSubItems(null) to find all of the sub features as ModelItems. From there you're looking for ITEM_AXIS. Does Creo report any other types of model items? I'd expect to see possibly an ITEM_NOTE, in addition to the ITEM_DIMENSION? Creo would then have the standard note format in that note. I think that you should be able to cast the ModelItem to a Note object. From there, you could use Note.GetText to output the text as a string. Note that the Note object class is deprecated in favour of DetailNoteItem, but that extends DetailItem, not ModelItem. But, DetailItem extends ModelItem, so it should be possible to convert it to the correct object type, possibly through casting it. I've not tried that, but I think it should work.
Good luck! Let us know how you get on.
Just to add to my own reply: these are the notes I was talking about:
Looking at the API docs, you should be able to cast from ModelItem to DetailNoteItem, e.g.
DetailNoteItem bendNote = (DetailNoteItem) bendNoteModelItem;
Where bendNoteModelItem is the ModelItem that you extracted from the ListSubItems(null) method of the flat pattern.
Hey Chris,
Thanks for the idea and help, unfortunately Creo doesn't report any other model items besides some dimensions, edges and planars under the flat pattern. However I did get it to work by listing all the model items for the solid rather than the flat pattern and selected all the ITEM_DTL_NOTE's and got all the text lines and filtered them with only the ones starting with "bend" then to get the angle, just an if statement if it contains "90_00" to get if the bend is 90 degrees.
That's good info, thanks for sharing!