Jump to content

Comparing paths... is this right?


---
 Share

Recommended Posts

Our file structure is unique, because we have everything from version 4.0 to 6.8 in use, and we have a backup system for programs, various versions have different paths so it was easier to make our own.

so the structure across all the CMMs is:

c:\data\cmm\programs\inspections

At that level we store Calibration programs, fixture programs, etc... stuff to only be ran by programmers and QA techs.

then we have

c:\data\cmm\programs\inspections\Production Parts (this is also the default program path set in environment settings)

This is where all the programs for operators are stored, used by operators. For these programs I have a check setup to make sure the machine is at it's park position. It runs via an external pcm file "inspection_start_pcm.txt" Here is the code
parkPos = vector(50,-125,-50) //Change this to match the Park Position for a given machine
	if getActualInspectionDir() > directoryPath("inspections") then
		x=val(getParameterNamed(getPositionCMM().rounded - parkPos).x)
		y=val(getParameterNamed(getPositionCMM().rounded - parkPos).y)
		z=val(getParameterNamed(getPositionCMM().rounded - parkPos).z)
		maxdev=max(abs(x),abs(y),abs(z))
			if maxdev >= 3 then 
				start=millisecondClockValue()
				end=start+5000  // This is how long the message will stay up, in milliseconds. 
				break=0
					repeat
						if millisecondClockValue() < end
							executeCode("ICCDialog message: '"+cr()+cr()+cr()+cr()+"<c:red><u>	Machine is not at park position, Program will CANCEL </u></c>"+cr()+cr()+cr()+cr()+"Remove all parts from the machine and run the recovery program!"+cr()+cr()+cr()+cr()+"If the Stoplight says "+chr(34)+"Stylus not Defined"+chr(34)+", <c:red><u>STOP</c></u>, call your supervisor"+cr()+cr()+cr()+cr()+"'asRichText")
						else
							break=1
						endif
					until break>0
				cncBreak()
			endif
	endif
Okay so my question is that first if statement
if getActualInspectionDir() > directoryPath("inspections") then
is that saying if it's another level? or is it simply saying if the path has more characters?

I'm trying to say "For any program saved in c:\data\cmm\programs\inspections\Production Parts" do this, but not for anything in any other directory. Although this seems to work, it could break if it's just comparing the length of the path.

thanks
Link to comment
Share on other sites

I'm not entirely sure what this comparison will do, but 'getActualInspectionDir' and 'directoryPath' just deliver the requested path as a string. So what your if statement basically does is 'if string1 > string2 then...'. I don't know if PCM will just compare lengths here or if it does some other magic, but it definitely won't compare path levels, because at the time when the comparison happens, Calypso has already forgotten where the two strings came from.

If you want to compare paths you'll need to extract the needed information the hard way (e.g. with string functions like inStr) and analyze them one by one.
Link to comment
Share on other sites

Please sign in to view this quote.

That's what I thought, so it may be working, but is subject to breaking if left like this. I will experiment with your suggestion! ( I have not taken a PCM course yet - thanks to covid. So doing it the hard slow way is pretty much par for the course.)

My plan right now is just to make it look for the name "production parts" in the string that returns from getActualInspectionDir()... if that's possible. Onto the manual!
Link to comment
Share on other sites

It's far from elegant, but I think this will do it. If the string from "getActualInspectionDir()" has "Production Parts" it returns 34, if it doesn't it returns 0.

Don't mind the messages... that's just my way of making sure it's doing what I want while testing.

inStr(getActualInspectionDir(),"Production Parts") <> 0
message("check")
else
message("no check")
endif
Thanks again!
Link to comment
Share on other sites

Please sign in to view this quote.

I think the .tail makes that not work for us. Because after production parts, we may have 2-4 more levels. To designate the part number and operation, and possibly special programs for sorts related to a given operation

so sometimes the path looks like c:\data\cmm\programs\inspections\Production Parts\*Part Number*\*Operation*\*Actual Program to be ran*

sometimes it'll be c:\data\cmm\programs\inspections\Production Parts\*Part Number*\*Operation Type*\*Operation Number*\*Actual Program to be ran*

and a few other options depending on what the given CMM is measuring.

basically everything after Production Parts in the file path won't be a consistent structure, so instead of making it == "Production Parts" I would need to make it say " has "Production Parts in the filename".

the inStr() returning a number if it's there, or 0 if it's not does seem to work though.
Link to comment
Share on other sites

Wow that's exactly it. Thank you!

So even when I take the PCM training, I'm assuming they won't be teaching any of this hidden syntax I see being used on here often...

Where does one go to learn that? or is it just watch and remember?
Link to comment
Share on other sites

Man... This sounds like a lot of work to ensure someone doesn't open the wrong measurement plan.

AutoRun sounds like a much easier path to achieve this task.

I always applaud the people who are brilliant with PCM though. This is good stuff.
Link to comment
Share on other sites

Please sign in to view this quote.

We use Autorun, it wasn't enough, but it was a big help.

The purpose of this here is to prevent operators performing any kind of automatic operation unless the CMM is moved to a safe position.
We have people that walk in off the street and are operating a CMM an hour later with basically zero training. And there is about 20 DuraMax CMMs alone, plus Some Conturas and Eclipses and GageMaxs, with only two of us programming.

Management doesn't have a problem with this arrangement (even though they yell every time an XXT head gets replaced we had around 20 replacements in 2019- before all these safety measures or Autorun). So the best I can do tie the Operators hands in every way possible via software.

All the programs on a given machine have the same park position, with the same stylus system. Now there is a recovery check that runs at the start of every program which ensures the CMM is at said park position. If it's not they can't do anything until they run a recovery program ( stole this idea from the Renishaw Equators we also have).

The good part is most of this is handled via one external file on each CMM so maintaining it is very easy ( especially thanks to Phillip Keller who has helped me twice in this endeavor). I was struggling with restricting that check to a specified directory.

We also have touch points at the start of every program that move at 30mm/s to check if the correct part has been loaded, and loaded correctly.

At this point, the Operators can select the program they want, and hit run. That's it. All header data and run parameters are selected from a list.
Link to comment
Share on other sites

Intresting, I always enjoy seeing idéas about making things idiot proof. I have fiddled a little with bullet proofing our DuraMax that we use for adaptive manufacturing. (All casted blades get a unique Cam-program generated from the cmm result, since the air core can move a little from blade to blade. All blades gets perfectly machined and nothing will be scrapped. 🙄 )

How ever, I took a completely different approach, aiming for 100% water tight, bullet proof, idiot safe, grandma approved operation using image recognition. The operator loads a part and press a button. Thats it.

Since the results have direct, unsupervised impact on the milling machine. It must be correct.

There is a camera taking a picture of the cmm volume, it identifies the part and make sure nothing else is in the way. Like a wrench left in the fixture or so. And that the part is placed properly. Then the correct part program is executed. If not, a message is shown, pointing out the identified error. Calypso isn't even visible for them.

In my initial testning, I can detect down to 0.2mm placement errors with 100% success. (It can be better, but is a little light and shadow dependent) But the fixtures are only removed once a year, and the parts can only fit in them in one way. So it's impossible to to have a collision by accident. You have to do it by purpouse, like putting a brick in the cmm volume after start. (That can be taken care of also, by keep taking photos, and stop if something else then the probe head and the part enters the volume.)
And starting the wrong program? Can't happen.

My remaining tests will show if I can see if the fixtures are tighted properly or not, I think some tape or a permanent marker can fix that.
Then I will present the concept for the management, and see if it gets approved for production use.

When we first got the DuraMax I hated it like hip hop. What an utterly piece of shi... But since Im like the geschäftsführer of it, and the boss of that production unit allowes to do what ever I wish as long as it still does what it is supposed to do. It has grown on me.
But we have one, not 20.

Oh, just keep in mind that it might not be the wisest decision you ever made to be dependent on the executeCode() syntax for such simple tasks.

I would rather keep it simple, since there is no need for fancy stuff. What you cooked up your self is totally fine. And you can get get it to act as a boolean statement with .isZero
I recently learned a great lession, It's always best to use code one fully understand. Because it will always fail in the most unappropriate time. And debugging code you don't fully understand, under pressure in the middle of the night is no fun task.
Is was also written in pearl, without any comments. (Those of you who know pearl, you know.)
if inStr(getActualInspectionDir(),"Production Parts").isZero
	message("Run the homer program, DOH!")
else
	message("Alles gut")
endif
Link to comment
Share on other sites

Please sign in to view this quote.

I suppose you’re referring to the possibility that Zeiss could remove the executeCode() syntax altogether in future releases? If so, then I completely agree that using the .isZero message is a better choice in this instance. It also requires less typing.... 😃

I recently created a program that uses a ridiculous amount of code using the “other” compiler syntax, but have been reluctant to deploy it, fearing that it could one day be rendered useless with a software update.
Link to comment
Share on other sites

Please sign in to view this quote.

ooo camera's we use camera's for identification everywhere in various automated cells. I seriously wonder if I will ever be able to convince management to spring for that. That just sounds so much better than touch points, and faster once it's set up. They are always screaming about how long the CMM takes, so anything to decrease run time will be a shovel I can dig with.

We almost exclusively make gear carriers. So the parts are generally round-ish, we use radius points that execute at 30mm/s and have code that yells at the operator if the result isn't between expect values, plus idiot proof fixturing have been our best solution... but cameras is just so much better. Thanks for the idea I can start researching and make a long term goal!

also thanks for
if inStr(getActualInspectionDir(),"Production Parts").isZero
	message("Run the homer program, DOH!")
else
	message("Alles gut")
endif
The simplest way is usually the best way!
Link to comment
Share on other sites

 Share

×
×
  • Create New...