[Ri...] Posted yesterday at 08:02 PM Share Posted yesterday at 08:02 PM Hello, all, Please sign in to view this username. was so kind to help me with the original formulas for pulling the actual .X/.Y from the Position Characteristic using the new GD&T engine. GDTPOS=getActual("GDT Position1").extendedProtocol.actualCoord.asArray GDTVAL=getParameterNamed(GDTPOS).first.asString GDTX=strElement(1,"@",GDTVAL) GDTY=strElement(2,"@",GDTVAL) message("X = "+GDTX+" Y ="+GDTY) I haven't used it much, but I have started to, and I'm running into some challenges that while I'm able to overcome it, man does my code get super long and complicated now. The challenge comes from when the Characteristic is measuring a Cylinder. A Cylinder has two points for evaluation (top and bottom). The StandardProtocol only shows the additional report for the worst case, but the formula above pulls both which leads to a challenge - how do you find the worst case? Well, the only way that I could figure it out is to essentially calculate the Position for both end-points, and then use an if statement to find which one is the worst. There were also some silly quirks with how the data is presented for the nominal coordinates vs the actual coordinates. Either way, would someone take a look at this code, and see what I could have done to improve it? //Nominal Defition Position #32-1 GDTPOS32_1_Nom=getActual("#32-1").extendedProtocol.nominalCoord.asArray GDTVAL32_1_Nom=getParameterNamed(GDTPOS32_1_Nom).asString GDTX32_1_Nom=strElement(1," ",GDTVAL32_1_Nom) GDTX32_1_Nom=mid(GDTX32_1_Nom,3) GDTX32_1_Nom1=abs(val(GDTX32_1_Nom)/25.4) GDTY32_1_Nom=strElement(2," ",GDTVAL32_1_Nom) GDTY32_1_Nom1=abs(val(GDTY32_1_Nom)/25.4) //Actual Defition Position #32-1 GDTPOS32_1_Act=getActual("#32-1").extendedProtocol.actualCoord.asArray GDTVAL32_1_Act1=getParameterNamed(GDTPOS32_1_Act).first.asString GDTVAL32_1_Act2=getParameterNamed(GDTPOS32_1_Act).second.asString GDTX32_1_Act1=strElement(1,"@",GDTVAL32_1_Act1) GDTX32_1_Act1_1=abs(val(GDTX32_1_Act1)/25.4) GDTX32_1_Act2=strElement(1,"@",GDTVAL32_1_Act2) GDTX32_1_Act2_1=abs(val(GDTX32_1_Act2)/25.4) GDTY32_1_Act1=strElement(2,"@",GDTVAL32_1_Act1) GDTY32_1_Act1_1=abs(val(GDTY32_1_Act1)/25.4) GDTY32_1_Act2=strElement(2,"@",GDTVAL32_1_Act2) GDTY32_1_Act2_1=abs(val(GDTY32_1_Act2)/25.4) //Deviation Defition Position #32-1 GDTX32_1_Dev1_1=GDTX32_1_Act1_1 - GDTX32_1_Nom1 GDTX32_1_Dev2_1=GDTX32_1_Act2_1 - GDTX32_1_Nom1 GDTY32_1_Dev1_1=GDTY32_1_Act1_1 - GDTY32_1_Nom1 GDTY32_1_Dev2_1=GDTY32_1_Act2_1 - GDTY32_1_Nom1 //Position Defition Position #32-1 GDTX32_1_Pos1=(2*(sqrt((squared(GDTX32_1_Dev1_1))+(squared(GDTY32_1_Dev1_1))))) GDTX32_1_Pos2=(2*(sqrt((squared(GDTX32_1_Dev2_1))+(squared(GDTY32_1_Dev2_1))))) //Comparison Defition Position #32-1 if (GDTX32_1_Pos1 > GDTX32_1_Pos2) GDTX32_1=GDTX32_1_Act1_1 GDTY32_1=GDTY32_1_Act1_1 else GDTX32_1=GDTX32_1_Act2_1 GDTY32_1=GDTY32_1_Act2_1 endif 1 Link to comment Share on other sites More sharing options...
[Ch...] Posted 8 hours ago Share Posted 8 hours ago (edited) Please sign in to view this username. Well done. Yeah that has been a quirk/peeve of mine about position of cylinders. I would think Zeiss 'should' have a PCM attribute for result at each end of the cylinder. I no longer have access to PCM in my current role, otherwise I would love to dig. You could probably roll all this into a defineFunction() for ease of use later, etc. Have we put this in as a request in MyVoice ? If so let me know I'll be happy to vote it up. Nice work ! Edited 8 hours ago Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in