Jump to content

Learning PCM


---
 Share

Recommended Posts

---

Forgive me for my green ignorance:

My company recently obtained a PCM license for the various part families we produce. I was taught how to use it specifically in the case of changing sizes and tolerances of features, but this is a VERY simple Parameter that was created for me and sent down from corporate. I am hungry to learn how to properly use PCM and unlock its true potential. So, I have been messing around with it for a few days with some basic parameters in order to learn how the PCM Syntax works, but I am running into a problem with probably a simple solution that I seem to be missing. 

Can anyone tell me what I am doing wrong? 

image.thumb.png.5fef9ee707f3335082e26087d3071f0c.png

P.S. I know that I should probably go to the PCM course, but I would need to convince management to fly me out of state for training. So, for now I am attempting to self-learn by trial and error. Suggestions and reference material are welcome!

Edited
extra letter
Link to comment
Share on other sites

---

getActual needs  .diameter at the end, otherwise well done I suggest taking official Zeiss course- then read through many topics here. good luck.

 

getActual can have many 'instance variables', such as  .x,.y,.z,.radius,.diameter, etc.

Edited
  • Like! 1
  • Thank you! 1
Link to comment
Share on other sites

---

It looks like you didnt tell it what "actual" you are looking for, IE getActual("Cylinder1").diameter.

Additionally, I would suggest looking into using caseSelect as opposed to nested If-Else statements. Nested If-Else are very difficult to scale up, and very easy to create conditions where they do not work, accidentally. There is also a very good in-depth PCM manual included in the installation of your software, along with a number of other manuals. They can be found in C:\Program Files (x86)\Zeiss\CALYPSO X.x\userinfo\manuals

Edited
  • Thank you! 1
Link to comment
Share on other sites

---

Additionally, you dont necessarily need to convince them to fly you out, Zeiss does offer PCM training in a live online format. 

Link to comment
Share on other sites

---

I appreciate the quick responses!

I've added .diameter to the assignment and it still gives me the same error.

I tested the same getActual("Cylinder1").diameter in the feature's diameter box as a formula and it works. Any ideas on why it is ignoring the assignments within PCM parameter? It appears to be structured correctly, even verifying with the PCM Manual that

Please sign in to view this username.

 suggested. I had also swapped the extra "getActuals" with the assignments already set. 

 

actualValue =  getActual("Cylinder1").diameter
upperLimit = 0.4381
lowerLimit = 0.4376

    if  actualValue > 0.4381 then
        message("Oversize", actualValue)
    else
        if  actualValue < 0.4376 then
            message("Undersize", actualValue)
       else
        message("Within Tolerance", actualValue)
    endif
endif


image.png.8b43081de6e545aada2c9d952cbc3153.png

Link to comment
Share on other sites

---

Try
 

actualValue =  getActual("Cylinder1").diameter
upperLimit = 0.4381
lowerLimit = 0.4376

    if  actualValue > 0.4381 then message("Oversize", actualValue)
    else
        if  actualValue < 0.4376 then message("Undersize", actualValue)
       else
         message("Within Tolerance", actualValue)
    endif
endif

Link to comment
Share on other sites

---

One thing I would suggest is that you do not need "then" in the code. 

 

In addition, I would strongly suggest to enclose comparisons inside of parentheses. 

actualValue = getActual("Cylinder1").diameter
upperLimit = 0.4381
lowerLimit = 0.4376

if (actualValue > upperLimit)
	message("Oversize" +cr() + actualValue)
else
	if (actualValue < lowerLimit)
		message("Undersize" + cr() +actualValue)
	else
		message("Within Tolerance" + cr() +actualValue)
	endif
endif

image.png.7d7c136a315832602c2117edbf0613f5.png

Edited
  • Thank you! 1
Link to comment
Share on other sites

---

But as Kevin said, selectCase would be much cleaner and easier to manage. 

actualValue = getActual("Cylinder1").diameter
upperLimit = 0.4381
lowerLimit = 0.4376

selectCase actualValue
	case (actualValue > upperLimit)
		message("Oversize" +cr() + actualValue)
	case (actualValue < lowerLimit)
		message("Undersize" + cr() +actualValue)
	case (actualValue <= upperLimit) and (actualValue >= lowerLimit)
		message("Within Tolerance" + cr() +actualValue)
endSelect

image.png.08afb05bf0e6b863397f8b0a258d3f3a.png

Edited
  • Like! 2
  • Thank you! 1
Link to comment
Share on other sites

---

Putting the code into post-settings made it function, and I used the selectCase example since it is a lot easier to understand and visualize.

My only other question is what are the differences between "Plan->Advanced->Parameter", the PCM Editor, and Pre/post settings? The post and presetting's are kind of self-explanatory to a degree, but that same code can't be placed into "Parameter" with success. Is the Majority of PCM used within Post and presetting's? Sorry for asking the obvious, but I am just trying to come away from this having learned as much as I can regarding my issue to prevent it from happening again. 

Link to comment
Share on other sites

---

That is where you 'should' declare your variables. You may notice at time when typing PCM into a random field, sometimes  NUM=123 the NUM doesnt turn green as if its a variable, declaring your variables in Plan->Adv->Parameter helps with this. 

 

Where the majority of PCM is used is highly dependent on the situation, some people use it everywhere ,   pre/post ; features and outside of program.

  • Thank you! 1
Link to comment
Share on other sites

---

I didn't even notice that the code was being placed in the Parameter section. Oops. Yeah, makes sense why you were seeing issues. 

I would strongly advise to always declare variables inside of the Parameter section. 

If you are declaring them inside of the Pre/Post settings of a feature, characteristic, or measurement plan, you can potentially run into issues where they do not exist in the measurement plan until that portion is executed. 

  • Like! 1
  • Thank you! 1
Link to comment
Share on other sites

---

Please sign in to view this username.

 I forgot to mention that I've personally attended the online training for PCM. It was a great starting point to understand concepts and functionality. The online version of it was also nice because you will most likely finish well before the time allotted, so you can work on other things as needed. 

  • Thank you! 1
Link to comment
Share on other sites

The Parameter section is executed before the measurement plan does even start. So its only meaningful purpose is to store variable declarations that need to exist before the first PCM statement is executed. It's not an absolute necessity to use it, but as the others mentioned, it's recommended.

Apart from that, every element (features, characteristics, even conditions and the whole measurement plan) has pre- and post settings. Pre is for code to be executed before the element (e.g. to set a tolerance variable used in a formula in the element) and post is for code that runs after the element (when measuring results are available).

  • Thank you! 1
Link to comment
Share on other sites

 Share

×
×
  • Create New...