Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpost_code.js
More file actions
Latest commit
84 lines (77 loc) · 2.33 KB
/
Copy pathpost_code.js
File metadata and controls
84 lines (77 loc) · 2.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
groupDefinitions={
toolPath: {title: "Toolpath WCS Check",order: 0,collapsed: false},
};
// tolerance for checking WCS offsets
properties.wcsTolerance={
title: "WCS tolerance",
description: "Enter the tolerance for checking WCS origins",
group: "toolPath",
value: 0.01,
type: "spatial",
scope: "post",
};
// WCS X Shift for macro validation
properties.wcsXShift={
title: "WCS X Offset",
description: "WCS Shift for X to align machine model with real life",
group: "toolPath",
value: 0.0,
type: "spatial",
scope: "post",
};
// WCS X Shift for macro validation
properties.wcsYShift={
title: "WCS Y Offset",
description: "WCS Shift for Y to align machine model with real life",
group: "toolPath",
value: 0.0,
type: "spatial",
scope: "post",
};
// WCS X Shift for macro validation
properties.wcsZShift={
title: "WCS Z Offset",
description: "WCS Shift for Z to align machine model with real life",
group: "toolPath",
value: 0.0,
type: "spatial",
scope: "post",
};
functiontoMCSPosition(section,wcsPosition){
varpartAttachPoint=section.getPartAttachPoint();
vartableAttachPoint=machineConfiguration.getTableAttachPoint();
varmcsPosition=Vector.sum(
tableAttachPoint,
Vector.diff(wcsPosition,partAttachPoint),
);
returnmcsPosition;
}
functionverifyWCS(){
if(machineConfiguration.isReceived()){
varchecked=[];
writeComment("-----------------------");
writeComment(" Verify WCS Positions");
for(i=0;i<getNumberOfSections();++i){
varsection=getSection(i);
varwcs=section.workOffset;
wcs=wcs==0 ? 1 : wcs;
wcs=wcs>6 ? -(wcs-6) : wcs+53;
if(typeofchecked[wcs]=="undefined"){
mcsOrigin=toMCSPosition(section,newVector(0,0,0));
writeBlock(
gFormat.format(65),
"P"+8901,
"X"+xyzFormat.format(mcsOrigin.x+getProperty("wcsXShift",0)),
"Y"+xyzFormat.format(mcsOrigin.y+getProperty("wcsYShift",0)),
"Z"+xyzFormat.format(mcsOrigin.z+getProperty("wcsZShift",0)),
"E"+xyzFormat.format(getProperty("wcsTolerance",0.01)),
"W"+wcs,
);
checked[wcs]=true;
}
}
writeComment("-----------------------");
writeln("");
}
}
// In the onOpen function call the verifyWCS() method.