Community Tip - You can change your system assigned username to something more personal in your community settings. X
Hello
I am trying to read the length of a pipe that is created from a family table.
I read the parameter TOTAL_LENGTH but this gives me the value of the generic pipe and not of the instance.
How can I get the correct value of the pipe length?
Thank you
Regards
Looks like you get parameters from ModelItem of generic model, not of the instance.
Can you share a part of you code for better understanding?
Hello
Here is my code:
private static Double getPipeLength(Solid solid) { try { ModelItems dimensions; dimensions = solid.ListItems(ModelItemType.ITEM_DIMENSION); for (int i = 0; i < dimensions.getarraysize(); i++) { ModelItem array_element = dimensions.get(i); Dimension axisElement = (Dimension) array_element; if (axisElement.GetName().equals("TOTAL_LENGTH")) { return axisElement.GetDimValue(); } } } catch (jxthrowable e) { } report(" Zero length pipe for " + Helper.getSolidName(solid) ); return (double) 0; }
Thank you
Regards
A few questions:
1) What version of Creo are you running your code in?
2) What sort of Pipe is this? Is this a "Pipe" feature that is created via Pro/PIPING? or a "Pipe Feature"? or is it an Extrude? or are you simply trying to read the value of a parameter in the Family Table?
If you are using a "Pipe Feature":I haven't tested this myself yet... but I believe you may be able to grab the curves of the Pipe Feature? Worst case scenario, since you know the dimension name, you could always try to find the dimension itself "by name" and read the value from there.
If you are using the Pro/PIPING application:The only way that I've ever been able to do this "properly" is by using the "ProPNetwork" object in Pro/TOOLKIT. You would visit all the ProPseries (and so on) to be able to find the lengths of all the curves, and add them together. We use these Piping Objects for many of our Toolkit AutoRouting and Spec-Driven Piping applications.
If it is an Extrude Feature:
You should be able to pull the dimensions or ProCurve feature directly from the model. Use ProFeatureGeomitemVisit to collect the lengths of the curves in the feature.
If you are trying to read the value of the parameter in a Family Table:
One thing to note about working with Family Tables in Pro/TOOLIT: If you are trying to simply read the value of the "Parameter" - then you'll always get the value from the generic.
Instead, you'll need to find the "ProFamtableInstance" for the instance (or "Row") that you want.
From there, find the "ProFamtableItem" (or "Column") that you want (aka the column of the parameter).
Finally, you would use "ProFamtableItemToParameter" to convert this into something useful, so you can read the value of the cell.
Hope this helps!
Thanks,
James Sullivan
Hello
My pipe is created from an extrude in Creo Parametric 3_M080.
I am using J-Link to get the pipe length.
The functionality that you mentioned from PRO/TOOLKIT using ProFamtableInstance has a correspondent in J-Link?
Thank you
Regards
Take a look at pfcFamily in User Gide or documentation.
You can try to get the instance model from table and pas it as a solid to your function.
Or read the value from table column, as mentioned early by @sully7.