[Ro...] Posted April 14 Share Posted April 14 Hi everyone, The function getPositionCMM() returns the current position in the machine coordinate system. Is there a function that returns the position in a coordinate system of my choice? At the moment, I'm doing it via a very cumbersome workaround with writeDiffCoordSysToFile(), which I would like to avoid. Link to comment Share on other sites More sharing options...
[I...] Posted April 14 Share Posted April 14 cannot find it, but this is also a workaround: alg = "Alignment1" positionxyz=executeCode(getPositionCMM() + " transformFrom: ((Zeiss.Calypso.OMInspection active orderedCfs nodeNamedOverAllGroups: '" + alg + "') element singleStepWithDialog: true)") display(positionxyz.x) display(positionxyz.y) display(positionxyz.z) Link to comment Share on other sites More sharing options...
[I...] Posted April 14 Share Posted April 14 sorry, not correct (the forum doesnt allow me to edit??🫤 Link to comment Share on other sites More sharing options...
[I...] Posted April 14 Share Posted April 14 try this one: alg = "Alignment1" positionxyz =executeCode("Zeiss.CMMOS.OMVirtualControl actual transformVector: " + getPositionCMM() + " to: ((Zeiss.Calypso.OMInspection active orderedCfs nodeNamedOverAllGroups: '" + alg + "') element singleStepWithDialog: true)") display(positionxyz.x) display(positionxyz.y) display(positionxyz.z) Link to comment Share on other sites More sharing options...
[Ro...] Posted April 14 Author Share Posted April 14 Hi Soto, Unfortunately, it doesn't work – the coordinates displayed are incorrect 😕 Link to comment Share on other sites More sharing options...
[I...] Posted April 14 Share Posted April 14 sure?, check the formating and the decimal places.. i think is correct: alg = "Alignment1" positionRS(0,0,0,alg) positionxyz =executeCode("Zeiss.CMMOS.OMVirtualControl actual transformVector: " + getPositionCMM() + " to: ((Zeiss.Calypso.OMInspection active orderedCfs nodeNamedOverAllGroups: '" + alg + "') element singleStepWithDialog: true)") display(formatR(positionxyz.x.asNumber,0,4)) display(formatR(positionxyz.y.asNumber,0,4)) display(formatR(positionxyz.z.asNumber,0,4)) display(getPositionCMM()) display(cos(30)*50) display(sin(30)*50) Link to comment Share on other sites More sharing options...
[Ro...] Posted April 15 Author Share Posted April 15 I tied several different coordinate systems, but soehow it never displays 0 for me Link to comment Share on other sites More sharing options...
[I...] Posted April 15 Share Posted April 15 (edited) Please sign in to view this quote. 🫤, Edited April 15 Link to comment Share on other sites More sharing options...
[I...] Posted April 15 Share Posted April 15 I think this is the good one, all tests give me the result of the positionRS value: alg = "Alignment1" positionxyz =executeCode("| v1 v2 v3 | v1:= Zeiss.CMMOS.OMVirtualControl actual. v2 := Zeiss.Calypso.OMInspection active. v3:= v1 transformVector: " + getPositionCMM() + " to: v2 baseSystem pcs . v1 transformVector: v3 to: ((v2 orderedCfs nodeNamedOverAllGroups: '" + alg + "') element singleStepWithDialog: true)") display(formatR(positionxyz.x.asNumber,0,4)) display(formatR(positionxyz.y.asNumber,0,4)) display(formatR(positionxyz.z.asNumber,0,4)) Link to comment Share on other sites More sharing options...
[Ro...] Posted April 16 Author Share Posted April 16 For some reason i still get the (almost) same wrong coordinates. Are you also on an offline seat? Link to comment Share on other sites More sharing options...
[I...] Posted April 16 Share Posted April 16 (edited) Please sign in to view this quote. I develop normally in offline, and I request to our metrologists to test (then we move faster), I’m also very interested in this function because currently I have another ugly method. This is what i have observed until now: I can transform the current position of the machine into the base Alignment with the following command: positioninBA =executeCode("| v1 v2 | v1:= Zeiss.CMMOS.OMVirtualControl actual. v2 := Zeiss.Calypso.OMInspection active. v3:= v1 transformVector: " + getPositionCMM() + " to: v2 baseSystem pcs .") to verify it I have an empty alignment characteristic with the name BA (so the same as the base alignment), then I move to the probe to BA [ positionRS(0,0,0,"BA") ] and the result must be 0 I can also confirm it in the traffic light: Something interesting, and this is the reason why I made this transformation to BA first. The coordinates in the traffic light blink with a different value when the window change focus and then the value is corrected after 1 second. the second step is transform the coordinates from BA to the Alignment: alg = "ALG_JOINTAXIS" positionxyz =executeCode("| v1 v2 | v1:= Zeiss.CMMOS.OMVirtualControl actual. v2 := Zeiss.Calypso.OMInspection active. v3:= v1 transformVector: " + positioninBA + " to: ((v2 orderedCfs nodeNamedOverAllGroups: '" + alg + "') element singleStepWithDialog: true) .") I can move to 0 again [ positionRS(0,0,0,"ALG_JOINTAXIS") ] and use the traffic light coordinates to verify: Now, here it happens the same weird thing than before, the traffic light coordinates blink when the window change focus and the value is corrected after one second. I was able to obtain those wrong coordinates if I make the transformation directly (without to transform first to the BA): alg = "ALG_JOINTAXIS" positionxyz =executeCode("| v1 v2 | v1:= Zeiss.CMMOS.OMVirtualControl actual. v2 := Zeiss.Calypso.OMInspection active. v3:= v1 transformVector: " + getPositionCMM() + " to: ((v2 orderedCfs nodeNamedOverAllGroups: '" + alg + "') element singleStepWithDialog: true) .") Since now I have the expected value I can combine the two steps in a single script: alg = "Alignment1" positionxyz =executeCode("| v1 v2 v3 | v1:= Zeiss.CMMOS.OMVirtualControl actual. v2 := Zeiss.Calypso.OMInspection active. v3:= v1 transformVector: " + getPositionCMM() + " to: v2 baseSystem pcs . v1 transformVector: v3 to: ((v2 orderedCfs nodeNamedOverAllGroups: '" + alg + "') element singleStepWithDialog: true)") display(formatR(positionxyz.x.asNumber,0,4)) display(formatR(positionxyz.y.asNumber,0,4)) display(formatR(positionxyz.z.asNumber,0,4)) I still don’t test it on CNC, maybe some weeks later.. Edited April 16 Link to comment Share on other sites More sharing options...
[I...] Posted April 17 Share Posted April 17 doesn’t work on CNC, sorry: Link to comment Share on other sites More sharing options...
[Ch...] Posted April 17 Share Posted April 17 (edited) Hi - I'm learning more and more PCM all the time, but still not quite at this level.. Please sign in to view this username. would cmmosCommand("PD") or ("PG") be any help ? these appear to be more actual machine than virtual(simulation). These may also be CMM System coordinates rather than base alignment. Just a thought. I think getting the Secondary Alignment cooridnates should be a pretty standard PCM variable. Such as : getPositionRS() we can request it on MyVoice. Best of luck - thanks everyone ! Edited April 17 1 Link to comment Share on other sites More sharing options...
[I...] Posted April 20 Share Posted April 20 (edited) Please sign in to view this quote. 🤔mmmaybe, and makes sense with PD.. this one with PD is working OK offline: alg = "Alignment1" positionRS(0,0,0,alg) v1 ="PD" cmmosCommand(v1) //Dummy v1=cmmosCommand(v1) v1 = executeCode("| inputString xIndex yIndex zIndex v1 | v1:= Vector new. inputString := '" + v1 + "'. xIndex := (inputString indexOf: $X) + 1. yIndex := (inputString indexOf: $Y). zIndex := (inputString indexOf: $Z). v1 x: (inputString copyFrom: xIndex to: yIndex - 1) asNumber. v1 y: (inputString copyFrom: yIndex + 1 to: zIndex - 1) asNumber. v1 z: (inputString copyFrom: zIndex + 1 to: inputString size) asNumber. v1") positionxyz =executeCode("| v1 v2 v3 | v1:= Zeiss.CMMOS.OMVirtualControl actual. v2 := Zeiss.Calypso.OMInspection active. v3:= v1 transformVector: " + v1 + " to: ((v2 orderedCfs nodeNamedOverAllGroups: '" + alg + "') element singleStepWithDialog: true) . " ) display(formatR(positionxyz.x.asNumber,0,4)) display(formatR(positionxyz.y.asNumber,0,4)) display(formatR(positionxyz.z.asNumber,0,4)) Edited April 20 Link to comment Share on other sites More sharing options...
[Mi...] Posted April 22 Share Posted April 22 Hello, you may try the following. (Note the difference between transformTo and transformFrom) // transform (30,0,-30) related to the machine coordinate system into the basesystem executeCode("30 @ 0 @ -30 transformTo: Zeiss.Calypso.OMInspection active baseSystem pcs.") // transform the current position in the machine coordinate system into the basesystem executeCode(getPositionCMM() + " transformTo: Zeiss.Calypso.OMInspection active baseSystem pcs.") //---------------------------------------------------------------------------------------------------- // transform (-80,0,50) related to the basesystem into machine coordinate system executeCode("-80 @ 0 @ 50 transformFrom: Zeiss.Calypso.OMInspection active baseSystem pcs.") Link to comment Share on other sites More sharing options...
[Ro...] Posted April 22 Author Share Posted April 22 Hi Michael, is it correct, that your code only translates the coordinates into the active base system? Id like to get the position in an user-defined system. Is that somehow possible? Link to comment Share on other sites More sharing options...
[I...] Posted April 22 Share Posted April 22 (edited) Please sign in to view this username. transformVector calls for transformTo but also considers RT, did you test this with "PD" ?, seems is the good one: alg = "Alignment1" positionRS(0,0,0,alg) v1 ="PD" cmmosCommand(v1) //Dummy v1=cmmosCommand(v1) v1 = executeCode("| inputString xIndex yIndex zIndex v1 | v1:= Vector new. inputString := '" + v1 + "'. xIndex := (inputString indexOf: $X) + 1. yIndex := (inputString indexOf: $Y). zIndex := (inputString indexOf: $Z). v1 x: (inputString copyFrom: xIndex to: yIndex - 1) asNumber. v1 y: (inputString copyFrom: yIndex + 1 to: zIndex - 1) asNumber. v1 z: (inputString copyFrom: zIndex + 1 to: inputString size) asNumber. v1") positionxyz =executeCode("| v1 v2 v3 | v1:= Zeiss.CMMOS.OMVirtualControl actual. v2 := Zeiss.Calypso.OMInspection active. v3:= v1 transformVector: " + v1 + " to: ((v2 orderedCfs nodeNamedOverAllGroups: '" + alg + "') element singleStepWithDialog: true) . " ) display(formatR(positionxyz.x.asNumber,0,4)) display(formatR(positionxyz.y.asNumber,0,4)) display(formatR(positionxyz.z.asNumber,0,4)) Edited April 22 Link to comment Share on other sites More sharing options...
[Ro...] Posted April 22 Author Share Posted April 22 Tested just now, unfortunately it doesnt work. Im getting 2 Errors 1: Internal Error: "Message not understood: #new" 1: Internal Error: "Message not understood: #transformTo" Link to comment Share on other sites More sharing options...
[I...] Posted April 22 Share Posted April 22 (edited) Please sign in to view this quote. I see.., small correction: alg = "Alignment1" positionRS(0,0,0,alg) v1 ="PD" cmmosCommand(v1) //Dummy v1=cmmosCommand(v1) v1 = executeCode("| inputString xIndex yIndex zIndex v1 | v1:= Zeiss.Basics.Vector new. inputString := '" + v1 + "'. xIndex := (inputString indexOf: $X) + 1. yIndex := (inputString indexOf: $Y). zIndex := (inputString indexOf: $Z). v1 x: (inputString copyFrom: xIndex to: yIndex - 1) asNumber. v1 y: (inputString copyFrom: yIndex + 1 to: zIndex - 1) asNumber. v1 z: (inputString copyFrom: zIndex + 1 to: inputString size) asNumber. v1") positionxyz =executeCode("| v1 v2 v3 | v1:= Zeiss.CMMOS.OMVirtualControl actual. v2 := Zeiss.Calypso.OMInspection active. v3:= v1 transformVector: " + v1 + " to: ((v2 orderedCfs nodeNamedOverAllGroups: '" + alg + "') element singleStepWithDialog: true) . " ) display(formatR(positionxyz.x.asNumber,0,4)) display(formatR(positionxyz.y.asNumber,0,4)) display(formatR(positionxyz.z.asNumber,0,4)) Edited April 22 2 2 Link to comment Share on other sites More sharing options...
[Ro...] Posted April 22 Author Share Posted April 22 Aaaaaand here we go. Now its working. Ty for your help Soto!! Link to comment Share on other sites More sharing options...
[Mi...] Posted April 22 Share Posted April 22 Please sign in to view this quote. Yep, that's it. If you want to transform into a local system, you can use the transformation matrix (getNominal(local System).matrix) related to the basesystem. But first we have to transform the machine coordinate into the basesystem: // transformation into basesystem vec=executeCode(getPositionCMM() + " transformTo: Zeiss.Calypso.OMInspection active baseSystem pcs.") sysName="test" // name of local system // finally we get the maschine coordinates related to the local system by getNominal(sysName).matrix*vec See for example https://en.wikipedia.org/wiki/Change_of_basis 2 1 Link to comment Share on other sites More sharing options...
[Mi...] Posted April 24 Share Posted April 24 Please sign in to view this quote. The statement above is not completely. We have to take into account a possible Translation (getNominal(sysName).vector) between the zero point of the local system and the one of the basesystem. In addition I include a correction of getPositionCMM() by the probe vector so that the coordinates represent the center of the probe (shown in the traffic light window): sysName="test" // name of local system // transformation into basesystem vec=executeCode(getPositionCMM() + " transformTo: Zeiss.Calypso.OMInspection active baseSystem pcs.") vec=vec+ getProbe().probeVector // correction with probe vector (optional) // finally we get the maschine coordinates related to the local system by getNominal(sysName).matrix*vec -getNominal(sysName).vector Another solution is to perform two transformation by means of the transfomTo command. transfomTo can not directly obtain the coordinates related to the local system if the input coordinates are related to the maschine system. That's why we have transform into the basesystem at first and transform the result into the local system. Here the prove vector is included so that the coordinates coincide with the ones shown in the traffic light window: sysName="test" // name of local system executeCode("((" +getPositionCMM() + " transformTo: Zeiss.Calypso.OMInspection active baseSystem pcs) + (" + getProbe().probeVector + ")) transformTo: ((Zeiss.Calypso.OMInspection active orderedCfs nodeNamedOverAllGroups: '" + sysName +"') element singleStepWithNominalsDialog: true withBase: false)") Link to comment Share on other sites More sharing options...
[I...] Posted April 24 Share Posted April 24 Please sign in to view this quote. not working.. the one with PD works OK... we owe a thanks to Please sign in to view this username. 1 Link to comment Share on other sites More sharing options...
[Ch...] Posted April 24 Share Posted April 24 Thank you guys as well. Im learning a bit more from Please sign in to view this username. 's posts all the time. I always help when I can and look for all possible solution options. Link to comment Share on other sites More sharing options...
[Mi...] Posted April 29 Share Posted April 29 Please sign in to view this quote. Of course, it's appropriate to work with the actual data: sysName="test" //position of probe in basesystem vec=baseSystem().machine.machinePosition.vector round(getActual(sysName).matrix*vec -getActual(sysName).vector,4) // or executeCode("(" + baseSystem().machine.machinePosition.vector + " transformTo: ((Zeiss.Calypso.OMInspection active orderedCfs nodeNamedOverAllGroups: '" + sysName +"') element singleStepWithDialog: false)) roundTo: 0.0001d") 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