Username in postprocessor

Username in postprocessor

lufti2XPD8
Contributor Contributor
1,009 Views
8 Replies
Message 1 of 9

Username in postprocessor

lufti2XPD8
Contributor
Contributor

Hey there, 

 

I am currently using the Haas postprocessor and I wanted to know if it's possible add the programmers name into the postprocessor. I know I could manually add it but I want to be dynamic so it changes with every user. 

 

To be clear I want something like this at the top of my program: 

 

Created on: insert date here

Created by: insert username here

 

 

Thanks in advance!

1,010 Views
8 Replies
Replies (8)
Message 2 of 9

daniel_lyall
Mentor
Mentor

That can be done the date part is easy, the other bit would need a custom bit of code added.

 

For the date add the bit in red into the post into the post.

sequenceNumber = properties.sequenceNumberStart;
writeln("%");

if (programName) {
writeComment(programName);
}
if (programComment) {
writeComment(programComment);
}

if (hasGlobalParameter("job-description")) { var value = getGlobalParameter("job-description"); writeComment(value); }
writeComment(localize("Generated on") + " " + new Date().toLocaleString());

// dump machine configuration


Win10 pro | 16 GB ram | 4 GB graphics Quadro K2200 | Intel(R) 8Xeon(R) CPU E5-1620 v3 @ 3.50GHz 3.50 GHz

Daniel Lyall
The Big Boss
Mach3 User
My Websight, Daniels Wheelchair Customisations.
Facebook | Twitter | LinkedIn

Message 3 of 9

engineguy
Mentor
Mentor

@lufti2XPD8 

You might be able to do something along those lines by creating a small Template with a couple of "Manual NC Comments" in it that would be placed near the top of the program by selecting the Template when the first "Setup" is created, the user would right click on the Setup and select the Template and could then edit the comments with the relevant data, nearest I could get with it was this :-

%
O01051 (Prog Name goes here)
(Using high feed G1 F5000. instead of G0.)
(T1 D=5. CR=0. - ZMIN=-4. - flat end mill)
(T2 D=10. CR=0. - ZMIN=-4. - flat end mill)
N10 G90 G94 G17
N15 G21
(Created by :- Insert User Name Here)
(Created on :- Insert Creation Date Here)
N20 G53 G0 Z0.

 

Which once I input the correct data the comment now comes out like this :-

%
O01051 (Prog Name goes here)
(Using high feed G1 F5000. instead of G0.)
(T1 D=5. CR=0. - ZMIN=-4. - flat end mill)
(T2 D=10. CR=0. - ZMIN=-4. - flat end mill)
N10 G90 G94 G17
N15 G21
(Created by :- A N Other)
(Created on :- 5 September 2020)
N20 G53 G0 Z0.

 

I haven`t figured out yet how to get it to appear right at the top which would be the best place for it, I will leave that to you to figure out or maybe if you can ask @boopathi.sivakumar for some help on this, as Daniel says it will probably be just a few lines of code to make it work although where the info would be typed I wouldn`t know, there would need to be a dialog box created somewhere I reckon 🙂 🙂

Creation Information.jpg

 

Anyway, see image above, that`s all I have on it for now 🙂 🙂

 

Stay Safe

Regards

Rob

0 Likes
Message 4 of 9

daniel_lyall
Mentor
Mentor

@engineguy  I don't know why they just don't add the date into posts as a default function, I sneck it into any post I edit and I have never had a complaint.

 

The name can be a user property, It would be better to get them to add it to machine configs then it can be stored in a folder for that operator, so their work can be tracked. 


Win10 pro | 16 GB ram | 4 GB graphics Quadro K2200 | Intel(R) 8Xeon(R) CPU E5-1620 v3 @ 3.50GHz 3.50 GHz

Daniel Lyall
The Big Boss
Mach3 User
My Websight, Daniels Wheelchair Customisations.
Facebook | Twitter | LinkedIn

0 Likes
Message 5 of 9

engineguy
Mentor
Mentor

@daniel_lyall 

 

Agreed, it needs just a little addition somewhere, FWIW I would prefer them to add the "Setup Notes" to the top of the G code, it is currently only output to the "Setup Sheet" and not the code, if I use the "Operation Notes" then it does put it in the code but only in the operation.

Shouldn`t think that would be too hard to have the "Setup Notes" in the code as well, that way it could be easily updated with Revisions etc 🙂 🙂 🙂

Creation Info.jpgCreation Info in code.jpg

 

Regards

Rob

0 Likes
Message 6 of 9

silopolis
Contributor
Contributor

My take on this would be:

 

if (hasGlobalParameter("username")) {
    var value = getGlobalParameter("username");
    writeComment(localize("Generated by:") + " " + value.toLocaleString());
}
if (hasGlobalParameter("generated-at")) {
    var value = getGlobalParameter("generated-at");
    writeComment(localize("Generated on:") + " " + value.toLocaleString());
}

 

 

Thanks for asking, I just added this to the top of my programs

Message 7 of 9

daniel_lyall
Mentor
Mentor

You can have anything you like in a post, but it has to be in the correct spot in the code to start with.

If it is in the dumper post you should be able to use it in a post or setup sheet.


Win10 pro | 16 GB ram | 4 GB graphics Quadro K2200 | Intel(R) 8Xeon(R) CPU E5-1620 v3 @ 3.50GHz 3.50 GHz

Daniel Lyall
The Big Boss
Mach3 User
My Websight, Daniels Wheelchair Customisations.
Facebook | Twitter | LinkedIn

0 Likes
Message 8 of 9

daniel_lyall
Mentor
Mentor

An simple example 

properties = {
MachineOperatorsName: "(Barry)",
 
propertyDefinitions = {
MachineOperatorsName:{title:"MachineOperatorsName", description: "who ran job", type:"boolean"}, //I am not sure if boolean is correct but it works.
 
if (hasGlobalParameter("job-description")) { var value = getGlobalParameter("job-description"); writeComment(value); }
writeComment(localize("Generated on") + " " + new Date().toLocaleString());// Daniel
writeBlock(properties.MachineOperatorsName);
 
Output Below
 
%
(1005)
(PRIMARY SPINDLE)
(GENERATED ON MONDAY, SEPTEMBER 07, 2020 085402)
N10 (Barry)
N11 G90 G94 G18
N12 G21
N13 G1 X1.07
N14 G53 Z0.


Win10 pro | 16 GB ram | 4 GB graphics Quadro K2200 | Intel(R) 8Xeon(R) CPU E5-1620 v3 @ 3.50GHz 3.50 GHz

Daniel Lyall
The Big Boss
Mach3 User
My Websight, Daniels Wheelchair Customisations.
Facebook | Twitter | LinkedIn

0 Likes
Message 9 of 9

daniel_lyall
Mentor
Mentor

Screen Shot 2020-09-07 at 9.56.06 AM.png


Win10 pro | 16 GB ram | 4 GB graphics Quadro K2200 | Intel(R) 8Xeon(R) CPU E5-1620 v3 @ 3.50GHz 3.50 GHz

Daniel Lyall
The Big Boss
Mach3 User
My Websight, Daniels Wheelchair Customisations.
Facebook | Twitter | LinkedIn

0 Likes