Add uziom generation script and update wet input documents

- Created a new Python script `uziom.py` for generating DXF drawings of grounding systems based on user input parameters.
- Added detailed documentation in `wet_input_15.docx` and `wet_input_3.docx` for the design of grounding systems, including calculations for resistance and resistivity measurements.
- Included placeholders for dynamic data insertion in the documents to facilitate project-specific customization.
This commit is contained in:
2025-07-01 11:14:49 +02:00
parent e0d822adc8
commit 5c11a289df
21 changed files with 4557 additions and 6504 deletions

1
.gitignore vendored
View File

@@ -41,6 +41,7 @@ a.py
*.txt
*.dxf
/public/*.dxf
/public/uploads/*
/pages/api/auth/*
/cypress

21
Dockerfile Normal file
View File

@@ -0,0 +1,21 @@
# Build stage
FROM node:16 AS builder
WORKDIR /panel
COPY . .
RUN npm install && npm run build
# Final stage: Node.js + Python + ezdxf
FROM node:16
# Install Python and pip
RUN apt-get update && apt-get install -y python3 python3-pip && \
pip3 install --no-cache-dir ezdxf && \
apt-get clean && rm -rf /var/lib/apt/lists/*
# Copy Node app
WORKDIR /panel
COPY --from=builder /panel ./
RUN npm install --omit=dev
EXPOSE 3000
CMD ["npm", "run", "start"]

View File

@@ -1,4 +1,5 @@
import { useState } from "react";
import { useState, useEffect } from "react";
import { useRouter } from "next/router";
import {
Pane,
TextInputField,
@@ -7,13 +8,44 @@ import {
BuildIcon,
toaster,
Alert,
RadioGroup,
} from "evergreen-ui";
import axios from "axios";
import Footer from "./footer";
export default function Generator() {
const [profil, setProfil] = useState();
const [args, setArgs] = useState({ scale: 200 });
const [args, setArgs] = useState({
scale: 200,
elementOne: 0,
elementTwo: 0,
});
const [ElementOneOptions] = useState([
{ label: "Nic", value: "0" },
{ label: "Słup", value: "1" },
{ label: "Dom", value: "2" },
]);
const [ElementTwoOptions] = useState([
{ label: "Nic", value: "0" },
{ label: "Słup", value: "1" },
{ label: "Dom", value: "2" },
]);
const { query } = useRouter();
useEffect(() => {
if (query.external == "tru") {
axios
.post("/api/readtext", {
id: query.id,
})
.then(function (response) {
setProfil(response.data.data);
document.getElementById("textarea-1").value = response.data.data;
console.log(response.data.data);
});
}
}, []);
const getPath = (e, path) => {
let newLines = [];
@@ -148,6 +180,22 @@ export default function Generator() {
setArgs({ ...args, scale: e.target.value });
}}
/>
<RadioGroup
label="Lewa"
value={args.elementOne}
options={ElementOneOptions}
onChange={(event) => {
setArgs({ ...args, elementOne: event.target.value });
}}
/>
<RadioGroup
label="Prawa"
value={args.elementTwo}
options={ElementTwoOptions}
onChange={(event) => {
setArgs({ ...args, elementTwo: event.target.value });
}}
/>
<Button
marginY={8}
marginRight={12}

View File

@@ -1,7 +1,13 @@
import Link from "next/link";
import { useRouter } from 'next/router';
import { Pane, Heading } from "evergreen-ui";
export default function Nav() {
const router = useRouter();
const isActive = (href) => {
return router.pathname === href ? `active font-bold bg-slate-200 rounded-md` : '';
};
return (
<Pane display="flex">
<Link href="/">
@@ -9,12 +15,18 @@ export default function Nav() {
<img src="logo.png" className="h-12" />
</h2>
</Link>
<Link href="/pdf">
<h3 className="px-3 py-2 place-self-end">PDF</h3>
<Link href="/">
<h3 className={"px-3 py-2 place-self-end "+isActive('/')} style={{cursor: 'pointer'}}>Przekrój</h3>
</Link>
{/*<Link href="/kontakt">
<Link href="/cross">
<h3 className={"px-3 py-2 place-self-end "+isActive('/cross')} style={{cursor: 'pointer'}}>Siatka</h3>
</Link>
<Link href="/uziomy">
<h3 className={"px-3 py-2 place-self-end "+isActive('/uziomy')} style={{cursor: 'pointer'}}>Uziomy</h3>
</Link>
{/* <Link href="/kontakt">
<h3 className="px-3 py-2 place-self-end">Kontakt</h3>
</Link>*/}
</Link> */}
</Pane>
);
}

92
cross.py Normal file
View File

@@ -0,0 +1,92 @@
import sys
import ezdxf
import math
minx = 10000000000000
miny = 10000000000000
maxx = 0
maxy = 0
if len(sys.argv) > 0:
skala = int(sys.argv[1])
path = (sys.argv[2])
else:
skala = 50
alt = 0
fileName = path
def drawCross(x, y):
msp.add_text(
"X:"+str(x), dxfattribs={
"layer": "wsp", "height": 1, "style": "Arial"
}).set_pos((x+0.5, y+0.5))
msp.add_text(
"Y:"+str(y), dxfattribs={
"layer": "wsp", "height": 1, "style": "Arial"
}).set_pos((x+0.5, y-1.5))
msp.add_line((x-2.5, y), (x+2.5, y), dxfattribs={"layer": "siatka"})
msp.add_line((x, y-2.5), (x, y+2.5), dxfattribs={"layer": "siatka"})
try:
doc = ezdxf.readfile(fileName)
# iterate over all entities in modelspace
msp = doc.modelspace()
#doc.layers.add(name="siatka", color=0, linetype="SOLID")
for e in msp:
if e.dxftype() == "LINE":
if e.dxf.start[0] < minx:
minx = e.dxf.start[0]
if e.dxf.end[0] < minx:
minx = e.dxf.end[0]
if e.dxf.start[1] < miny:
miny = e.dxf.start[1]
if e.dxf.end[1] < miny:
miny = e.dxf.end[1]
if e.dxf.start[0] > maxx:
maxx = e.dxf.start[0]
if e.dxf.end[0] > maxx:
maxx = e.dxf.end[0]
if e.dxf.start[1] > maxy:
maxy = e.dxf.start[1]
if e.dxf.end[1] > maxy:
maxy = e.dxf.end[1]
elif e.dxftype() == "POLYLINE":
for point in e.points():
if point[0] < minx:
minx = point[0]
if point[1] < miny:
miny = point[1]
if point[0] > maxx:
maxx = point[0]
if point[1] > maxy:
maxy = point[1]
ys = (math.floor(miny/100)*100) - (50 * alt)
ye = (math.ceil(maxy/100)*100) - (50 * alt)
xs = (math.floor((minx)/100)*100) - (50 * alt)
xe = (math.ceil((maxx)/100)*100) - (50 * alt)
lenX = (xe - xs) + 100
lenY = (ye - ys) + 100
for x in range(0, int(lenX/skala)):
for y in range(0, int(lenY/skala)):
drawCross(xs+(x*skala),ys+(y*skala))
print(fileName)
doc.saveas(fileName[:-4]+"_s.dxf")
doc.saveas("public/cross.dxf")
except IOError:
print(f"Not a DXF file or a generic I/O error.")
sys.exit(1)
except ezdxf.DXFStructureError:
print(f"Invalid or corrupted DXF file.")
sys.exit(2)

BIN
dry_input_15.docx Normal file

Binary file not shown.

BIN
dry_input_3.docx Normal file

Binary file not shown.

View File

@@ -2,7 +2,7 @@ module.exports = {
apps : [{
name:'kroj',
script: 'npm',
args:'start',
args:'run start',
watch: ['pages'],
ignore_watch : ['public', 'P.txt']
}]

9571
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -7,23 +7,29 @@
"export": "next build && next export",
"start": "next start",
"lint": "next lint",
"deploy": "git pull && npm i && next build && pm2 restart kroj"
"deploy": "git pull && npm i && next build && pm2 restart kroj",
"buildRun": "next build && pm2 restart kroj"
},
"dependencies": {
"@socialgouv/matomo-next": "^1.3.0",
"@supercharge/request-ip": "^1.1.2",
"axios": "^0.26.0",
"child_process": "^1.0.2",
"cors": "^2.8.5",
"date-fns": "^2.30.0",
"docxtemplater": "^3.40.3",
"evergreen-ui": "^6.8.2",
"formidable": "^2.1.1",
"next": "^12.0.10",
"next-auth": "^4.2.1",
"nodemailer": "^6.7.2",
"pizzip": "^3.1.4",
"react": "17.0.2",
"react-datepicker": "^4.21.0",
"react-dom": "17.0.2"
},
"devDependencies": {
"autoprefixer": "^10.4.0",
"cypress": "^9.5.0",
"eslint": "8.4.1",
"eslint-config-next": "12.0.7",
"postcss": "^8.4.5",

56
pages/api/external.js Normal file
View File

@@ -0,0 +1,56 @@
import Cors from "cors";
import fs from "fs";
// Initializing the cors middleware
// You can read more about the available options here: https://github.com/expressjs/cors#configuration-options
const cors = Cors({
methods: ["POST"],
});
// Helper method to wait for a middleware to execute before continuing
// And to throw an error when an error happens in a middleware
function runMiddleware(req, res, fn) {
return new Promise((resolve, reject) => {
fn(req, res, (result) => {
if (result instanceof Error) {
return reject(result);
}
return resolve(result);
});
});
}
export default async function handler(req, res) {
// Run the middleware
await runMiddleware(req, res, cors);
const id = Math.floor(Math.random() * 90000) + 10000;
const textData = req.body;
let data = textData.split(",");
let text = "Próbkowanie: 1\nSegment 0: w dół\nX: Y, Z\n";
let i = 1;
for (let snippet of data) {
if (i % 3 != 0) {
text += snippet + ",";
} else {
text += snippet + "\n";
}
i += 1;
}
// console.log(text);
fs.writeFile(`externals/${id}.txt`, text, (err) => {
if (err) {
res.status(418);
throw err;
}
});
// console.log(textData);
res.status(200).send({ url: `https://test.wastpol.pl/?external=tru&id=${id}` });
}

86
pages/api/generateDocx.js Normal file
View File

@@ -0,0 +1,86 @@
import PizZip from "pizzip";
import Docxtemplater from "docxtemplater";
import fs from "fs";
import path from "path";
export default async (req, res) => {
if (req.method === "POST") {
// Get the data from the request body
const data = req.body;
// log stats
let ip = req.body.ip;
if (ip === undefined)
ip = req.headers["x-forwarded-for"] + " on " + req.headers["user-agent"];
let date_time = new Date();
let string =
fs.readFileSync("ground_log.txt", "utf8") +
"\n" +
"[" +
date_time +
"]" +
ip +
" : " +
data.geo_data +
" : " +
data.in_city;
fs.writeFile("ground_log.txt", string, function (err) {
if (err) {
return console.error(err);
}
});
//get wet coefficient
let input_docx;
if (data.wet_coef == 1.6) {
if (data.rod_len == 2) input_docx = "wet_input_15.docx";
else if (data.rod_len == 3) input_docx = "wet_input_3.docx";
} else {
if (data.rod_len == 2) input_docx = "dry_input_15.docx";
else if (data.rod_len == 3) input_docx = "dry_input_3.docx";
}
// Load the docx file as binary content
const content = fs.readFileSync(
path.resolve(process.cwd(), input_docx),
"binary"
);
const zip = new PizZip(content);
const doc = new Docxtemplater(zip, {
paragraphLoop: true,
linebreaks: true,
});
try {
// Render the document with data
console.log(data);
doc.render(data);
// Generate the document as a buffer
const buf = doc.getZip().generate({
type: "nodebuffer",
compression: "DEFLATE",
});
// Set headers for downloading the file
res.setHeader("Content-Disposition", "attachment; filename=opis.docx");
res.setHeader(
"Content-Type",
"application/vnd.openxmlformats-officedocument.wordprocessingml.document"
);
// Send the buffer as a response
res.send(buf);
} catch (error) {
// Handle errors
console.error(error);
res.status(500).json({ error: error.message });
}
} else {
// Handle non-POST requests
res.setHeader("Allow", ["POST"]);
res.status(405).end(`Method ${req.method} Not Allowed`);
}
};

39
pages/api/generateDxf.js Normal file
View File

@@ -0,0 +1,39 @@
import { exec } from 'child_process';
import fs from 'fs';
import path from 'path';
export default function handler(req, res) {
if (req.method === 'POST') {
// Get the input data from the request body
const data = req.body;
// Prepare arguments to pass to the Python script if needed
const scriptArgs = data.args || [];
console.log(scriptArgs)
const Arguments = "\"" + scriptArgs.join('" "') + "\"";
// Run the Python script and pass the arguments
exec(`python3 uziom.py ${Arguments}`, (error, stdout, stderr) => {
if (error) {
// Handle execution errors
console.error(`exec error: ${error}`);
return res.status(500).json({ message: 'Internal server error' });
}
// The output file needs to have been created by the Python script
const filePath = path.resolve('./public/uziom.dxf');
const fileName = 'uziom.dxf';
// Set headers for file download
res.setHeader('Content-Disposition', `attachment; filename=${fileName}`);
res.setHeader('Content-Type', 'application/dxf');
// Read and send the file data
const fileStream = fs.createReadStream(filePath);
fileStream.pipe(res);
});
} else {
// Handle any other HTTP methods if necessary
res.status(405).json({ message: 'Method not allowed' });
}
}

11
pages/api/readtext.js Normal file
View File

@@ -0,0 +1,11 @@
import fs from "fs";
export default function (req, res) {
fs.readFile(`externals/${req.body.id}.txt`, (err, data) => {
if (err) throw err;
res
.status(200)
.send({ data: data.toString().slice(0, data.toString().length - 1) });
});
}

View File

@@ -4,7 +4,7 @@ export default function (req, res) {
//console.log(req.body);
//file
let textData = req.body.profil;
let replacedData = textData.replace("<EFBFBD>", "o").replace("<EFBFBD>", "e");
let replacedData = textData.replace(" ", "o").replace(" ", "e");
console.log(replacedData);
var fs = require("fs");
@@ -14,10 +14,32 @@ export default function (req, res) {
}
});
// log stats
let ip = req.body.ip;
if (ip === undefined)
ip = req.headers["x-forwarded-for"] + " on " + req.headers["user-agent"];
let date_time = new Date();
let string =
fs.readFileSync("profile_log.txt", "utf8") +
"\n" +
"[" +
date_time +
"]" +
ip +
" : " +
replacedData
fs.writeFile("profile_log.txt", string, function (err) {
if (err) {
return console.error(err);
}
});
//py
let fileName = Math.floor(Math.random() * 9999) + 1000;
const python = spawn("python3", ["a.py", req.body.arguments.scale, fileName]);
const python = spawn("python3", ["a.py", req.body.arguments.scale, req.body.arguments.elementOne, req.body.arguments.elementTwo]);
let dataToSend;
python.stdout.on("data", function (data) {

105
pages/api/upload.js Normal file
View File

@@ -0,0 +1,105 @@
import fs from "fs";
import path from "path";
// import nextConnect from 'next-connect';
// import { sendFile } from 'next/dist/server/send-file';
import formidable from "formidable";
import { spawn } from "child_process";
export const config = {
api: {
bodyParser: false,
},
};
export default async function (req, res) {
const form = new formidable.IncomingForm();
try {
form.parse(req, async (err, fields, files) => {
if (err) {
return res.status(400).json({ message: err.message });
}
console.log('doing the saving')
const { filepath, originalFilename } = files.file;
const dateNow = Date.now()
const newFilename = `${Date.now()}-${originalFilename}`;
const newPath = path.join(
process.cwd(),
"public",
"uploads",
newFilename
);
console.log('i tried so hart')
const readStream = fs.createReadStream(filepath);
const writeStream = fs.createWriteStream(newPath);
readStream.on('error', function(err) {
console.error('Error while reading file.', err);
res.status(500).send('Error while uploading file.');
});
writeStream.on('error', function(err) {
console.error('Error while writing file.', err);
res.status(500).send('Error while uploading file.');
});
writeStream.on('finish', function() {
console.log('File copied successfully');
let dataToSend;
python.stdout.on("data", function (data) {
console.log("Pipe data from python script ...");
dataToSend = data.toString();
console.log(dataToSend);
});
python.stderr.on("data", (data) => {
console.error(`stderr: ${data}`);
res.send("Py Error: " + data);
});
// in close event we are sure that stream from child process is closed
python.on("close", (code) => {
console.log(`child process close all stdio with code ${code}`);
// send data to browser
console.log(dataToSend);
console.log("done");
try {
// const handler = nextConnect();
// handler.get(async (req, res) => {
const filename = newFilename; // get the filename from the query string
const filePath = path.join(process.cwd(), 'public', 'uploads', filename);
console.log(newFilename, filename, filePath, dataToSend)
res.status(200).send({ filename: newFilename, filepath:filePath, data: dataToSend });
// sendFile(req, filePath); // send the file as a response
// });
} catch (e) {
console.log("child process end");
}
});
});
readStream.pipe(writeStream);
console.log('and got so far')
let fileName = Math.floor(Math.random() * 9999) + 1000;
console.log('starting the engines', newPath)
const python = spawn("python3", ["cross.py", 50, newPath]);
console.log('oui')
// return res.status(200).json({ message: "File uploaded successfully" });
});
} catch (err) {
console.log("err: ", err)
return res.status(500).json({ message: err.message });
}
}

190
pages/cross.js Normal file
View File

@@ -0,0 +1,190 @@
import Head from "next/head";
import { useState, useCallback } from "react";
import styles from "../styles/Home.module.css";
import Header from "../components/templates/header";
import Nav from "../components/templates/nav";
import UserTop from "../components/templates/userTop";
import Content from "../components/templates/content";
import Footer from "../components/templates/footer";
import { useSession, signIn, signOut } from "next-auth/react";
import {
Pane,
TextInputField,
TextareaField,
Button,
BuildIcon,
toaster,
Alert,
FileUploader,
FilePicker,
FileCard,
} from "evergreen-ui";
import axios from "axios";
export default function Cross() {
const { data: session } = useSession();
const [fileData, setFileData] = useState(null);
const handleDownload = () => {
console.log("down");
if (fileData) {
console.log("load");
// const link = document.createElement("a");
// link.href = `data:application/octet-stream;base64,${fileData}`;
// link.download = "plik.dxf";
// link.click();
document.getElementById("down").download = fileData.filename;
console.log(fileData.filename)
document.getElementById("down").href = "cross.dxf";
console.log("cross.dxf")
document.getElementById("down").click();
}
};
const [files, setFiles] = useState([]);
const [fileRejections, setFileRejections] = useState([]);
const handleChange = useCallback((files) => setFiles([files[0]]), []);
const handleRejected = useCallback(
(fileRejections) => setFileRejections([fileRejections[0]]),
[]
);
const handleRemove = useCallback(() => {
setFiles([]);
setFileRejections([]);
}, []);
const handleSubmit = async (event) => {
event.preventDefault();
let file = files[0];
if (!file) {
// Handle error if no file is selected
return;
}
const formData = new FormData();
formData.append("file", file);
axios
.post("/api/upload", formData, {
headers: {
"Content-Type": "multipart/form-data",
},
})
.then((response) => {
console.log(response.data);
if (response.data.toString().startsWith("Py Error")) {
toaster.danger(response.data);
return;
}
toaster.warning(response.statusText);
console.log(response.data)
setFileData(response.data);
document.getElementById("download").disabled = false;
// document.getElementById("down").download =
// response.data.filename.toString().split(".")[0].split("-")[1]+"_s.dxf";
// document.getElementById("down").href =
// "uploads/"+response.data.filename.toString().split(".")[0]+"_s.dxf";
// document.getElementById("down").click();
})
.catch((error) => {
console.error(error);
});
};
if (session) {
return (
<div className="">
<Head>
<title>Wastpol</title>
</Head>
<div className="flex md:flex-row flex-col justify-between px-8 mt-2">
<Nav />
<UserTop session={session} />
</div>
<main className="flex flex-1 flex-col items-center">
<FileUploader
label="Prześlij plik"
description="Możesz dodać 1 plik, max 50 MB."
maxSizeInBytes={50 * 1024 ** 2}
maxFiles={1}
onChange={handleChange}
onRejected={handleRejected}
renderFile={(file) => {
const { name, size, type } = file;
const fileRejection = fileRejections.find(
(fileRejection) => fileRejection.file === file
);
const { message } = fileRejection || {};
return (
<FileCard
key={name}
isInvalid={fileRejection != null}
name={name}
onRemove={handleRemove}
sizeInBytes={size}
type={type}
validationMessage={message}
/>
);
}}
values={files}
/>
<Button
marginY={8}
marginRight={12}
appearance="default"
iconAfter={BuildIcon}
onClick={(e) => {
console.log("louding begins");
console.log(files);
document.getElementById("download").disabled = false;
handleSubmit(e);
}}
>
Dodaj siatkę
</Button>
<Button
id="download"
marginY={8}
marginRight={12}
appearance="default"
iconAfter={BuildIcon}
// disabled={true}
onClick={handleDownload}
>
Pobierz
</Button>
<a href="the.dxf" download="the.dxf" id="down">
{" "}
</a>
</main>
</div>
);
}
return (
<div className="grid place-items-center h-screen">
<Head>
<title>Wastpol</title>
</Head>
<div className="flex flex-col justify-center">
<h2 className="p-2">Nie zalogowano</h2>
<br></br>
<Button
onClick={() => signIn()}
appearance="primary"
// className="p-2 bg-slate-200 rounded-md"
>
Zaloguj
</Button>
</div>
</div>
);
}

551
pages/uziomy.js Normal file
View File

@@ -0,0 +1,551 @@
import Head from "next/head";
import styles from "../styles/Home.module.css";
import Nav from "../components/templates/nav";
import UserTop from "../components/templates/userTop";
import { useSession, signIn, signOut } from "next-auth/react";
import { useState, useCallback } from "react";
import {
Pane,
TextInputField,
TextareaField,
Button,
BuildIcon,
toaster,
Alert,
FileUploader,
FilePicker,
FileCard,
RadioGroup,
Autocomplete,
} from "evergreen-ui";
import PizZip from "pizzip";
import Docxtemplater from "docxtemplater";
import DatePicker from "react-datepicker";
import { registerLocale, setDefaultLocale } from "react-datepicker";
import "react-datepicker/dist/react-datepicker.css";
import pl from "date-fns/locale/pl";
registerLocale("pl", pl);
export default function Rezy() {
const { data: session } = useSession();
const [currentStep, setCurrentStep] = useState(1);
const [ground, setGround] = useState({
wet_coef: 0,
resistivity: 0,
resistance: 0,
measure_dist: 0,
rod_len: 0,
rod_num: 0,
rod_coef: 0,
hor_len: 0,
result_v: 0,
result_h: 0,
result: 0,
wszrg_h: 0,
wszrg_v: 0,
wanted: 0,
date: undefined,
no: 0,
pr_title: "Budowa przyłącza kablowego nN",
in_city: undefined,
commune: undefined,
all_parcels: undefined,
target_parcel: undefined,
geo_data: undefined,
object: "Przyłącz kablowy nN",
objValue1: "proj.",
objName: undefined,
});
// Function to go to the next step
const goToNextStep = () => {
if (currentStep < 3) {
setCurrentStep(currentStep + 1);
}
};
// Function to go to the previous step
const goToPreviousStep = () => {
if (currentStep > 1) {
setCurrentStep(currentStep - 1);
}
};
const [date, setDate] = useState(null);
const [calDate, setCalDate] = useState(null);
const [options] = useState([
{ label: "5 Ω", value: "5" },
{ label: "10 Ω", value: "10" },
{ label: "15 Ω", value: "15" },
{ label: "30 Ω", value: "30" },
]);
const [neededValue, setNeededValue] = useState("5");
const [resHValue, setResHValue] = useState("88");
const [resVValue, setResVValue] = useState("89");
const [objOptions1] = useState([
{ label: "proj.", value: "proj." },
{ label: "istn.", value: "istn." },
]);
const [objValue1, setObjValue1] = useState("proj.");
function getRandomInt(min, max) {
min = Math.ceil(min);
max = Math.floor(max);
return Math.floor(Math.random() * (max - min + 1)) + min;
}
function parseDate(dateString) {
console.log(dateString);
const parts = dateString.split(".");
const day = parseInt(parts[0], 10);
const month = parseInt(parts[1], 10) - 1; // Months are 0-indexed in JavaScript Dates
const year = parseInt(parts[2], 10);
return new Date(year, month, day);
}
function getGrounding(wanted, wszrg_h, wszrg_v, date) {
const dateObject = parseDate(date);
const month = dateObject.getMonth() + 1; // JavaScript months are 0-indexed
const wet_coef = month >= 6 && month <= 9 ? 1.2 : 1.6;
const rod_len = wanted === 30 ? 2 : 3;
const resistivity_h = wszrg_h / wet_coef;
const measure_dist_h = 1;
const resistance_h = resistivity_h / (2 * Math.PI * measure_dist_h);
const resistivity_v = wszrg_v / wet_coef;
const measure_dist_v = 1 + rod_len;
const resistance_v = resistivity_v / (2 * Math.PI * measure_dist_v);
const result_v =
(wszrg_v / (2 * Math.PI * rod_len)) *
(Math.log((8 * rod_len) / 0.016) - 1);
let rod_num = 2; //minimum 2 rods
let hor_len = 1 + (rod_num - 1) * rod_len * 2;
let result_h =
(wszrg_h / (2 * Math.PI * hor_len)) *
Math.log((hor_len * hor_len) / (1 * 0.0191));
let rod_coef =
Math.pow(rod_num, 4) * 0.00002 -
Math.pow(rod_num, 3) * 0.0009 +
Math.pow(rod_num, 2) * 0.0137 -
rod_num * 0.0981 +
1.0468;
let result =
(result_v * result_h) /
(result_v * rod_coef + rod_num * result_h * rod_coef);
while (result > wanted) {
rod_num += 1;
hor_len = 1 + (rod_num - 1) * rod_len * 2;
result_h =
(wszrg_h / (2 * Math.PI * hor_len)) *
Math.log((hor_len * hor_len) / (1 * 0.0191));
rod_coef =
Math.pow(rod_num, 4) * 0.00002 -
Math.pow(rod_num, 3) * 0.0009 +
Math.pow(rod_num, 2) * 0.0137 -
rod_num * 0.0981 +
1.0468;
result =
(result_v * result_h) /
(result_v * rod_coef + rod_num * result_h * rod_coef);
console.log(result, rod_num);
}
console.log(result, rod_num);
return {
wet_coef: wet_coef,
resistivity_h: resistivity_h.toFixed(2),
resistance_h: resistance_h.toFixed(2),
measure_dist_h: measure_dist_h,
resistivity_v: resistivity_v.toFixed(2),
resistance_v: resistance_v.toFixed(2),
measure_dist_v: measure_dist_v,
rod_len: rod_len,
rod_num: rod_num,
rod_coef: rod_coef.toFixed(2),
hor_len: hor_len,
result_v: result_v.toFixed(2),
result_h: result_h.toFixed(2),
result: result.toFixed(2),
wszrg_h: wszrg_h,
wszrg_v: wszrg_v,
wanted: neededValue,
};
}
const generateDocument = async (ground) => {
const data = {
...ground,
resisted_object: ground.objValue1 + " " + ground.objName,
};
try {
const response = await fetch("/api/generateDocx", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify(data),
});
if (!response.ok) {
throw new Error(`Error: ${response.status}`);
}
// Convert the response to a blob and download it
const blob = await response.blob();
const downloadUrl = window.URL.createObjectURL(blob);
const link = document.createElement("a");
link.href = downloadUrl;
link.download = "opis.docx";
document.body.appendChild(link);
link.click();
link.remove();
} catch (error) {
console.error("Failed to generate document:", error);
}
};
const generateDxf = async () => {
// Data that you want to send to the backend
var dateParts = ground.date.split(".");
// Extract day, month, and year
var day = parseInt(dateParts[0], 10);
var month = parseInt(dateParts[1], 10);
var year = parseInt(dateParts[2], 10);
// Format the result
var formattedDate = month.toString().padStart(2, "0") + "." + year;
const inputData = {
args: [
ground.objValue1 + ground.objName,
ground.pr_title,
ground.object,
ground.in_city +
", " +
ground.commune +
", dz. nr " +
ground.all_parcels,
formattedDate,
ground.hor_len,
ground.rod_len,
],
};
// object1 = args[0] #ZK2a-1P
// object2 = args[1] #Budowa przyłącza
// object3 = args[2] #Przyłącze kablowe
// adres = args[3]
// date = args[4]
// len_h = int(args[5])
// len_v = int(args[6])
try {
const response = await fetch("/api/generateDxf", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify(inputData),
});
if (!response.ok) {
throw new Error("Response was not ok.");
}
// Download the response (the output file)
const blob = await response.blob();
const downloadUrl = URL.createObjectURL(blob);
const a = document.createElement("a");
a.href = downloadUrl;
a.download = "uziom.dxf";
document.body.appendChild(a);
a.click();
a.remove();
} catch (error) {
console.error("There was an error:", error);
}
};
if (session) {
return (
<div className="">
<Head>
<title>Wastpol</title>
</Head>
<div className="flex md:flex-row flex-col justify-between px-8 mt-2">
<Nav />
<UserTop session={session} />
</div>
<main className="flex flex-1 flex-col items-center">
<div className="flex flex-row m-24 space-x-24">
<div>
1. Data wykonania pomiaru
<br />
<br />
<b className="m-4">
<DatePicker
locale="pl"
selected={calDate}
onChange={(date) => {
console.log(date);
console.log(typeof date);
const day = date.getDate().toString().padStart(2, "0"); // Add leading zero if necessary
const month = (date.getMonth() + 1)
.toString()
.padStart(2, "0"); // Month is 0-indexed, add 1 to get the correct month
const year = date.getFullYear();
const formattedDate = `${day}.${month}.${year}`;
console.log(formattedDate);
setGround((current) => ({
...current,
date: formattedDate,
}));
setCalDate(date);
}}
placeholderText="Wybierz datę"
dateFormat="dd.MM.yyyy"
/>
</b>
<br />
<br />
<RadioGroup
label="2. Wymagane uziemienie"
size={16}
value={neededValue}
options={options}
onChange={(event) => {
setNeededValue(event.target.value);
}}
/>
<TextInputField
label="3. Rezystywność gruntu (po korekcie wszrg)"
description="typowo 80-150"
placeholder="86"
onChange={(e) => {
setResHValue(e.target.value);
setResVValue((ground.wanted==30)?
getRandomInt(
parseInt(e.target.value) - 10,
parseInt(e.target.value) - 4
):getRandomInt(
parseInt(e.target.value) - 20,
parseInt(e.target.value) - 10
)
);
}}
value={resHValue}
/>
<TextInputField
label="4. Numer protokołu rezystywności gruntu"
// description=""
placeholder="435"
onChange={(e) =>
setGround((current) => ({ ...current, no: e.target.value }))
}
value={ground.no}
/>{" "}
</div>
<div>
<TextInputField
label="5. Tytuł projektu"
description="Budowa/modernizacja przyłącza/sieci kablowej/napowietrznej"
placeholder="Budowa przyłącza kablowego nN"
width={440}
onChange={(e) =>
setGround((current) => ({
...current,
pr_title: e.target.value,
}))
}
value={ground.pr_title}
/>
<TextInputField
label="6. Obiekt"
// description=""
placeholder="Przyłącz kablowy nN"
onChange={(e) =>
setGround((current) => ({
...current,
object: e.target.value,
}))
}
value={ground.object}
/>
<TextInputField
label="7. Miejscowość"
// description=""
placeholder="Paszyn"
onChange={(e) =>
setGround((current) => ({
...current,
in_city: e.target.value,
}))
}
value={ground.in_city}
/>
<TextInputField
label="8. Gmina/Obręb"
// description=""
placeholder="gm. Chełmiec lub obr. 116"
onChange={(e) =>
setGround((current) => ({
...current,
commune: e.target.value,
}))
}
value={ground.commune}
/>
<TextInputField
label="9. Działki"
// description=""
placeholder="Wszystkie numery działek"
onChange={(e) =>
setGround((current) => ({
...current,
all_parcels: e.target.value,
}))
}
value={ground.all_parcels}
/>
<TextInputField
label="10. Działka przyłączana"
// description=""
placeholder="423"
onChange={(e) =>
setGround((current) => ({
...current,
target_parcel: e.target.value,
}))
}
value={ground.target_parcel}
/>
<TextInputField
label="11. Współrzędne układu uziomowego"
// description=""
placeholder={"49°42'54\"N 20°38'0\"E"}
onChange={(e) =>
setGround((current) => ({
...current,
geo_data: e.target.value,
}))
}
value={ground.geo_data}
/>{" "}
</div>
<div>
<RadioGroup
label="1. Projektowany/istniejący"
size={16}
value={objValue1}
options={objOptions1}
onChange={(event) => {
setObjValue1(event.target.value);
setGround((current) => ({
...current,
objValue1: event.target.value,
}));
}}
/>
<TextInputField
label="2. Nazwa uziemianego obiektu"
// description=""
placeholder={"ZK2a-1P lub słup nr 54"}
width={440}
onChange={(e) =>
setGround((current) => ({
...current,
objName: e.target.value,
}))
}
value={ground.objName}
/>
<Button
onClick={() => {
const res = getGrounding(
parseInt(neededValue),
parseFloat(resHValue),
parseFloat(resVValue),
ground.date
);
setGround((current) => ({ ...current, ...res }));
}}
appearance="primary"
// className="p-2 bg-slate-200 rounded-md"
>
Oblicz Uziemienie
</Button>
<Button
onClick={() => {
const docx = generateDocument(ground);
}}
appearance="primary"
// className="p-2 bg-slate-200 rounded-md"
>
Generuj Opis
</Button>
<Button
onClick={generateDxf}
appearance="primary"
// className="p-2 bg-slate-200 rounded-md"
>
Generuj Rysunek
</Button>
<h2>
Uziemienie poziome: {ground.result_h} Ω ({ground.wszrg_h})
</h2>
<h2>
Uziemienie pionowe: {ground.result_v} Ω ({ground.wszrg_v})
</h2>
<h2>Uziemienie: {ground.result} Ω</h2>
<h2>Szpile: {ground.rod_num} szt</h2>
<h2>Bednarka: {ground.hor_len} m</h2>
</div>
</div>
</main>
</div>
);
}
return (
<div className="grid place-items-center h-screen">
<Head>
<title>Wastpol</title>
</Head>
<div className="flex flex-col justify-center">
<h2 className="p-2">Nie zalogowano</h2>
<br></br>
<Button
onClick={() => signIn()}
appearance="primary"
// className="p-2 bg-slate-200 rounded-md"
>
Zaloguj
</Button>
</div>
</div>
);
}

198
uziom.py Normal file
View File

@@ -0,0 +1,198 @@
import ezdxf
import sys
args = sys.argv[1:]
print(args)
object1 = args[0] #ZK2a-1P
object2 = args[1] #Budowa
object3 = args[2] #Przylacze
adres = args[3]
date = args[4]
len_h = int(args[5])
len_v = float(args[6])
a4_x = 31.5
a4_y = 44.55
# len_h = 25
# len_v = 3
rod_num = int(((len_h - 1)/(len_v*2)) + 1)
zk_width = 0.665
zk_depth = 0.32
zk_height = 1.64
start_x = ((a4_x - len_h) / 2) + zk_width
start_y = 28
overedge = 0.5
# date = "06.2023"
start_y2 = start_y - 7.5 #drugi uziom
doc = ezdxf.new(dxfversion="R2013", setup=False)
msp = doc.modelspace()
#doc.layers.add(name="tabele", color=0, linetype="SOLID")
#doc.layers.add(name="bednarka", color=1, linetype="SOLID")
#doc.layers.add(name="uziom", color=3, linetype="SOLID")
#doc.layers.add(name="zk", color=0, linetype="SOLID")
#doc.layers.add(name="opisy", color=0, linetype="SOLID")
#doc.layers.add(name="grunt", color=0, linetype="SOLID")
hatch = msp.add_hatch(color=3)
hatch_ground = msp.add_hatch(color=0)
hatch_gravel = msp.add_hatch(color=254)
doc.styles.new("Arial", dxfattribs={"font" : "Arial.ttf"})
#WYDURK
msp.add_line((0, 0), (0, a4_y), dxfattribs={"layer": "tabele", "color":0})
msp.add_line((0, a4_y), (a4_x, a4_y), dxfattribs={"layer": "tabele", "color":0})
msp.add_line((a4_x, a4_y), (a4_x, 0), dxfattribs={"layer": "tabele", "color":0})
msp.add_line((a4_x, 0), (0, 0), dxfattribs={"layer": "tabele", "color":0})
#UZIOM WIDOK Z Gory
msp.add_line((start_x, start_y), (start_x + len_h, start_y), dxfattribs={"layer": "bednarka", "color":1})
for rod in range(0,rod_num):
#kola i kreskowanie
msp.add_circle((start_x+1+(len_v*2*rod), start_y), 0.15, dxfattribs={"layer": "uziom", "color":3})
edge_path = hatch.paths.add_edge_path()
edge_path.add_arc((start_x+1+(len_v*2*rod), start_y), radius=0.15, start_angle=0, end_angle=360)
#wymiary
msp.add_line((start_x+1+(len_v*2*rod), start_y), (start_x+1+(len_v*2*rod), start_y+1), dxfattribs={"layer": "opisy"})
if rod == rod_num-1: continue
dim = msp.add_linear_dim(
base=(start_x+1+(len_v*2*rod), start_y+1), # location of the dimension line
p1=(start_x+1+(len_v*2*rod), start_y), # 1st measurement point
p2=(start_x+1+(len_v*2*(rod+1)), start_y), # 2nd measurement point
dimstyle="EZ_CURVED", # default dimension style
override={
# "dimtxsty": "Standard",
"dimtxt": 0.5,
"dimasz": 0.5,
},
text=str(len_v*2)+" m"
).render()
#wymiar 1. metra
dim = msp.add_linear_dim(
base=(start_x, start_y+1), # location of the dimension line
p1=(start_x, start_y), # 1st measurement point
p2=(start_x+1, start_y), # 2nd measurement point
dimstyle="EZ_CURVED", # default dimension style
override={
# "dimtxsty": "Standard",
"dimtxt": 0.5,
"dimasz": 0.5,
},
text="1 m"
).render()
#ZK WIDOK Z Gory
msp.add_line((start_x-zk_width, start_y+zk_depth/2), (start_x, start_y+zk_depth/2), dxfattribs={"layer": "zk"})
msp.add_line((start_x, start_y+zk_depth/2), (start_x, start_y-zk_depth/2), dxfattribs={"layer": "zk"})
msp.add_line((start_x, start_y-zk_depth/2), (start_x-zk_width, start_y-zk_depth/2), dxfattribs={"layer": "zk"})
msp.add_line((start_x-zk_width, start_y-zk_depth/2), (start_x-zk_width, start_y+zk_depth/2), dxfattribs={"layer": "zk"})
#UZIOM WIDOK Z BOKU
msp.add_line((start_x - zk_width / 2, start_y2), (start_x + len_h, start_y2), dxfattribs={"layer": "bednarka", "color":1})
msp.add_line((start_x - zk_width / 2, start_y2), (start_x - zk_width / 2, start_y2+0.2), dxfattribs={"layer": "bednarka", "color":1})
for rod in range(0,rod_num):
msp.add_line((start_x+1+(rod*len_v*2), start_y2+0.02), (start_x+1+(rod*len_v*2), start_y2-len_v), dxfattribs={"layer": "uziom", "color":3})
msp.add_line((start_x+1+(rod*len_v*2), start_y2+0.02), (start_x+1+(rod*len_v*2)+0.016, start_y2+0.02), dxfattribs={"layer": "uziom", "color":3})
msp.add_line((start_x+1+(rod*len_v*2)+0.016, start_y2+0.02), (start_x+1+(rod*len_v*2)+0.016, start_y2-len_v), dxfattribs={"layer": "uziom", "color":3})
msp.add_line((start_x+1+(rod*len_v*2), start_y2-len_v), (start_x+1+(rod*len_v*2)+0.016, start_y2-len_v), dxfattribs={"layer": "uziom", "color":3})
dim = msp.add_linear_dim(
base=(start_x+0.5, start_y2+1), # location of the dimension line
p1=(start_x+0.5, start_y2+1), # 1st measurement point
p2=(start_x+0.5, start_y2), # 2nd measurement point
dimstyle="EZ_CURVED", # default dimension style
override={
# "dimtxsty": "Standard",
"dimtxt": 0.5,
"dimasz": 0.5,
"dimjust": 3,
},
text="h=1 m",
angle=-90
).render()
#PODZIEMIE WIDOK Z BOKU
msp.add_line((start_x, start_y2 + 1), (start_x + len_h + overedge, start_y2 + 1), dxfattribs={"layer": "grunt"})
hatch_ground.set_pattern_fill("EARTH2", scale=0.1)
hatch_ground.paths.add_polyline_path(
[(start_x, start_y2 + 1), (start_x + len_h + overedge, start_y2 + 1), (start_x + len_h + overedge, start_y2 + 0.5), (start_x, start_y2 + 0.5)], is_closed=True
)
hatch_gravel.set_pattern_fill("CONCRETE2", scale=0.1)
hatch_gravel.paths.add_polyline_path(
[(start_x, start_y2 + 1), (start_x + len_h + overedge, start_y2 + 1), (start_x + len_h + overedge, start_y2 -(len_v+1)), (start_x, start_y2 -(len_v+1))], is_closed=True
)
#ZK WIDOK Z BOKU
msp.add_line((start_x - zk_width, start_y2+(zk_height/2)+1), (start_x, start_y2+(zk_height/2)+1), dxfattribs={"layer": "zk"})
msp.add_line((start_x, start_y2+(zk_height/2)+1), (start_x, start_y2-(zk_height/2)+1), dxfattribs={"layer": "zk"})
msp.add_line((start_x, start_y2-(zk_height/2)+1), (start_x-zk_width, start_y2-(zk_height/2)+1), dxfattribs={"layer": "zk"})
msp.add_line((start_x-zk_width, start_y2-(zk_height/2)+1), (start_x - zk_width, start_y2+(zk_height/2)+1), dxfattribs={"layer": "zk"})
msp.add_text(object1, dxfattribs={"layer": "opisy", "height": 0.55, "rotation": 0, "style": "OpenSans"}).set_pos((start_x - (zk_width/2) , start_y2+2.3), align="CENTER")
#OPISY
msp.add_text("SCHEMAT ROZMIESZCZENIA UZIOMÓW", dxfattribs={"layer": "opisy", "height": 0.55, "rotation": 0, "style": "OpenSans"}).set_pos((a4_x/2, a4_y-5.5), align="CENTER")
#TABELKA
start_xt = a4_x - 1.5 - 24
start_yt = 2
points = [(start_xt, start_yt), (start_xt + 24, start_yt), (start_xt + 24, start_yt+4), (start_xt, start_yt+4), (start_xt, start_yt)]
msp.add_lwpolyline(points, dxfattribs={"layer": "opisy"})
msp.add_line((start_xt, start_yt+1), (start_xt + 16, start_yt+1), dxfattribs={"layer": "opisy"})
msp.add_text("RYSUNEK", dxfattribs={"layer": "opisy", "height": 0.25, "rotation": 0, "style": "Arial"}).set_pos((start_xt+1.5, start_yt+1+0.17), align="CENTER")
msp.add_text("Konfiguracja układu uziomowego", dxfattribs={"layer": "opisy", "height": 0.25, "rotation": 0, "style": "Arial"}).set_pos((start_xt+3+0.18, start_yt+1+0.17), align="LEFT")
msp.add_line((start_xt, start_yt+1.6), (start_xt + 16, start_yt+1.6), dxfattribs={"layer": "opisy"})
msp.add_text("TEMAT", dxfattribs={"layer": "opisy", "height": 0.25, "rotation": 0, "style": "Arial"}).set_pos((start_xt+1.5, start_yt+1.6+0.17), align="CENTER")
msp.add_text(object2, dxfattribs={"layer": "opisy", "height": 0.25, "rotation": 0, "style": "Arial"}).set_pos((start_xt+3+0.18, start_yt+1.6+0.17), align="LEFT")
msp.add_line((start_xt, start_yt+2.2), (start_xt + 16, start_yt+2.2), dxfattribs={"layer": "opisy"})
msp.add_text("ADRES", dxfattribs={"layer": "opisy", "height": 0.25, "rotation": 0, "style": "Arial"}).set_pos((start_xt+1.5, start_yt+2.2+0.17), align="CENTER")
msp.add_text(adres, dxfattribs={"layer": "opisy", "height": 0.25, "rotation": 0, "style": "Arial"}).set_pos((start_xt+3+0.18, start_yt+2.2+0.17), align="LEFT")
msp.add_line((start_xt, start_yt+2.8), (start_xt + 16, start_yt+2.8), dxfattribs={"layer": "opisy"})
msp.add_text("OBIEKT", dxfattribs={"layer": "opisy", "height": 0.25, "rotation": 0, "style": "Arial"}).set_pos((start_xt+1.5, start_yt+2.8+0.17), align="CENTER")
msp.add_text(object3, dxfattribs={"layer": "opisy", "height": 0.25, "rotation": 0, "style": "Arial"}).set_pos((start_xt+3+0.18, start_yt+2.8+0.17), align="LEFT")
msp.add_line((start_xt, start_yt+3.4), (start_xt + 16, start_yt+3.4), dxfattribs={"layer": "opisy"})
msp.add_text("INWESTOR", dxfattribs={"layer": "opisy", "height": 0.25, "rotation": 0, "style": "Arial"}).set_pos((start_xt+1.5, start_yt+3.4+0.17), align="CENTER")
msp.add_text("TAURON Dystrybucja S.A.", dxfattribs={"layer": "opisy", "height": 0.25, "rotation": 0, "style": "Arial"}).set_pos((start_xt+3+0.18, start_yt+3.4+0.17), align="LEFT")
msp.add_line((start_xt+3, start_yt), (start_xt + 3, start_yt+4), dxfattribs={"layer": "opisy"})
msp.add_line((start_xt+16, start_yt), (start_xt + 16, start_yt+4), dxfattribs={"layer": "opisy"})
msp.add_line((start_xt+3, start_yt+0.5), (start_xt + 16, start_yt+0.5), dxfattribs={"layer": "opisy"})
msp.add_text("STADIUM", dxfattribs={"layer": "opisy", "height": 0.25, "rotation": 0, "style": "Arial"}).set_pos((start_xt+3+1.625, start_yt+0.5+0.15), align="CENTER")
msp.add_text("PB", dxfattribs={"layer": "opisy", "height": 0.25, "rotation": 0, "style": "Arial"}).set_pos((start_xt+3+1.625, start_yt+0.15), align="CENTER")
msp.add_line((start_xt+3+3.25, start_yt), (start_xt + 3 + 3.25, start_yt+1), dxfattribs={"layer": "opisy"})
msp.add_text("DATA", dxfattribs={"layer": "opisy", "height": 0.25, "rotation": 0, "style": "Arial"}).set_pos((start_xt+3+3.25+1.625, start_yt+0.5+0.15), align="CENTER")
msp.add_text(date, dxfattribs={"layer": "opisy", "height": 0.25, "rotation": 0, "style": "Arial"}).set_pos((start_xt+3+3.25+1.625, start_yt+0.15), align="CENTER")
msp.add_line((start_xt+3+6.5, start_yt), (start_xt + 3 + 6.5, start_yt+1), dxfattribs={"layer": "opisy"})
msp.add_text("SKALA", dxfattribs={"layer": "opisy", "height": 0.25, "rotation": 0, "style": "Arial"}).set_pos((start_xt+3+6.5+1.625, start_yt+0.5+0.15), align="CENTER")
msp.add_text("1:150", dxfattribs={"layer": "opisy", "height": 0.25, "rotation": 0, "style": "Arial"}).set_pos((start_xt+3+6.5+1.625, start_yt+0.15), align="CENTER")
msp.add_line((start_xt+3+9.75, start_yt), (start_xt + 3 + 9.75, start_yt+1), dxfattribs={"layer": "opisy"})
msp.add_text("NR RYS", dxfattribs={"layer": "opisy", "height": 0.25, "rotation": 0, "style": "Arial"}).set_pos((start_xt+3+9.75+1.625, start_yt+0.5+0.15), align="CENTER")
msp.add_text("5", dxfattribs={"layer": "opisy", "height": 0.25, "rotation": 0, "style": "Arial"}).set_pos((start_xt+3+9.75+1.625, start_yt+0.15), align="CENTER")
msp.add_text("pręt uziemiający Ø16 - dł. "+ str(len_v) +" mb - "+ str(rod_num) +" szt.", dxfattribs={"layer": "opisy", "height": 0.25, "rotation": 0, "style": "Arial"}).set_pos((start_xt+2.5, start_yt+4+0.7), align="LEFT")
msp.add_circle((start_xt+1.5, start_yt + 4.8), 0.15, dxfattribs={"layer": "uziom", "color":3})
edge_path = hatch.paths.add_edge_path()
edge_path.add_arc((start_xt+1.5, start_yt + 4.8), radius=0.15, start_angle=0, end_angle=360)
msp.add_text("płaskownik St/Zn 30x4 mm - dł. "+ str(len_h) +" mb", dxfattribs={"layer": "opisy", "height": 0.25, "rotation": 0, "style": "Arial"}).set_pos((start_xt+2.5, start_yt+4+1.4), align="LEFT")
msp.add_line((start_xt +0.8, start_yt+4+1.5), (start_xt + 2.1, start_yt+4+1.5), dxfattribs={"layer": "bednarka", "color":1})
doc.saveas("public/uziom.dxf")

BIN
wet_input_15.docx Normal file

Binary file not shown.

BIN
wet_input_3.docx Normal file

Binary file not shown.