Jump to content

read and set new reference sphere position


Recommended Posts

Here is how to read the current reference sphere with PCM :

(If you have more than one and need specific - it is likely do-able as well).

 

RSPOS=baseSystem().machine.machineControl.sphereNormalObject.spherePosition.asString
RSX=strElement(1,"@",RSPOS)
RSY=strElement(2,"@",RSPOS)
RSZ=strElement(3,"@",RSPOS)
message("Ref Sphere X = "+RSX+cr()+"Ref Sphere Y = "+RSY+cr()+"Ref Sphere Z = "+RSZ)

 

I'm not sure how to write to it - I'll dig a little...

- you may need to round these values, let me know if you need further help.

 

 

 

-CR

ref sphere position.JPG

Edited

If you want to get fancy...

image.thumb.png.66ca94e2e0d1f877fec9c211d44fb3d7.png

display(baseSystem().machine.machineControl.sphereNormalObject)
Ref1X=(baseSystem().machine.machineControl.sphereNormalObject.spherePosition.x)
Ref1Y=(baseSystem().machine.machineControl.sphereNormalObject.spherePosition.y)
Ref1Z=(baseSystem().machine.machineControl.sphereNormalObject.spherePosition.z)
Ref1A1=deg(baseSystem().machine.machineControl.sphereNormalObject.rotationAngle)
Ref1A2=deg(baseSystem().machine.machineControl.sphereNormalObject.inclinationAngle)
Ref1Rad=(baseSystem().machine.machineControl.sphereNormalObject.sphereRadius)

//spherelist
referenceSphereList=executeCode("Zeiss.CMMOS.OMSphereNormal getAllSphereNormals")
numberOfSpheres=referenceSphereList.size
for i = 1 to numberOfSpheres
            sphereNo[i]=round(getParameterNamed(referenceSphereList.asArray,i).ident)
            sphereSN[i]=getParameterNamed(referenceSphereList.asArray,i).serialNo
            sphereCenter[i]=getParameterNamed(referenceSphereList.asArray,i).spherePosition
            sphereRAD[i]=getParameterNamed(referenceSphereList.asArray,i).sphereRadius
        display("Sphere Number: "+sphereNo[i]+cr()+"Sphere SN: "+sphereSN[i]+cr()+"X= "+formatR(sphereCenter[i].x,10,5)+cr()+"Y= "+formatR(sphereCenter[i].y,10,5)+cr()+"Z= "+formatR(sphereCenter[i].z,10,5)+cr()+"RAD= "+formatR(sphereRAD[i],10,5)+cr()+cr())
next i
sphereNo[1]  //change the number to 2, or 3, or whatever sphere you're looking for
sphereSN[1]
sphereCenter[1].x
sphereCenter[1].y
sphereCenter[1].z
sphereRAD[1]
 

 

×
×
  • Create New...