Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathExporter.lua
More file actions
Latest commit
22 lines (20 loc) · 990 Bytes
/
Copy pathExporter.lua
File metadata and controls
22 lines (20 loc) · 990 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
-- Export the generated course or parts of it
Exporter=CpObject()
---@paramfieldworkCourseCourseGenerator.FieldworkCourse
functionExporter:init(fieldworkCourse)
self.fieldworkCourse=fieldworkCourse
end
--- Export a headland as a CSV file. Only includes the given headland, without the connecting path or transitions.
---@paramheadlandNumbernumber The headland to export, 1 is the outermost
---@paramfilenamestring The filename to save the CSV file as, under the export/ directory
functionExporter:exportHeadlandAsCsv(headlandNumber, filename)
localfile=io.open('export/' ..filename, 'w')
for_, vinself.fieldworkCourse:getHeadlandPath():vertices() do
ifv:getAttributes():getHeadlandPassNumber() ==headlandNumberand
notv:getAttributes():isHeadlandTransition() and
notv:getAttributes():isOnConnectingPath() then
file:write(string.format('%.2f,%.2f\n', v.x, v.y))
end
end
file:close()
end