Getting part parameter for component into cabling
Hi, everyone.
A client asked me about something and I haven't been able to get the problem out of my mind. I have a solution-ish, but I'm hoping it can be better. Here's the issue:
The client uses Cabling to route hoses. For each hose he wants to report its length in a table. So far, so good. Problem is, he wants both the cut length (i.e. the length of raw hose to be cut when manufacturing) and the total length (i.e. the length between the sealing surfaces). You can use internal length to get one of those, but you can't have both.
Simple enough, I thought. Add a parameter to the connectors and make a repeat region relation summing the length with the parameters of the from and to connectors. Problem is, I can't access the parameters of the connector part, just the parameters of the component. I can give a parameter to the components, showing the length to add to get from cut length to total length, and I can retrieve that parameter, but...
User defined cabling parameters seem to always be strings. So trying to add that parameter (harn.run.from.conn.ADDLEN) to the cable length results in a blank column. Can't add a string to a real value.
I got around this using huge sets of if conditions, getting me a number from the string. So:
if firstdigit == "1"
Total = Total + 1*10^(numdigits-1)
endif
if firstdigit == "2"
Total = Total + 2*10^(numdigits-1)
endif
And so on for ages (I can post the entire relation if someone's interested). So now it works, though the ADDLEN parameter can only be three digits and no decimals, but the relation could be bloated even more to compensate, of course.
My thoughts/questions:
1. This means that the user still has to add the ADDLEN parameter to each connector every time. It's not saved with the part, since it's designated in Cabling. Does anyone know how to automate this? Can I do something in the part to automatically get this parameter each time it's designated? I know how to do this for entry port information, but I'm not sure if I can do it for parts.
2. Anyone has a more elegant method for converting a string to an integer or real? Since there are no loops in Creo relations, my relation is huge. I wonder if there's a better way?

