How to close path for complex path in TikZ?

I'm doing a bit of 3D primitive fugures using this code:

\documentclass[tikz,10pt]{standalone}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{mathptmx}
\newcommand{\Grid}[2]{
\draw[white] (0,0)--(#1cm,0)--(#1cm,#2cm)--(0,#2cm)--(0,0);
\draw[very thin,color=gray] (0,0) grid (#1,#2);
\foreach \j  in {0,...,#1} {
\node[] at (\j,0) {$\j$};
}

\foreach \j  in {0,...,#2} {
\node[] at (0,\j) {$\j$};
}}
\begin{document}

\begin{tikzpicture}[line width=1pt,node distance=.1cm]
\tikzset{drawstyle1/.style={draw=cyan,fill=brown!50}}
\tikzset{drawstyle2/.style={draw=black,fill=cyan}}

%GRID
%+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
\Grid{8}{10}
%===================================================================
%Brown parr
\coordinate (A) at (0,2);
\coordinate (B) at (0,7);
\coordinate (C) at (0.3,7);
\coordinate (D) at (0.3,2);
\def\Anf{60}
\newcommand{\parr}[7]{
\draw[#7] (#1,#2)--(#1,#2+#3)--(#1+#5,#2+#3)--(#1+#5,#2)--cycle;

\draw[#7] (#1,#2+#3)--++(#6:#4)--++(0:#5)--(#1+#5,#2+#3)--cycle;
\draw[#7](#1+#5,#2+#3)--(#1+#5,#2)--++(#6:#4)--++(90:#3)--(#1+#5,#2+#3)--cycle;
}
\parr{0cm}{2cm}{5cm}{3cm}{0.3cm}{45}{drawstyle1}
\parr{.3cm}{2cm}{.5cm}{3cm}{7cm}{45}{drawstyle2}

\end{tikzpicture}
\end{document}


This is what I got:

My problem is that I can not found right way to close paths? I close path in drawing rectangles by points like this:

\draw[#7] (#1,#2)--(#1,#2+#3)--(#1+#5,#2+#3)--(#1+#5,#2)--cycle;


But when I start to draw another rectangle touching first, there is a problem with lines at corners.

What is the simple or complex way to close paths correctly? Should I use clip somehow?

-
Quick fix: add line join=round to your tikzpicture options to avoid the artefacts. –  Jake Feb 18 at 10:31
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.5002864599227905, "perplexity": 5236.521880060331}, "config": {"markdown_headings": false, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.3, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2014-52/segments/1419447551125.41/warc/CC-MAIN-20141224185911-00036-ip-10-231-17-201.ec2.internal.warc.gz"}