Merge branch 'master' into master

This commit is contained in:
Dino del Favero
2020-12-15 21:41:59 +01:00
committed by GitHub
22 changed files with 964 additions and 57 deletions

View File

@@ -105,6 +105,7 @@
<file>icons/Snap_Perpendicular.svg</file>
<file>icons/Snap_Special.svg</file>
<file>icons/Snap_WorkingPlane.svg</file>
<file>icons/Draft_NewLayer.svg</file>
<file>patterns/aluminium.svg</file>
<file>patterns/brick01.svg</file>
<file>patterns/concrete.svg</file>

View File

@@ -0,0 +1,720 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
version="1.1"
id="svg2985"
height="64px"
width="64px">
<title
id="title853">Draft_Layer</title>
<defs
id="defs2987">
<linearGradient
id="linearGradient3815">
<stop
id="stop3817"
offset="0"
style="stop-color:#d3d7cf;stop-opacity:1;" />
<stop
id="stop3819"
offset="1"
style="stop-color:#ffffff;stop-opacity:1" />
</linearGradient>
<linearGradient
id="linearGradient3807">
<stop
id="stop3809"
offset="0"
style="stop-color:#d3d7cf;stop-opacity:1;" />
<stop
id="stop3811"
offset="1"
style="stop-color:#ffffff;stop-opacity:1" />
</linearGradient>
<linearGradient
id="linearGradient3799">
<stop
id="stop3801"
offset="0"
style="stop-color:#d3d7cf;stop-opacity:1;" />
<stop
id="stop3803"
offset="1"
style="stop-color:#ffffff;stop-opacity:1" />
</linearGradient>
<linearGradient
gradientTransform="translate(-0.02151317,-0.91811256)"
gradientUnits="userSpaceOnUse"
y2="-1.3815211"
x2="25.928942"
y1="19.086002"
x1="53.257175"
id="linearGradient3805"
xlink:href="#linearGradient3799" />
<linearGradient
gradientTransform="translate(0.75600263,0.0412295)"
gradientUnits="userSpaceOnUse"
y2="12.022611"
x2="36.843666"
y1="27.953379"
x1="61.719494"
id="linearGradient3813"
xlink:href="#linearGradient3807" />
<linearGradient
gradientTransform="translate(-0.18895427,-1.1237431)"
gradientUnits="userSpaceOnUse"
y2="23.542751"
x2="48.388607"
y1="43.419685"
x1="74.313408"
id="linearGradient3821"
xlink:href="#linearGradient3815" />
<radialGradient
cx="605.71429"
cy="486.64789"
r="117.14286"
fx="605.71429"
fy="486.64789"
id="radialGradient5031"
xlink:href="#linearGradient5060"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(-2.774389,0,0,1.969706,112.7623,-872.8854)" />
<linearGradient
id="linearGradient5060">
<stop
id="stop5062"
style="stop-color:#000000;stop-opacity:1"
offset="0" />
<stop
id="stop5064"
style="stop-color:#000000;stop-opacity:0"
offset="1" />
</linearGradient>
<radialGradient
cx="605.71429"
cy="486.64789"
r="117.14286"
fx="605.71429"
fy="486.64789"
id="radialGradient5029"
xlink:href="#linearGradient5060"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(2.774389,0,0,1.969706,-1891.633,-872.8854)" />
<linearGradient
id="linearGradient5048">
<stop
id="stop5050"
style="stop-color:#000000;stop-opacity:0"
offset="0" />
<stop
id="stop5056"
style="stop-color:#000000;stop-opacity:1"
offset="0.5" />
<stop
id="stop5052"
style="stop-color:#000000;stop-opacity:0"
offset="1" />
</linearGradient>
<linearGradient
x1="302.85715"
y1="366.64789"
x2="302.85715"
y2="609.50507"
id="linearGradient5027"
xlink:href="#linearGradient5048"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(2.774389,0,0,1.969706,-1892.179,-872.8854)" />
<radialGradient
cx="24.306795"
cy="42.07798"
r="15.821514"
fx="24.306795"
fy="42.07798"
id="radialGradient4548"
xlink:href="#linearGradient5060"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1,0,0,0.284916,0,30.08928)" />
<linearGradient
id="linearGradient15662">
<stop
id="stop15664"
style="stop-color:#ffffff;stop-opacity:1"
offset="0" />
<stop
id="stop15666"
style="stop-color:#f8f8f8;stop-opacity:1"
offset="1" />
</linearGradient>
<radialGradient
cx="20.892099"
cy="64.567902"
r="5.257"
fx="20.892099"
fy="64.567902"
id="aigrd3"
gradientUnits="userSpaceOnUse">
<stop
id="stop15573"
style="stop-color:#f0f0f0;stop-opacity:1"
offset="0" />
<stop
id="stop15575"
style="stop-color:#9a9a9a;stop-opacity:1"
offset="1" />
</radialGradient>
<radialGradient
cx="20.892099"
cy="114.5684"
r="5.256"
fx="20.892099"
fy="114.5684"
id="aigrd2"
gradientUnits="userSpaceOnUse">
<stop
id="stop15566"
style="stop-color:#f0f0f0;stop-opacity:1"
offset="0" />
<stop
id="stop15568"
style="stop-color:#9a9a9a;stop-opacity:1"
offset="1" />
</radialGradient>
<linearGradient
id="linearGradient269">
<stop
id="stop270"
style="stop-color:#a3a3a3;stop-opacity:1"
offset="0" />
<stop
id="stop271"
style="stop-color:#4c4c4c;stop-opacity:1"
offset="1" />
</linearGradient>
<linearGradient
id="linearGradient259">
<stop
id="stop260"
style="stop-color:#fafafa;stop-opacity:1"
offset="0" />
<stop
id="stop261"
style="stop-color:#bbbbbb;stop-opacity:1"
offset="1" />
</linearGradient>
<linearGradient
id="linearGradient12512">
<stop
id="stop12513"
style="stop-color:#ffffff;stop-opacity:1"
offset="0" />
<stop
id="stop12517"
style="stop-color:#fff520;stop-opacity:0.89108908"
offset="0.5" />
<stop
id="stop12514"
style="stop-color:#fff300;stop-opacity:0"
offset="1" />
</linearGradient>
<radialGradient
cx="55"
cy="125"
r="14.375"
fx="55"
fy="125"
id="radialGradient278"
xlink:href="#linearGradient12512"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.0434782,0,0,1.0434782,-9.2189114,-105.70069)" />
<radialGradient
cx="8.824419"
cy="3.7561285"
r="37.751713"
fx="8.824419"
fy="3.7561285"
id="radialGradient15656"
xlink:href="#linearGradient269"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.968273,0,0,1.032767,3.4281936,-47.492271)" />
<radialGradient
cx="33.966679"
cy="35.736916"
r="86.70845"
fx="33.966679"
fy="35.736916"
id="radialGradient15658"
xlink:href="#linearGradient259"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.960493,0,0,1.041132,0.07464063,-48.138718)" />
<radialGradient
cx="8.1435566"
cy="7.2678967"
r="38.158695"
fx="8.1435566"
fy="7.2678967"
id="radialGradient15668"
xlink:href="#linearGradient15662"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.968273,0,0,1.032767,3.4281936,-47.492271)" />
<radialGradient
cx="20.892099"
cy="114.5684"
r="5.256"
fx="20.892099"
fy="114.5684"
id="radialGradient2283"
xlink:href="#aigrd2"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.229703,0,0,0.229703,4.613529,3.979808)" />
<radialGradient
cx="20.892099"
cy="64.567902"
r="5.257"
fx="20.892099"
fy="64.567902"
id="radialGradient2285"
xlink:href="#aigrd3"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.229703,0,0,0.229703,4.613529,3.979808)" />
<radialGradient
xlink:href="#linearGradient5060"
id="radialGradient5029-5"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(2.774389,0,0,1.969706,-1891.633,-872.8854)"
cx="605.71429"
cy="486.64789"
fx="605.71429"
fy="486.64789"
r="117.14286" />
<radialGradient
xlink:href="#linearGradient5060"
id="radialGradient5031-1"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(-2.774389,0,0,1.969706,112.7623,-872.8854)"
cx="605.71429"
cy="486.64789"
fx="605.71429"
fy="486.64789"
r="117.14286" />
<radialGradient
r="86.70845"
fy="35.736916"
fx="33.966679"
cy="35.736916"
cx="33.966679"
gradientTransform="matrix(0.93681254,0,0,1.0682567,-0.92539285,-48.545272)"
gradientUnits="userSpaceOnUse"
id="radialGradient15658-2"
xlink:href="#linearGradient259" />
<radialGradient
r="37.751713"
fy="40.640011"
fx="4.4163604"
cy="40.640011"
cx="4.4163604"
gradientTransform="matrix(0.94440073,0,0,1.0596738,2.3454801,-47.881983)"
gradientUnits="userSpaceOnUse"
id="radialGradient15656-3"
xlink:href="#linearGradient269" />
<radialGradient
r="38.158695"
fy="7.2678967"
fx="8.1435566"
cy="7.2678967"
cx="8.1435566"
gradientTransform="matrix(0.88587294,0,0,1.0079919,3.5841035,-46.659551)"
gradientUnits="userSpaceOnUse"
id="radialGradient15668-2"
xlink:href="#linearGradient15662" />
<radialGradient
xlink:href="#aigrd2-9"
id="radialGradient2283-7"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.229703,0,0,0.229703,4.613529,3.979808)"
cx="20.892099"
cy="114.5684"
fx="20.892099"
fy="114.5684"
r="5.256" />
<radialGradient
gradientUnits="userSpaceOnUse"
fy="114.5684"
fx="20.892099"
r="5.256"
cy="114.5684"
cx="20.892099"
id="aigrd2-9">
<stop
id="stop15566-2"
style="stop-color:#F0F0F0"
offset="0" />
<stop
id="stop15568-0"
style="stop-color:#9a9a9a;stop-opacity:1.0000000;"
offset="1.0000000" />
</radialGradient>
<radialGradient
xlink:href="#aigrd3-3"
id="radialGradient2285-2"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.229703,0,0,0.229703,4.613529,3.979808)"
cx="20.892099"
cy="64.567902"
fx="20.892099"
fy="64.567902"
r="5.257" />
<radialGradient
gradientUnits="userSpaceOnUse"
fy="64.567902"
fx="20.892099"
r="5.257"
cy="64.567902"
cx="20.892099"
id="aigrd3-3">
<stop
id="stop15573-7"
style="stop-color:#F0F0F0"
offset="0" />
<stop
id="stop15575-5"
style="stop-color:#9a9a9a;stop-opacity:1.0000000;"
offset="1.0000000" />
</radialGradient>
<radialGradient
r="117.14286"
fy="486.64789"
fx="605.71429"
cy="486.64789"
cx="605.71429"
gradientTransform="matrix(-2.774389,0,0,1.969706,112.7623,-872.8854)"
gradientUnits="userSpaceOnUse"
id="radialGradient3115"
xlink:href="#linearGradient5060" />
<radialGradient
xlink:href="#linearGradient5060"
id="radialGradient5029-7"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(2.774389,0,0,1.969706,-1891.633,-872.8854)"
cx="605.71429"
cy="486.64789"
fx="605.71429"
fy="486.64789"
r="117.14286" />
<radialGradient
xlink:href="#linearGradient5060"
id="radialGradient5031-2"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(-2.774389,0,0,1.969706,112.7623,-872.8854)"
cx="605.71429"
cy="486.64789"
fx="605.71429"
fy="486.64789"
r="117.14286" />
<radialGradient
r="86.70845"
fy="35.736916"
fx="33.966679"
cy="35.736916"
cx="33.966679"
gradientTransform="matrix(0.93681254,0,0,1.0682567,0.57527068,-48.738688)"
gradientUnits="userSpaceOnUse"
id="radialGradient15658-9"
xlink:href="#linearGradient259" />
<radialGradient
r="37.751713"
fy="40.640011"
fx="4.4163604"
cy="40.640011"
cx="4.4163604"
gradientTransform="matrix(0.94440073,0,0,1.0596738,3.8461434,-48.075399)"
gradientUnits="userSpaceOnUse"
id="radialGradient15656-7"
xlink:href="#linearGradient269" />
<radialGradient
r="38.158695"
fy="7.2678967"
fx="8.1435566"
cy="7.2678967"
cx="8.1435566"
gradientTransform="matrix(0.88587294,0,0,1.0079919,5.084766,-46.852959)"
gradientUnits="userSpaceOnUse"
id="radialGradient15668-0"
xlink:href="#linearGradient15662" />
<radialGradient
xlink:href="#aigrd2-6"
id="radialGradient2283-0"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.229703,0,0,0.229703,4.613529,3.979808)"
cx="20.892099"
cy="114.5684"
fx="20.892099"
fy="114.5684"
r="5.256" />
<radialGradient
gradientUnits="userSpaceOnUse"
fy="114.5684"
fx="20.892099"
r="5.256"
cy="114.5684"
cx="20.892099"
id="aigrd2-6">
<stop
id="stop15566-3"
style="stop-color:#F0F0F0"
offset="0" />
<stop
id="stop15568-2"
style="stop-color:#9a9a9a;stop-opacity:1.0000000;"
offset="1.0000000" />
</radialGradient>
<radialGradient
xlink:href="#aigrd3-6"
id="radialGradient2285-0"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.229703,0,0,0.229703,4.613529,3.979808)"
cx="20.892099"
cy="64.567902"
fx="20.892099"
fy="64.567902"
r="5.257" />
<radialGradient
gradientUnits="userSpaceOnUse"
fy="64.567902"
fx="20.892099"
r="5.257"
cy="64.567902"
cx="20.892099"
id="aigrd3-6">
<stop
id="stop15573-1"
style="stop-color:#F0F0F0"
offset="0" />
<stop
id="stop15575-55"
style="stop-color:#9a9a9a;stop-opacity:1.0000000;"
offset="1.0000000" />
</radialGradient>
<radialGradient
r="117.14286"
fy="486.64789"
fx="605.71429"
cy="486.64789"
cx="605.71429"
gradientTransform="matrix(-2.774389,0,0,1.969706,112.7623,-872.8854)"
gradientUnits="userSpaceOnUse"
id="radialGradient3187"
xlink:href="#linearGradient5060" />
<radialGradient
xlink:href="#linearGradient5060"
id="radialGradient5029-4"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(2.774389,0,0,1.969706,-1891.633,-872.8854)"
cx="605.71429"
cy="486.64789"
fx="605.71429"
fy="486.64789"
r="117.14286" />
<radialGradient
r="117.14286"
fy="486.64789"
fx="605.71429"
cy="486.64789"
cx="605.71429"
gradientTransform="matrix(-2.774389,0,0,1.969706,112.7623,-872.8854)"
gradientUnits="userSpaceOnUse"
id="radialGradient3255"
xlink:href="#linearGradient5060" />
<radialGradient
r="86.70845"
fy="35.736916"
fx="33.966679"
cy="35.736916"
cx="33.966679"
gradientTransform="matrix(1.3225497,0,0,1.4752117,-18.091662,-66.151727)"
gradientUnits="userSpaceOnUse"
id="radialGradient15658-8"
xlink:href="#linearGradient259" />
<radialGradient
r="37.751713"
fy="37.388847"
fx="3.3431637"
cy="37.388847"
cx="3.3431637"
gradientTransform="matrix(1.3332625,0,0,1.4633592,-13.473991,-65.235756)"
gradientUnits="userSpaceOnUse"
id="radialGradient15656-8"
xlink:href="#linearGradient269" />
<radialGradient
r="38.158695"
fy="7.2678967"
fx="8.1435566"
cy="7.2678967"
cx="8.1435566"
gradientTransform="matrix(1.3004371,0,0,1.4315028,-12.790081,-64.443402)"
gradientUnits="userSpaceOnUse"
id="radialGradient15668-4"
xlink:href="#linearGradient15662" />
<radialGradient
xlink:href="#aigrd2-7"
id="radialGradient2283-5"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.229703,0,0,0.229703,4.613529,3.979808)"
cx="20.892099"
cy="114.5684"
fx="20.892099"
fy="114.5684"
r="5.256" />
<radialGradient
gradientUnits="userSpaceOnUse"
fy="114.5684"
fx="20.892099"
r="5.256"
cy="114.5684"
cx="20.892099"
id="aigrd2-7">
<stop
id="stop15566-4"
style="stop-color:#F0F0F0"
offset="0" />
<stop
id="stop15568-27"
style="stop-color:#9a9a9a;stop-opacity:1.0000000;"
offset="1.0000000" />
</radialGradient>
<radialGradient
xlink:href="#aigrd3-7"
id="radialGradient2285-1"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.229703,0,0,0.229703,4.613529,3.979808)"
cx="20.892099"
cy="64.567902"
fx="20.892099"
fy="64.567902"
r="5.257" />
<radialGradient
gradientUnits="userSpaceOnUse"
fy="64.567902"
fx="20.892099"
r="5.257"
cy="64.567902"
cx="20.892099"
id="aigrd3-7">
<stop
id="stop15573-9"
style="stop-color:#F0F0F0"
offset="0" />
<stop
id="stop15575-3"
style="stop-color:#9a9a9a;stop-opacity:1.0000000;"
offset="1.0000000" />
</radialGradient>
<radialGradient
r="117.14286"
fy="486.64789"
fx="605.71429"
cy="486.64789"
cx="605.71429"
gradientTransform="matrix(-2.774389,0,0,1.969706,112.7623,-872.8854)"
gradientUnits="userSpaceOnUse"
id="radialGradient3172"
xlink:href="#linearGradient5060" />
<linearGradient
xlink:href="#linearGradient4200"
id="linearGradient4206"
x1="23.269085"
y1="34.403625"
x2="19.161451"
y2="22.080725"
gradientUnits="userSpaceOnUse" />
<linearGradient
id="linearGradient4200">
<stop
style="stop-color:#888a85;stop-opacity:1"
offset="0"
id="stop4202" />
<stop
style="stop-color:#d3d7cf;stop-opacity:1"
offset="1"
id="stop4204" />
</linearGradient>
<linearGradient
xlink:href="#linearGradient3815"
id="linearGradient3781"
x1="10"
y1="39.999996"
x2="53"
y2="25.999996"
gradientUnits="userSpaceOnUse"
gradientTransform="translate(-48.000004,-1.4697266e-8)" />
</defs>
<g
id="layer1">
<rect
transform="matrix(0.92408158,0.38219528,-0.75246174,0.65863596,0,0)"
y="6.2172832"
x="31.989382"
height="27.016869"
width="39.045357"
id="rect2993-0"
style="color:#000000;fill:url(#linearGradient3813);fill-opacity:1;fill-rule:evenodd;stroke:#2e3436;stroke-width:2.1126256;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
<path
id="rect2993-0-9-3-6"
d="M 25.30824,18.773895 57.151731,31.961211 40.212355,46.74742 8.2994962,33.560104 z"
style="color:#000000;fill:none;stroke:#ffffff;stroke-width:2;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
</g>
<metadata
id="metadata5826">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title>Draft_Layer</dc:title>
<cc:license
rdf:resource="" />
<dc:date>Tue Jun 10 10:21:01 2014 -0300</dc:date>
<dc:creator>
<cc:Agent>
<dc:title>[Yorik van Havre]</dc:title>
</cc:Agent>
</dc:creator>
<dc:rights>
<cc:Agent>
<dc:title>FreeCAD LGPL2+</dc:title>
</cc:Agent>
</dc:rights>
<dc:publisher>
<cc:Agent>
<dc:title>FreeCAD</dc:title>
</cc:Agent>
</dc:publisher>
<dc:identifier>FreeCAD/src/Mod/Draft/Resources/icons/Draft_Layer.svg</dc:identifier>
<dc:relation>http://www.freecadweb.org/wiki/index.php?title=Artwork</dc:relation>
<dc:contributor>
<cc:Agent>
<dc:title>[agryson] Alexander Gryson</dc:title>
</cc:Agent>
</dc:contributor>
<dc:subject>
<rdf:Bag>
<rdf:li>page</rdf:li>
<rdf:li>pages</rdf:li>
<rdf:li>rectangles</rdf:li>
<rdf:li>stack</rdf:li>
</rdf:Bag>
</dc:subject>
<dc:description>Three pages or rectangles stacked on top of each other. Previously VisGroup.</dc:description>
</cc:Work>
</rdf:RDF>
</metadata>
<path
d="m 63.172393,24.734089 a 15,15 0 0 1 -30,0 15,15 0 1 1 30,0 z"
id="path12511"
style="color:#000000;display:block;visibility:visible;fill:url(#radialGradient278);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1.25;marker:none" />
</svg>

After

Width:  |  Height:  |  Size: 21 KiB

View File

@@ -478,7 +478,12 @@ def get_svg(obj,
else:
stroke = utils.get_rgb(color)
elif App.GuiUp:
if hasattr(obj, "ViewObject"):
# find print color
pc = get_print_color(obj)
if pc:
stroke = utils.get_rgb(pc)
# get line color
elif hasattr(obj, "ViewObject"):
if hasattr(obj.ViewObject, "LineColor"):
stroke = utils.get_rgb(obj.ViewObject.LineColor)
elif hasattr(obj.ViewObject, "TextColor"):
@@ -918,6 +923,17 @@ def get_svg(obj,
return svg
def get_print_color(obj):
"""returns the print color of the parent layer, if available"""
for parent in obj.InListRecursive:
if (hasattr(parent,"ViewObject")
and hasattr(parent.ViewObject,"UsePrintColor")
and parent.ViewObject.UsePrintColor):
if hasattr(parent.ViewObject,"LinePrintColor"):
return parent.ViewObject.LinePrintColor
return None
def getSVG(obj,
scale=1, linewidth=0.35, fontsize=12,
fillstyle="shape color", direction=None,

View File

@@ -73,7 +73,7 @@ class AddToGroup(gui_base.GuiCommandNeedsSelection):
d = {'Pixmap': 'Draft_AddToGroup',
'MenuText': QT_TRANSLATE_NOOP("Draft_AddToGroup",
"Move to group"),
"Move to group")+"...",
'ToolTip': QT_TRANSLATE_NOOP("Draft_AddToGroup",
_tooltip)}
return d

View File

@@ -125,18 +125,25 @@ class Draft_SetStyle_TaskPanel:
if "DrawStyle" in vobj.PropertiesList:
vobj.DrawStyle = ["Solid","Dashed","Dotted","Dashdot"][self.form.DrawStyle.currentIndex()]
if "DisplayMode" in vobj.PropertiesList:
try:
vobj.DisplayMode = ["Flat Lines","Wireframe","Shaded","points"][self.form.DisplayMode.currentIndex()]
except:
pass
dmodes = ["Flat Lines","Wireframe","Shaded","Points"]
dm = dmodes[self.form.DisplayMode.currentIndex()]
if hasattr(vobj,"Proxy") and hasattr(vobj.Proxy,"getDisplayModes"):
dmodes = vobj.Proxy.getDisplayModes(vobj)
if dm in dmodes:
try:
vobj.DisplayMode = dm
except:
pass
if "ShapeColor" in vobj.PropertiesList:
vobj.ShapeColor = self.form.ShapeColor.property("color").rgb()<<8
if "Transparency" in vobj.PropertiesList:
vobj.Transparency = self.form.Transparency.value()
if "FontName" in vobj.PropertiesList:
vobj.TextFont = self.form.TextFont.currentFont().family()
vobj.FontName = self.form.TextFont.currentFont().family()
if "TextSize" in vobj.PropertiesList:
vobj.TextSize = FreeCAD.Units.Quantity(self.form.TextSize.text()).Value
if "FontSize" in vobj.PropertiesList:
vobj.FontSize = FreeCAD.Units.Quantity(self.form.TextSize.text()).Value
if "TextColor" in vobj.PropertiesList:
vobj.TextColor = self.form.TextColor.property("color").rgb()<<8
if "ArrowType" in vobj.PropertiesList:

View File

@@ -80,6 +80,17 @@ class ViewProviderLayer:
_tip)
vobj.OverrideShapeColorChildren = True
if "UsePrintColor" not in properties:
_tip = QT_TRANSLATE_NOOP("App::Property",
"If it is true, the print color "
"will be used when objects in this "
"layer are placed on a TechDraw page")
vobj.addProperty("App::PropertyBool",
"UsePrintColor",
"Print",
_tip)
def set_visual_properties(self, vobj, properties):
"""Set visual properties only if they don't already exist."""
view_group = App.ParamGet("User parameter:BaseApp/Preferences/View")
@@ -145,6 +156,16 @@ class ViewProviderLayer:
_tip)
vobj.Transparency = 0
if "LinePrintColor" not in properties:
_tip = QT_TRANSLATE_NOOP("App::Property",
"The line color of the objects "
"contained within this layer, "
"when used on a TechDraw page")
vobj.addProperty("App::PropertyColor",
"LinePrintColor",
"Print",
_tip)
def getIcon(self):
"""Return the path to the icon used by the viewprovider.
@@ -382,6 +403,11 @@ class ViewProviderLayerContainer:
menu)
action1.triggered.connect(self.merge_by_name)
menu.addAction(action1)
action2 = QtGui.QAction(QtGui.QIcon(":/icons/Draft_NewLayer.svg"),
translate("Draft", "Add new layer"),
menu)
action2.triggered.connect(self.add_layer)
menu.addAction(action2)
def merge_by_name(self):
"""Merge the layers that have the same name."""
@@ -442,6 +468,12 @@ class ViewProviderLayerContainer:
_msg("InList not empty. "
"Unable to delete layer: " + layer.Label)
def add_layer(self):
"""Creates a new layer"""
import Draft
Draft.make_layer()
App.ActiveDocument.recompute()
def __getstate__(self):
"""Return a tuple of objects to save or None."""
return None

View File

@@ -204,6 +204,7 @@ SET(PathTests_SRCS
PathTests/TestPathToolController.py
PathTests/TestPathTooltable.py
PathTests/TestPathUtil.py
PathTests/TestPathVcarve.py
PathTests/TestPathVoronoi.py
PathTests/boxtest.fcstd
PathTests/test_centroid_00.ngc

View File

@@ -222,7 +222,7 @@ def speedBetweenPoints(p0, p1, hSpeed, vSpeed):
pitch = pitch + 1
while pitch > 1:
pitch = pitch - 1
print(" pitch = %g %g (%.2f, %.2f, %.2f) -> %.2f" % (pitch, math.atan2(xy(d).Length, d.z), d.x, d.y, d.z, xy(d).Length))
PathLog.debug(" pitch = %g %g (%.2f, %.2f, %.2f) -> %.2f" % (pitch, math.atan2(xy(d).Length, d.z), d.x, d.y, d.z, xy(d).Length))
speed = vSpeed + pitch * (hSpeed - vSpeed)
if speed > hSpeed and speed > vSpeed:
return max(hSpeed, vSpeed)

View File

@@ -524,6 +524,10 @@ class ObjectOp(object):
result = self.opExecute(obj) # pylint: disable=assignment-from-no-return
if self.commandlist and (FeatureHeights & self.opFeatures(obj)):
# Let's finish by rapid to clearance...just for safety
self.commandlist.append(Path.Command("G0", {"Z": obj.ClearanceHeight.Value}))
path = Path.Path(self.commandlist)
obj.Path = path
obj.CycleTime = self.getCycleTimeEstimate(obj)

View File

@@ -203,7 +203,7 @@ class TaskPanelOpPage(PathCircularHoleBaseGui.TaskPanelOpPage):
Command = PathOpGui.SetupOperation('Thread Milling',
PathThreadMilling.Create,
TaskPanelOpPage,
'Path-ThreadMilling',
'Path_ThreadMilling',
QtCore.QT_TRANSLATE_NOOP("PathThreadMilling", "Thread Milling"),
QtCore.QT_TRANSLATE_NOOP("PathThreadMilling", "Creates a Path Thread Milling operation from features of a base object"),
PathThreadMilling.SetupProperties)

View File

@@ -334,7 +334,7 @@ class ToolBitSelector(object):
tools = self.selectedOrAllTools()
for tool in tools:
tc = PathToolControllerGui.Create(tool[1].Label, tool[1], tool[0])
tc = PathToolControllerGui.Create("TC: {}".format(tool[1].Label), tool[1], tool[0])
job.Proxy.addToolController(tc)
FreeCAD.ActiveDocument.recompute()

View File

@@ -225,13 +225,13 @@ class ToolController:
obj.addProperty("App::PropertyLink", "Tool", "Base", QtCore.QT_TRANSLATE_NOOP("PathToolController", "The tool used by this controller"))
def Create(name='Default Tool', tool=None, toolNumber=1, assignViewProvider=True):
def Create(name='TC: Default Tool', tool=None, toolNumber=1, assignViewProvider=True):
legacyTool = PathPreferences.toolsReallyUseLegacyTools() if tool is None else isinstance(tool, Path.Tool)
PathLog.track(tool, toolNumber, legacyTool)
obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython", name)
obj.Label = "TC: {}".format(name)
obj.Label = name
obj.Proxy = ToolController(obj, legacyTool)
if FreeCAD.GuiUp and assignViewProvider:

View File

@@ -157,6 +157,45 @@ def _sortVoronoiWires(wires, start=FreeCAD.Vector(0, 0, 0)):
return result
class _Geometry(object):
'''POD class so the limits only have to be calculated once.'''
def __init__(self, zStart, zStop, zScale):
self.start = zStart
self.stop = zStop
self.scale = zScale
@classmethod
def FromTool(cls, tool, zStart, zFinal):
rMax = float(tool.Diameter) / 2.0
rMin = float(tool.TipDiameter) / 2.0
toolangle = math.tan(math.radians(tool.CuttingEdgeAngle.Value / 2.0))
zScale = 1.0 / toolangle
zStop = zStart - rMax * zScale
zOff = rMin * zScale
return _Geometry(zStart + zOff, max(zStop + zOff, zFinal), zScale)
@classmethod
def FromObj(cls, obj, model):
zStart = model.Shape.BoundBox.ZMax
finalDepth = obj.FinalDepth.Value
return cls.FromTool(obj.ToolController.Tool, zStart, finalDepth)
def _calculate_depth(MIC, geom):
# given a maximum inscribed circle (MIC) and tool angle,
# return depth of cut relative to zStart.
depth = geom.start - round(MIC / geom.scale, 4)
PathLog.debug('zStart value: {} depth: {}'.format(geom.start, depth))
return max(depth, geom.stop)
def _getPartEdge(edge, depths):
dist = edge.getDistances()
zBegin = _calculate_depth(dist[0], depths)
zEnd = _calculate_depth(dist[1], depths)
return edge.toShape(zBegin, zEnd)
class ObjectVcarve(PathEngraveBase.ObjectOp):
'''Proxy class for Vcarve operation.'''
@@ -197,42 +236,10 @@ class ObjectVcarve(PathEngraveBase.ObjectOp):
# upgrade ...
self.setupAdditionalProperties(obj)
def _calculate_depth(self, MIC, zStart, zStop, zScale, finaldepth):
# given a maximum inscribed circle (MIC) and tool angle,
# return depth of cut relative to zStart.
depth = zStart - round(MIC / zScale, 4)
PathLog.debug('zStart value: {} depth: {}'.format(zStart, depth))
# Never go below the operation final depth.
zStop = zStop if zStop > finaldepth else finaldepth
return depth if depth > zStop else zStop
def _getPartEdge(self, edge, zStart, zStop, zScale, finaldepth):
dist = edge.getDistances()
return edge.toShape(self._calculate_depth(dist[0],
zStart,
zStop,
zScale,
finaldepth),
self._calculate_depth(dist[1],
zStart,
zStop,
zScale,
finaldepth))
def _getPartEdges(self, obj, vWire):
# pre-calculate the depth limits - pre-mature optimisation ;)
r = float(obj.ToolController.Tool.Diameter) / 2
toolangle = obj.ToolController.Tool.CuttingEdgeAngle
zStart = self.model[0].Shape.BoundBox.ZMin
zStop = zStart - r / math.tan(math.radians(toolangle/2))
zScale = 1.0 / math.tan(math.radians(toolangle / 2))
finaldepth = obj.FinalDepth.Value
def _getPartEdges(self, obj, vWire, geom):
edges = []
for e in vWire:
edges.append(self._getPartEdge(e, zStart, zStop, zScale, finaldepth))
edges.append(_getPartEdge(e, geom))
return edges
def buildPathMedial(self, obj, Faces):
@@ -253,14 +260,12 @@ class ObjectVcarve(PathEngraveBase.ObjectOp):
path.append(Path.Command("G0 Z{}".format(obj.SafeHeight.Value)))
e = edges[0]
p = e.valueAt(e.FirstParameter)
path.append(Path.Command("G0 X{} Y{} Z{}".format(p.x, p.y,
obj.SafeHeight.Value)))
c = Path.Command("G1 X{} Y{} Z{} F{}".format(p.x, p.y, p.z,
obj.ToolController.HorizFeed.Value))
path.append(c)
path.append(Path.Command("G0 X{} Y{} Z{}".format(p.x, p.y, obj.SafeHeight.Value)))
hSpeed = obj.ToolController.HorizFeed.Value
vSpeed = obj.ToolController.VertFeed.Value
path.append(Path.Command("G1 X{} Y{} Z{} F{}".format(p.x, p.y, p.z, vSpeed)))
for e in edges:
path.extend(PathGeom.cmdsForEdge(e,
hSpeed=obj.ToolController.HorizFeed.Value))
path.extend(PathGeom.cmdsForEdge(e, hSpeed=hSpeed, vSpeed=vSpeed))
return path
@@ -290,10 +295,12 @@ class ObjectVcarve(PathEngraveBase.ObjectOp):
if _sorting == 'global':
voronoiWires = _sortVoronoiWires(voronoiWires)
geom = _Geometry.FromObj(obj, self.model[0])
pathlist = []
pathlist.append(Path.Command("(starting)"))
for w in voronoiWires:
pWire = self._getPartEdges(obj, w)
pWire = self._getPartEdges(obj, w, geom)
if pWire:
wires.append(pWire)
pathlist.extend(cutWire(pWire))
@@ -355,6 +362,9 @@ operation will produce no output.'))
else:
obj.OpFinalDepth = -0.1
def isToolSupported(self, obj, tool):
'''isToolSupported(obj, tool) ... returns True if v-carve op can work with tool.'''
return hasattr(tool, 'Diameter') and hasattr(tool, 'CuttingEdgeAngle') and hasattr(tool, 'TipDiameter')
def SetupProperties():
return ["Discretize"]

View File

@@ -0,0 +1,114 @@
# -*- coding: utf-8 -*-
# ***************************************************************************
# * *
# * Copyright (c) 2020 sliptonic <shopinthewoods@gmail.com> *
# * *
# * This program is free software; you can redistribute it and/or modify *
# * it under the terms of the GNU Lesser General Public License (LGPL) *
# * as published by the Free Software Foundation; either version 2 of *
# * the License, or (at your option) any later version. *
# * for detail see the LICENCE text file. *
# * *
# * This program is distributed in the hope that it will be useful, *
# * but WITHOUT ANY WARRANTY; without even the implied warranty of *
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
# * GNU Library General Public License for more details. *
# * *
# * You should have received a copy of the GNU Library General Public *
# * License along with this program; if not, write to the Free Software *
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
# * USA *
# * *
# ***************************************************************************
import FreeCAD
import PathScripts.PathGeom as PathGeom
import PathScripts.PathToolBit as PathToolBit
import PathScripts.PathVcarve as PathVcarve
import math
from PathTests.PathTestUtils import PathTestBase
class VbitTool(object):
'''Faked out vcarve tool'''
def __init__(self, dia, angle, tipDia):
self.Diameter = FreeCAD.Units.Quantity(dia, FreeCAD.Units.Length)
self.CuttingEdgeAngle = FreeCAD.Units.Quantity(angle, FreeCAD.Units.Angle)
self.TipDiameter = FreeCAD.Units.Quantity(tipDia, FreeCAD.Units.Length)
Scale45 = 2.414214
Scale60 = math.sqrt(3)
class TestPathVcarve(PathTestBase):
'''Test Vcarve milling basics.'''
def test00(self):
'''Verify 90 deg depth calculation'''
tool = VbitTool(10, 90, 0)
geom = PathVcarve._Geometry.FromTool(tool, 0, -10)
self.assertRoughly(geom.start, 0)
self.assertRoughly(geom.stop, -5)
self.assertRoughly(geom.scale, 1)
def test01(self):
'''Verify 90 deg depth limit'''
tool = VbitTool(10, 90, 0)
geom = PathVcarve._Geometry.FromTool(tool, 0, -3)
self.assertRoughly(geom.start, 0)
self.assertRoughly(geom.stop, -3)
self.assertRoughly(geom.scale, 1)
def test02(self):
'''Verify 60 deg depth calculation'''
tool = VbitTool(10, 60, 0)
geom = PathVcarve._Geometry.FromTool(tool, 0, -10)
self.assertRoughly(geom.start, 0)
self.assertRoughly(geom.stop, -5 * Scale60)
self.assertRoughly(geom.scale, Scale60)
def test03(self):
'''Verify 60 deg depth limit'''
tool = VbitTool(10, 60, 0)
geom = PathVcarve._Geometry.FromTool(tool, 0, -3)
self.assertRoughly(geom.start, 0)
self.assertRoughly(geom.stop, -3)
self.assertRoughly(geom.scale, Scale60)
def test10(self):
'''Verify 90 deg with tip dia depth calculation'''
tool = VbitTool(10, 90, 2)
geom = PathVcarve._Geometry.FromTool(tool, 0, -10)
# in order for the width to be correct the height needs to be shifted
self.assertRoughly(geom.start, 1)
self.assertRoughly(geom.stop, -4)
self.assertRoughly(geom.scale, 1)
def test11(self):
'''Verify 90 deg with tip dia depth limit calculation'''
tool = VbitTool(10, 90, 2)
geom = PathVcarve._Geometry.FromTool(tool, 0, -3)
# in order for the width to be correct the height needs to be shifted
self.assertRoughly(geom.start, 1)
self.assertRoughly(geom.stop, -3)
self.assertRoughly(geom.scale, 1)
def test12(self):
'''Verify 45 deg with tip dia depth calculation'''
tool = VbitTool(10, 45, 2)
geom = PathVcarve._Geometry.FromTool(tool, 0, -10)
# in order for the width to be correct the height needs to be shifted
self.assertRoughly(geom.start, Scale45)
self.assertRoughly(geom.stop, -4 * Scale45)
self.assertRoughly(geom.scale, Scale45)
def test13(self):
'''Verify 45 deg with tip dia depth limit calculation'''
tool = VbitTool(10, 45, 2)
geom = PathVcarve._Geometry.FromTool(tool, 0, -3)
# in order for the width to be correct the height needs to be shifted
self.assertRoughly(geom.start, Scale45)
self.assertRoughly(geom.stop, -3)
self.assertRoughly(geom.scale, Scale45)

View File

@@ -42,6 +42,7 @@ from PathTests.TestPathDeburr import TestPathDeburr
from PathTests.TestPathHelix import TestPathHelix
from PathTests.TestPathVoronoi import TestPathVoronoi
from PathTests.TestPathThreadMilling import TestPathThreadMilling
from PathTests.TestPathVcarve import TestPathVcarve
# dummy usage to get flake8 and lgtm quiet
False if TestApp.__name__ else True
@@ -64,4 +65,5 @@ False if TestPathPreferences.__name__ else True
False if TestPathToolBit.__name__ else True
False if TestPathVoronoi.__name__ else True
False if TestPathThreadMilling.__name__ else True
False if TestPathVcarve.__name__ else True

View File

@@ -5,10 +5,10 @@
"parameter": {
"CuttingEdgeAngle": "60.0000 \u00b0",
"Diameter": "10.0000 mm",
"FlatHeight": "1.0000 mm",
"FlatRadius": "0.5000 mm",
"CuttingEdgeHeight": "1.0000 mm",
"TipDiameter": "1.0000 mm",
"Length": "20.0000 mm",
"ShankDiameter": "5.0000 mm"
},
"attribute": {}
}
}

Binary file not shown.