Jump to content

Alternative to getPositionCMM() for user-defined coordinate systems?


---
 Share

Recommended Posts

---

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

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

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

---

Hi Soto,

Unfortunately, it doesn't work – the coordinates displayed are incorrect 😕

Link to comment
Share on other sites

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)

 

 

image.png.3b61d570870ea3cc2b5f0300f55670ee.png

 

image.png.4c8fc78470110a18909b7f649209031d.png

Link to comment
Share on other sites

---

I tied several different coordinate systems, but soehow it never displays 0 for me

image.thumb.png.3e10c4d4c68e1813c0376bbb3b0de962.png

Link to comment
Share on other sites

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

---

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

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:

image.png.335fb07d3a2de32230cbef18f71e1c5a.png

 

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:

image.png.a4f206b635cd84642104e3c2b26782be.png

 

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)  .")

image.png.2cdd75f394df650ebd7cf5490204b39c.png

 

 

 

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
Link to comment
Share on other sites

---

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
  • Thank you! 1
Link to comment
Share on other sites

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
Link to comment
Share on other sites

---

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

---

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

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
Link to comment
Share on other sites

---

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

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
  • Like! 2
  • Awesome! 2
Link to comment
Share on other sites

---

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

  • Like! 2
  • Awesome! 1
Link to comment
Share on other sites

---

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

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.

  • Like! 1
Link to comment
Share on other sites

---

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

---

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

 Share

×
×
  • Create New...