Release of 2016-09-10 :

Bug Fix:
Correction of home directory path by default
(for txt file selection widget) on "Save" and "Load Points" functions
 not handled previpusly for Window version.

Modification:
For "Point tab" changes for allowing more complex multi objects
selections, same improvements ongoing for other tabs for next release.

Addition:

into "Circle" TAB :
	Arc=(3 Points):
	Create one Arc depending on 3 points.
		- First select 3 Points
		- Then Click on the button

into "Wire 1/3" TAB :
	Bezier Cubic=(4 Points):
	Create a Wire (Bezier Cubic) from 4 selected points.
		- First 4 Points
		- Then push this button

into "Image" TAB (new tab):
	Copy and Scale Image(s) :
	Scale an image along desired direction(s) (make a copy first of
	 the original Image).
        - First define the direction(s) on the right combo
        (default is XY):
        if X is selected then only X direction will be scaled
        if XY is selected then the scale will be squared in X and
        Y directions together
        - Select one or several Images (in combo view)
        - Select one Line (or 2 Points) (close to the Image) you want to
         define new dimension.
        (better to select a Line strictly in X direction if you want to
         enlarge/squize the Image in X direction)
         - Then give the target dimension of the Line (on the last right
          LineEdit).
This commit is contained in:
Rentlau 2016-09-10 21:17:56 +02:00
parent 90094dc57e
commit 414bd24e9c
20 changed files with 11604 additions and 5088 deletions

Binary file not shown.

View File

@ -0,0 +1,318 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<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"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="64px"
height="64px"
id="svg2918"
sodipodi:version="0.32"
inkscape:version="0.91 r13725"
sodipodi:docname="WF_3pointsArc.svg"
inkscape:output_extension="org.inkscape.output.svg.inkscape"
version="1.1">
<defs
id="defs2920">
<linearGradient
id="linearGradient3144">
<stop
style="stop-color:#ffffff;stop-opacity:1;"
offset="0"
id="stop3146" />
<stop
style="stop-color:#ffffff;stop-opacity:0;"
offset="1"
id="stop3148" />
</linearGradient>
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3144"
id="radialGradient3183"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1,0,0,0.6985294,0,202.82863)"
cx="225.26402"
cy="672.79736"
fx="225.26402"
fy="672.79736"
r="34.345188" />
<inkscape:perspective
sodipodi:type="inkscape:persp3d"
inkscape:vp_x="0 : 32 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_z="64 : 32 : 1"
inkscape:persp3d-origin="32 : 21.333333 : 1"
id="perspective2926" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3144-6"
id="radialGradient4272"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1,0,0,0.6985294,0,202.82863)"
cx="225.26402"
cy="672.79736"
fx="225.26402"
fy="672.79736"
r="34.345188" />
<linearGradient
inkscape:collect="always"
id="linearGradient3144-6">
<stop
style="stop-color:#ffffff;stop-opacity:1;"
offset="0"
id="stop3146-2" />
<stop
style="stop-color:#ffffff;stop-opacity:0;"
offset="1"
id="stop3148-5" />
</linearGradient>
<radialGradient
r="34.345188"
fy="672.79736"
fx="225.26402"
cy="672.79736"
cx="225.26402"
gradientTransform="matrix(1,0,0,0.6985294,0,202.82863)"
gradientUnits="userSpaceOnUse"
id="radialGradient4558"
xlink:href="#linearGradient3144-6"
inkscape:collect="always" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4135-3"
id="linearGradient4145-1"
x1="131.82286"
y1="101.22672"
x2="191.3165"
y2="101.22672"
gradientUnits="userSpaceOnUse" />
<linearGradient
inkscape:collect="always"
id="linearGradient4135-3">
<stop
style="stop-color:#0079ff;stop-opacity:1;"
offset="0"
id="stop4137-9" />
<stop
style="stop-color:#0079ff;stop-opacity:0;"
offset="1"
id="stop4139-2" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4135-3-5"
id="linearGradient4145-1-8"
x1="131.82286"
y1="101.22672"
x2="191.3165"
y2="101.22672"
gradientUnits="userSpaceOnUse" />
<linearGradient
inkscape:collect="always"
id="linearGradient4135-3-5">
<stop
style="stop-color:#0079ff;stop-opacity:1;"
offset="0"
id="stop4137-9-3" />
<stop
style="stop-color:#0079ff;stop-opacity:0;"
offset="1"
id="stop4139-2-7" />
</linearGradient>
<radialGradient
r="34.345188"
fy="672.79736"
fx="225.26402"
cy="672.79736"
cx="225.26402"
gradientTransform="matrix(1,0,0,0.6985294,0,202.82863)"
gradientUnits="userSpaceOnUse"
id="radialGradient4558-0"
xlink:href="#linearGradient3144-6-2"
inkscape:collect="always" />
<linearGradient
inkscape:collect="always"
id="linearGradient3144-6-2">
<stop
style="stop-color:#ffffff;stop-opacity:1;"
offset="0"
id="stop3146-2-4" />
<stop
style="stop-color:#ffffff;stop-opacity:0;"
offset="1"
id="stop3148-5-6" />
</linearGradient>
<radialGradient
r="34.345188"
fy="672.79736"
fx="225.26402"
cy="672.79736"
cx="225.26402"
gradientTransform="matrix(1,0,0,0.6985294,0,202.82863)"
gradientUnits="userSpaceOnUse"
id="radialGradient3238"
xlink:href="#linearGradient3144-6-2"
inkscape:collect="always" />
<radialGradient
r="34.345188"
fy="672.79736"
fx="225.26402"
cy="672.79736"
cx="225.26402"
gradientTransform="matrix(1,0,0,0.6985294,0,202.82863)"
gradientUnits="userSpaceOnUse"
id="radialGradient4558-7"
xlink:href="#linearGradient3144-6-9"
inkscape:collect="always" />
<linearGradient
inkscape:collect="always"
id="linearGradient3144-6-9">
<stop
style="stop-color:#ffffff;stop-opacity:1;"
offset="0"
id="stop3146-2-7" />
<stop
style="stop-color:#ffffff;stop-opacity:0;"
offset="1"
id="stop3148-5-7" />
</linearGradient>
<radialGradient
r="34.345188"
fy="672.79736"
fx="225.26402"
cy="672.79736"
cx="225.26402"
gradientTransform="matrix(1,0,0,0.6985294,0,202.82863)"
gradientUnits="userSpaceOnUse"
id="radialGradient3278"
xlink:href="#linearGradient3144-6-9"
inkscape:collect="always" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="7.6104543"
inkscape:cx="36.921981"
inkscape:cy="27.065481"
inkscape:current-layer="layer1"
showgrid="true"
inkscape:document-units="px"
inkscape:grid-bbox="true"
inkscape:window-width="1261"
inkscape:window-height="625"
inkscape:window-x="93"
inkscape:window-y="64"
inkscape:window-maximized="0" />
<metadata
id="metadata2923">
<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></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
id="layer1"
inkscape:label="Layer 1"
inkscape:groupmode="layer">
<path
style="display:inline;overflow:visible;visibility:visible;fill:#fcaf3e;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.780644;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate"
d="m 30.487543,13.472753 3.1e-5,-7e-6 m 0.534691,4.105426 -6.1e-5,1.2e-5 m 25.28735,11.817278 0.09432,0.453216 C 58.098051,38.957842 49.476696,48.247698 37.16084,50.583838 24.844995,52.919977 13.473428,47.422485 11.779256,38.313325 L 6.5063301,39.313522 C 8.6176235,50.665452 22.789499,57.516722 38.137647,54.6054 53.485778,51.694081 64.230153,40.11656 62.118875,28.764626 l -0.119591,-0.56252 z"
id="path4425"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccccsccsccc" />
<g
id="g3177"
transform="matrix(-0.1459885,0.00366916,-0.00366916,-0.1459885,83.957793,125.97476)"
inkscape:export-filename="/home/yorik/Documents/Lab/Draft/icons/circle.png"
inkscape:export-xdpi="7.2934141"
inkscape:export-ydpi="7.2934141" />
<g
id="g3154"
transform="matrix(-0.14037891,0.00375861,-0.00375861,-0.14037891,86.572942,115.75284)"
inkscape:export-filename="/home/yorik/Documents/Lab/Draft/icons/line.png"
inkscape:export-xdpi="7.0721951"
inkscape:export-ydpi="7.0721951">
<circle
id="path2162"
style="fill:#0079ff;fill-opacity:1;stroke:#001833;stroke-width:5.80000019;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
cx="197.14285"
cy="655.2193"
r="48.57143" />
<ellipse
transform="matrix(0.8513023,-0.5246754,0.5246754,0.8513023,-338.69692,214.19328)"
id="path3134"
style="fill:url(#radialGradient4558);fill-opacity:1;stroke:none"
cx="225.26402"
cy="672.79736"
rx="34.345188"
ry="23.991123" />
</g>
<g
id="g3154-5"
transform="matrix(-0.14037891,0.00375861,-0.00375861,-0.14037891,39.466685,131.32352)"
inkscape:export-filename="/home/yorik/Documents/Lab/Draft/icons/line.png"
inkscape:export-xdpi="7.0721951"
inkscape:export-ydpi="7.0721951">
<path
d="m 245.71428,655.2193 a 48.57143,48.57143 0 0 1 -48.57143,48.57143 48.57143,48.57143 0 0 1 -48.57143,-48.57143 48.57143,48.57143 0 0 1 48.57143,-48.57143 48.57143,48.57143 0 0 1 48.57143,48.57143 z"
sodipodi:ry="48.57143"
sodipodi:rx="48.57143"
sodipodi:cy="655.2193"
sodipodi:cx="197.14285"
id="path2162-1"
style="fill:#0079ff;fill-opacity:1;stroke:#001833;stroke-width:5.80000019;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
sodipodi:type="arc" />
<path
transform="matrix(0.8513023,-0.5246754,0.5246754,0.8513023,-338.69692,214.19328)"
d="m 259.60921,672.79736 a 34.345188,23.991123 0 0 1 -34.34519,23.99113 34.345188,23.991123 0 0 1 -34.34519,-23.99113 34.345188,23.991123 0 0 1 34.34519,-23.99112 34.345188,23.991123 0 0 1 34.34519,23.99112 z"
sodipodi:ry="23.991123"
sodipodi:rx="34.345188"
sodipodi:cy="672.79736"
sodipodi:cx="225.26402"
id="path3134-2"
style="fill:url(#radialGradient3238);fill-opacity:1;stroke:none"
sodipodi:type="arc" />
</g>
<g
id="g3154-9"
transform="matrix(-0.14037891,0.00375861,-0.00375861,-0.14037891,80.068729,138.81321)"
inkscape:export-filename="/home/yorik/Documents/Lab/Draft/icons/line.png"
inkscape:export-xdpi="7.0721951"
inkscape:export-ydpi="7.0721951">
<path
d="m 245.71428,655.2193 a 48.57143,48.57143 0 0 1 -48.57143,48.57143 48.57143,48.57143 0 0 1 -48.57143,-48.57143 48.57143,48.57143 0 0 1 48.57143,-48.57143 48.57143,48.57143 0 0 1 48.57143,48.57143 z"
sodipodi:ry="48.57143"
sodipodi:rx="48.57143"
sodipodi:cy="655.2193"
sodipodi:cx="197.14285"
id="path2162-10"
style="fill:#0079ff;fill-opacity:1;stroke:#001833;stroke-width:5.80000019;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
sodipodi:type="arc" />
<path
transform="matrix(0.8513023,-0.5246754,0.5246754,0.8513023,-338.69692,214.19328)"
d="m 259.60921,672.79736 a 34.345188,23.991123 0 0 1 -34.34519,23.99113 34.345188,23.991123 0 0 1 -34.34519,-23.99113 34.345188,23.991123 0 0 1 34.34519,-23.99112 34.345188,23.991123 0 0 1 34.34519,23.99112 z"
sodipodi:ry="23.991123"
sodipodi:rx="34.345188"
sodipodi:cy="672.79736"
sodipodi:cx="225.26402"
id="path3134-28"
style="fill:url(#radialGradient3278);fill-opacity:1;stroke:none"
sodipodi:type="arc" />
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 11 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 138 KiB

View File

@ -0,0 +1,300 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<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"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="64px"
height="64px"
id="svg2985"
version="1.1"
inkscape:version="0.91 r13725"
sodipodi:docname="WF_bezierCubic2nodes.svg">
<defs
id="defs2987">
<linearGradient
id="linearGradient3807">
<stop
style="stop-color:#ffffff;stop-opacity:1;"
offset="0"
id="stop3809" />
<stop
style="stop-color:#000000;stop-opacity:1;"
offset="1"
id="stop3811" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3807-8"
id="linearGradient3813-6"
x1="9.0028849"
y1="5.0141659"
x2="15.296268"
y2="11.065791"
gradientUnits="userSpaceOnUse" />
<linearGradient
id="linearGradient3807-8">
<stop
style="stop-color:#ffffff;stop-opacity:1;"
offset="0"
id="stop3809-3" />
<stop
style="stop-color:#000000;stop-opacity:1;"
offset="1"
id="stop3811-5" />
</linearGradient>
<linearGradient
y2="11.065791"
x2="15.296268"
y1="5.0141659"
x1="9.0028849"
gradientUnits="userSpaceOnUse"
id="linearGradient3830"
xlink:href="#linearGradient3807-8"
inkscape:collect="always" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3807-1"
id="linearGradient3813-65"
x1="9.0028849"
y1="5.0141659"
x2="15.296268"
y2="11.065791"
gradientUnits="userSpaceOnUse" />
<linearGradient
id="linearGradient3807-1">
<stop
style="stop-color:#ffffff;stop-opacity:1;"
offset="0"
id="stop3809-2" />
<stop
style="stop-color:#000000;stop-opacity:1;"
offset="1"
id="stop3811-3" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3807-5"
id="linearGradient3813-66"
x1="9.0028849"
y1="5.0141659"
x2="15.296268"
y2="11.065791"
gradientUnits="userSpaceOnUse" />
<linearGradient
id="linearGradient3807-5">
<stop
style="stop-color:#ffffff;stop-opacity:1;"
offset="0"
id="stop3809-9" />
<stop
style="stop-color:#000000;stop-opacity:1;"
offset="1"
id="stop3811-36" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3807-0"
id="linearGradient3813-4"
x1="9.0028849"
y1="5.0141659"
x2="15.296268"
y2="11.065791"
gradientUnits="userSpaceOnUse" />
<linearGradient
id="linearGradient3807-0">
<stop
style="stop-color:#ffffff;stop-opacity:1;"
offset="0"
id="stop3809-38" />
<stop
style="stop-color:#000000;stop-opacity:1;"
offset="1"
id="stop3811-0" />
</linearGradient>
<radialGradient
r="34.345188"
fy="672.79736"
fx="225.26402"
cy="672.79736"
cx="225.26402"
gradientTransform="matrix(0.08651231,0,0,0.06169858,13.506439,-56.456825)"
gradientUnits="userSpaceOnUse"
id="radialGradient3663-5-7"
xlink:href="#linearGradient3144"
inkscape:collect="always" />
<linearGradient
inkscape:collect="always"
id="linearGradient3144">
<stop
style="stop-color:#ffffff;stop-opacity:1;"
offset="0"
id="stop3146" />
<stop
style="stop-color:#ffffff;stop-opacity:0;"
offset="1"
id="stop3148" />
</linearGradient>
<radialGradient
r="19.467436"
fy="21.168837"
fx="53.269112"
cy="21.168837"
cx="53.269112"
gradientTransform="matrix(-0.2142105,-0.52792669,0.40876882,-0.17611099,-9.0727074,71.348857)"
gradientUnits="userSpaceOnUse"
id="radialGradient3699-9-1"
xlink:href="#linearGradient5238"
inkscape:collect="always" />
<linearGradient
id="linearGradient5238">
<stop
id="stop5240"
offset="0"
style="stop-color:#001ccc;stop-opacity:1;" />
<stop
id="stop5242"
offset="1"
style="stop-color:#00afff;stop-opacity:1;" />
</linearGradient>
<radialGradient
r="19.467436"
fy="21.168837"
fx="53.269112"
cy="21.168837"
cx="53.269112"
gradientTransform="matrix(-0.2142105,-0.52792669,0.40876882,-0.17611099,-9.0727074,71.348857)"
gradientUnits="userSpaceOnUse"
id="radialGradient3699-9-1-7"
xlink:href="#linearGradient5238"
inkscape:collect="always" />
<radialGradient
r="34.345188"
fy="672.79736"
fx="225.26402"
cy="672.79736"
cx="225.26402"
gradientTransform="matrix(0.08651231,0,0,0.06169858,13.506439,-56.456825)"
gradientUnits="userSpaceOnUse"
id="radialGradient3663-5-7-6"
xlink:href="#linearGradient3144"
inkscape:collect="always" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="7.9999996"
inkscape:cx="19.198662"
inkscape:cy="35.35504"
inkscape:current-layer="layer1"
showgrid="true"
inkscape:document-units="px"
inkscape:grid-bbox="true"
inkscape:window-width="1366"
inkscape:window-height="702"
inkscape:window-x="0"
inkscape:window-y="27"
inkscape:window-maximized="1" />
<metadata
id="metadata2990">
<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 />
</cc:Work>
</rdf:RDF>
</metadata>
<g
id="layer1"
inkscape:label="Layer 1"
inkscape:groupmode="layer">
<path
transform="matrix(2.0220589,0,0,2.0918646,-20.154412,40.19254)"
sodipodi:type="arc"
style="fill:none;stroke:#000000;stroke-width:2;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
id="path3765-5"
sodipodi:cx="13.181818"
sodipodi:cy="8.681818"
sodipodi:rx="6.181818"
sodipodi:ry="6.0454545"
d="m 19.363636,8.681818 a 6.181818,6.0454545 0 1 1 -12.363636,0 6.181818,6.0454545 0 1 1 12.363636,0 z" />
<path
transform="matrix(2.0220589,0,0,2.069447,29.845588,-11.47731)"
sodipodi:type="arc"
style="fill:none;stroke:#000000;stroke-width:2;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
id="path3765-5-3"
sodipodi:cx="13.181818"
sodipodi:cy="8.681818"
sodipodi:rx="6.181818"
sodipodi:ry="6.0454545"
d="m 19.363636,8.681818 a 6.181818,6.0454545 0 1 1 -12.363636,0 6.181818,6.0454545 0 1 1 12.363636,0 z" />
<path
style="fill:none;stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none"
d="m 7.0000003,32.124999 -0.125,13.625"
id="path3787"
inkscape:connector-curvature="0" />
<path
style="fill:none;stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none"
d="M 57.625003,19.249998 57.000002,50.499999"
id="path3789"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cc" />
<path
style="fill:none;stroke:#ffbf00;stroke-width:9.7;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;fill-opacity:1"
d="M 7,57 C 6.9750344,25.738642 56.979099,56.944846 57,7"
id="path3799"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cc" />
<g
id="g6359"
transform="translate(24.875001,-11.000001)">
<ellipse
ry="8.4786825"
rx="8.2282524"
cy="36.625"
cx="-17.375"
style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:54.21519089px;font-family:Arial;-inkscape-font-specification:Arial;display:inline;overflow:visible;visibility:visible;fill:url(#radialGradient3699-9-1);fill-opacity:1;fill-rule:evenodd;stroke:#00064a;stroke-width:0.80596048;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate"
id="path3696-7-2" />
<ellipse
ry="2.1190491"
rx="2.9712813"
cy="-14.946188"
cx="32.994545"
transform="matrix(-0.81548777,0.57877431,-0.53658468,-0.84384648,0,0)"
id="path3189-2-1-17"
style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:54.21519089px;font-family:Arial;-inkscape-font-specification:Arial;display:inline;overflow:visible;visibility:visible;fill:url(#radialGradient3663-5-7);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:2.19132471;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate" />
</g>
<g
transform="translate(73.750003,19.75)"
id="g6359-8">
<ellipse
ry="8.4786825"
rx="8.2282524"
cy="36.625"
cx="-17.375"
style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:54.21519089px;font-family:Arial;-inkscape-font-specification:Arial;display:inline;overflow:visible;visibility:visible;fill:url(#radialGradient3699-9-1-7);fill-opacity:1;fill-rule:evenodd;stroke:#00064a;stroke-width:0.80596048;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate"
id="path3696-7-2-5" />
<ellipse
ry="2.1190491"
rx="2.9712813"
cy="-14.946188"
cx="32.994545"
transform="matrix(-0.81548777,0.57877431,-0.53658468,-0.84384648,0,0)"
id="path3189-2-1-17-9"
style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:54.21519089px;font-family:Arial;-inkscape-font-specification:Arial;display:inline;overflow:visible;visibility:visible;fill:url(#radialGradient3663-5-7-6);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:2.19132471;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate" />
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 11 KiB

View File

@ -21,3 +21,4 @@ Name, a (t), b (a,t), X (a,b,t), Y(a,b,t), Polar, tmin, tmax, tstep
['Witch of Agnesi', '100 # Radius', 'a', 'a*tan(t)', 'b*cos(t)*cos(t)', '-pi/2.5+0.01', 'pi/2.5-0.01', '0.01', '0']
['Kappa', '10 # Radius', 'a', 'a*tan(t)', 't', '0', '2*pi', '0.01', '1']
['Trefle de Habenicht', '3', 'a', '1+cos(a*t)+(sin(a*t)*sin(a*t))', 't', '0', '2*pi', '0.01', '1']
['Hypotrochoid', '4.5', 'a/1.5', 'a*((a/b -1)*cos(t) + (1/(a/b -1))*cos((a/b -1)*t))', 'a*((a/b -1)*sin(t) - (1/(a/b -1))*sin((a/b -1)*t))', '0', '4*pi', '0.1', '0']

View File

@ -18,3 +18,5 @@ Name, a (t), b (a,t),c (a,b,t), X (a,b,c,t), Y (a,b,c,t), Z (a,b,c,t), tmin, tma
['3D Lissajous', '10 ', '10', '0', 'a*cos(3*t)', 'a*sin(2*t)', 'b*sin(7*t)', '0.0', '2*pi', '0.01']
['Trefoil knot', '10', '0', '1 #-1 senestre', 'a*(cos(t)+2*cos(2*t))', 'a*(sin(t)-2*sin(2*t))', 'a*2*c*sin(3*t)', '0.0', '2*pi', '0.01']
['Nfoil knot', '10', '10 #number of foils', '1 #-1 senestre', 'a*(cos(t)+2*cos((b-1)*t))', 'a*(sin(t)-2*sin((b-1)*t))', 'a*2*c*sin(b*t)', '0.0', '2*pi', '0.01']
['Hypotrochoid-3', '4.5', 'a/1.5', '1', 'a*((a/b -1)*cos(t) + (c/(a/b -1))*cos((a/b -1)*t))', 'a*((a/b -1)*sin(t) - (c/(a/b -1))*sin((a/b -1)*t))', '0.5*t', '0.0', '10*4*pi', '0.1']
['Helix on Circle', '30', '10', '0.05', '(a+b*cos(t))*cos(c*t)', '(a+b*cos(t))*sin(c*t)', 'b*sin(t)', '0.0', '24*2*pi', '0.1']

View File

@ -0,0 +1,16 @@
# -*- coding: utf-8 -*-
from __future__ import division
class Sweep():
def __init__(self, obj, profile, path):
""" Sweep: represents an extrusion of a profile along a path.
"""
obj.addProperty("App::PropertyString", "type", "Sweep", "type of the object").type = "sweep"
obj.addProperty("App::PropertyLink","profile","Sweep","wire/sketch profile of the sweep").profile = profile
def execute(self, fp):
""" Print a short message when doing a recomputation, this method is mandatory.
"""
FreeCAD.Console.PrintMessage("Recompute Python Sweep object\n")

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -8,6 +8,8 @@ try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
_fromUtf8 = lambda s: s
import FreeCAD as App
###############################################################################
@ -154,7 +156,7 @@ def read_text(filename):
print "\nERROR : " + str(filename) + " not a valid file !"
return None
###############################################################################
# Classes
class DefineAndConnectEvents():

View File

@ -0,0 +1,323 @@
# -*- coding: utf-8 -*-
"""
Created on Tue Mar 1 06:59:10 2016
@author: laurent
"""
from __future__ import division
from math import factorial
# Pascal's triangle
p_t = [ [1], # n=0
[1,1], # n=1
[1,2,1], # n=2
[1,3,3,1], # n=3
[1,4,6,4,1], # n=4
[1,5,10,10,5,1], # n=5
[1,6,15,20,15,6,1]] # n=6
#==============================================================================
# binomial(n,k):
# while(n >= lut.length):
# s = lut.length
# nextRow = new array(size=s+1)
# nextRow[0] = 1
# for(i=1, prev=s-1; i&ltprev; i++):
# nextRow[i] = lut[prev][i-1] + lut[prev][i]
# nextRow[s] = 1
# lut.add(nextRow)
# return lut[n][k]
#==============================================================================
def binomial(n, i):
""" return binomial terms from Pascal triangle from predefined list or
calculate the terms if not already in the list.
"""
global p_t
m_l = len(p_t)
while n >= m_l:
m_next_row = []
m_next_row.append(1)
for m_i in range(1,m_l):
m_next_row.append(p_t[m_l-1][m_i-1]+p_t[m_l-1][m_i])
m_next_row.append(1)
# print m_next_row
p_t.append(m_next_row)
m_l = len(p_t)
return p_t[n][i]
def binomial_term(n, i):
""" binomial coefficient = n! / (i!(n - i)!)
"""
return factorial(n) / (factorial(i) * factorial(n - i))
#==============================================================================
# function Bezier(n,t):
# sum = 0
# for(k=0; k<n; k++):
# sum += n!/(k!*(n-k)!) * (1-t)^(n-k) * t^(k)
# return sum
#==============================================================================
def bezier_base(n, t):
""" Basis Bezier function.
"""
m_sum = 0.
m_C = binomial_term
for i in range(n):
m_sum += m_C(n, i) * (1 - t)**(n - i) * t**i
return m_sum
#==============================================================================
# function Bezier(2,t):
# t2 = t * t
# mt = 1-t
# mt2 = mt * mt
# return mt2 + 2*mt*t + t2
#==============================================================================
def bezier_quadratic_terms(t):
""" Simplified Bezier quadratic curve.
Return 3 terms in list ()
"""
m_terms = list()
# n=2 i=0
# m_C(n, i) * (1 - t)**(n - i) * t**i
# m_C(2, 0) * (1 - t)**(2 - 0) * t**0
# 1 * (1 - t)*(1 - t) * 1
m_terms.append((1 - t)*(1 - t))
# n=2 i=1
# m_C(n, i) * (1 - t)**(n - i) * t**i
# m_C(2, 1) * (1 - t)**(2 - 1) * t**1
# 2 * (1 - t) * t
m_terms.append(2 * (1 - t) * t)
m_terms.append(t*t)
return m_terms
#==============================================================================
# function Bezier(3,t):
# t2 = t * t
# t3 = t2 * t
# mt = 1-t
# mt2 = mt * mt
# mt3 = mt2 * mt
# return mt3 + 3*mt2*t + 3*mt*t2 + t3
#==============================================================================
def bezier_cubic_terms(t):
""" Simplified Bezier cubic curve.
Return 4 terms in list ()
"""
m_terms = list()
# n=3 i=0
# m_C(n, i) * (1 - t)**(n - i) * t**i
# m_C(3, 0) * (1 - t)**(3 - 0) * t**0
# (1 - t)*(1 - t)*(1 - t)
m_terms.append((1 - t)*(1 - t)*(1 - t))
# n=3 i=1
# m_C(n, i) * (1 - t)**(n - i) * t**i
# m_C(3, 1) * (1 - t)**(3 - 1) * t**1
# 3 * (1 - t)*(1 - t) * t
m_terms.append(3 * (1 - t)*(1 - t) * t)
# n=3 i=2
# m_C(n, i) * (1 - t)**(n - i) * t**i
# m_C(3, 2) * (1 - t)**(3 - 2) * t**2
# 3 * (1 - t) * t * t
m_terms.append(3 * (1 - t) * t * t)
m_terms.append(t * t * t)
return m_terms
def bezier_terms(n, t):
""" Bezier curve.
Return n+1 terms in list ()
"""
m_terms = list()
m_C = binomial_term
for i in range(n):
m_terms.append( m_C(n, i) * (1 - t)**(n - i) * t**i )
m_terms.append(t ** n)
return m_terms
#==============================================================================
# function Bezier(n,t,w[]):
# sum = 0
# for(k=0; k<n; k++):
# sum += w[k] * binomial(n,k) * (1-t)^(n-k) * t^(k)
# return sum
#==============================================================================
def bezier_curve(n, t, weigths):
""" Basis Bezier function.
"""
m_sum = 0.
m_C = binomial_term
for i,w in zip(range(n+1),weigths):
m_sum += m_C(n, i) * (1 - t)**(n - i) * t**i * w
return m_sum
#==============================================================================
# function Bezier(2,t,w[]):
# t2 = t * t
# mt = 1-t
# mt2 = mt * mt
# return w[0]*mt2 + w[1]*2*mt*t + w[2]*t2
#==============================================================================
def bezier_quadratic_curve(t, weigths):
if len(weigths) != 3:
return None
t2 = t * t
mt = 1-t
mt2 = mt * mt
return weigths[0]*mt2 + weigths[1]*2*mt*t + weigths[2]*t2
#==============================================================================
# function Bezier(3,t,w[]):
# t2 = t * t
# t3 = t2 * t
# mt = 1-t
# mt2 = mt * mt
# mt3 = mt2 * mt
# return w[0]*mt3 + 3*w[1]*mt2*t + 3*w[2]*mt*t2 + w[3]*t3
#==============================================================================
def bezier_cubic_curve(t, weigths):
if len(weigths) != 4:
return None
t2 = t * t
t3 = t2 * t
mt = 1-t
mt2 = mt * mt
mt3 = mt2 * mt
return weigths[0]*mt3 + weigths[1]*3*mt2*t + weigths[2]*3*mt*t2 + weigths[3]*t3
class Bezier():
""" bezier curve object
points : list of control points
points = [(-1,-1,0.0),(0,3,0.0)]
"""
def __init__(self, points):
if (None in [points]) :
print "\nERROR in : bezier.__init__"
print "'points' not defined !"
return None
n = len(t)
pass
if __name__ == "__main__":
import matplotlib.pyplot as plt
import numpy as np
t = np.arange(0.0, 1.0, 0.01)
b1 = bezier_base(1, t)
plt.plot(t, b1)
b2 = bezier_base(2, t)
plt.plot(t, b2)
b3 = bezier_base(3, t)
plt.plot(t, b3)
plt.xlabel('t values')
plt.ylabel('')
plt.title('Bezier basis functions : b1(blue), b2(green) and b3(red)')
plt.grid(True)
plt.show()
# print str(binomial(0, 0))
# print str(binomial(1, 0)),
# print str(binomial(1, 1))
print ("Pascal's triangle :")
for j in range(0,10):
for i in range(0,j+1):
print str(binomial(j, i)),
print ""
# m_points = [(-1,-1,0.0),(0,3,0.0)]
# bz=Bezier(m_points) t = np.arange(0.0, 1.0, 0.01)
t = np.arange(0.0, 1.0, 0.01)
b12,b22,b32 = bezier_quadratic_terms(t)
plt.plot(t, b12)
plt.plot(t, b22)
plt.plot(t, b32)
plt.xlabel('t values')
plt.ylabel('')
plt.title('Bezier basis functions terms : quadratic')
plt.grid(True)
plt.show()
t = np.arange(0.0, 1.0, 0.01)
b13,b23,b33,b43 = bezier_cubic_terms(t)
plt.plot(t, b13)
plt.plot(t, b23)
plt.plot(t, b33)
plt.plot(t, b43)
plt.title('Bezier basis functions terms : cubic')
plt.show()
t = np.arange(0.0, 1.0, 0.01)
m_terms = list()
m_terms = bezier_terms(15,t)
for term in m_terms:
plt.plot(t, term)
plt.title('Bezier basis functions terms : 15')
plt.show()
pt1 = (120,160)
pt2 = (35,200)
pt3 = (220,260)
pt4 = (220,40)
x = (120,35,220,220)
y = (160,200,260,40)
t = np.arange(0.0, 1.0, 0.01)
m_dim = len(x)-1
m_Xs = bezier_curve(m_dim, t, x)
m_Xs = bezier_cubic_curve(t, x)
plt.plot(t, m_Xs)
plt.title('Bezier curve : X')
plt.show()
m_dim = len(y)-1
m_Ys = bezier_curve(m_dim, t, y)
m_Ys = bezier_cubic_curve(t, y)
plt.plot(t, m_Ys)
plt.title('Bezier curve : Y')
plt.show()
plt.plot(m_Xs, m_Ys)
plt.plot(x, y, 'o-')
plt.show()
t = np.arange(-0.2, 1.1, 0.01)
m_Xs = bezier_curve(m_dim, t, x)
m_Ys = bezier_curve(m_dim, t, y)
plt.plot(m_Xs, m_Ys)
plt.plot(x, y, 'o-')
plt.show()
#==============================================================================
# import matplotlib as mpl
# from mpl_toolkits.mplot3d import Axes3D
# import numpy as np
# import matplotlib.pyplot as plt
#
# mpl.rcParams['legend.fontsize'] = 10
#
# fig = plt.figure()
# ax = fig.gca(projection='3d')
# theta = np.linspace(-4 * np.pi, 4 * np.pi, 100)
# z = np.linspace(-2, 2, 100)
# r = z**2 + 1
# x = r * np.sin(theta)
# y = r * np.cos(theta)
# ax.plot(x, y, z, label='parametric curve')
# ax.legend()
#
# plt.show()
#==============================================================================

View File

@ -0,0 +1,142 @@
# -*- coding: utf-8 -*-
"""
Created on Thu Jan 21 21:21:12 2016
@author: laurent
"""
import Draft, Part
__title__ = "FCConvertLines"
__author__ = "Mario52"
__url__ = "http://www.freecadweb.org/index-fr.html"
__version__ = "00.01"
__date__ = "19/01/2016"
def dashLine(dash01 = 2.0, space01 = 1.0, dash02 = 1.0, space02 = 1.0, compLine = 0, red = 0, green = 0, blue = 0, typeLine = 1):
# typeLine = 1 "_ _ _ _ _ _ _ _ _ " dash (dash01, space01)
# typeLine = 2 "___ _ ___ _ ___ _ " dash dot (dash01, space01, dash02)
# typeLine = 3 "___ _ _ ___ _ _ ___" dash dot dot (dash01, space01, dash02, space02)
def createLines(numberOfPoints, points):
space = 0
for lin in range(numberOfPoints-1):
if space == 0:
creaLine = [FreeCAD.Vector(points[lin]),FreeCAD.Vector(points[lin+1])]
wire = Draft.makeWire(creaLine,closed=False,face=False,support=None)
space = 1
ligne.append(wire.Shape) # for compount
nom.append(wire.Name) # for compount
else:
space = 0
# si pas possible affiche cette ligne # Cannot compute Inventor representation for the shape of Shape.
def colorize():
FreeCADGui.activeDocument().activeObject().LineColor = (float(red)/255,float(green)/255,float(blue)/255)
FreeCADGui.activeDocument().activeObject().PointColor = (float(red)/255,float(green)/255,float(blue)/255)
FreeCADGui.activeDocument().activeObject().ShapeColor = (float(red)/255,float(green)/255,float(blue)/255)
if dash01 and space01 and dash02 and space02 != 0:
nom = []; nom[:] = []
ligne = []; ligne[:] = []
comp2 = []; comp2[:] = []
points = []; points[:] = []
points2 = []; points2[:] = []
precision = 1000 # permet 3 decimales = 0.001
dash01 = dash01 * precision
space01 = space01 * precision
dash02 = dash02 * precision
space02 = space02 * precision
try:
#######Selectionne un ou des objets vue 3D ou vue combinnee (subObjects complete) getSelection()############################
# compt_Oject = -1 #
# selectionObjects = FreeCADGui.Selection.getSelection() # Select an object or primitive getSelection()
# for selection in enumerate(selectionObjects): #
# compt_Oject += 1 #
# compt_Edges = -1 #
# for selectedEdge in enumerate(selectionObjects[compt_Oject].Shape.Edges): # Search the "Edges" and their lengths
# compt_Edges += 1 #
# longueur = (selectionObjects[compt_Oject].Shape.Edges[compt_Edges].Length) * precision #
# if (dash01 + space01 + dash02 + space02) >= longueur: #
# dash01 = int(longueur / 6) # altenate solution
# space01 = int(longueur / 6) # altenate solution
# dash02 = int(longueur / 6) # altenate solution
# space02 = int(longueur / 6) # altenate solution
# FreeCAD.Console.PrintError("Alernate Dash"+"\n") # altenate solution
# numberOfPoints = longueur #
# points = selectionObjects[compt_Oject].Shape.Edges[compt_Edges].discretize(int(numberOfPoints)) # Dicretize
############################################################################################################################
#####selection 1 objet ou sous objet a la fois dans la vue 3D getSelectionEx()#############################################
selectionObjects = FreeCADGui.Selection.getSelectionEx() # Select an object or sub object getSelectionEx
for selection in selectionObjects: #
for selectedEdge in selection.SubObjects: #
longueur = (selectedEdge.Length) * precision #
if (dash01 + space01 + dash02 + space02) >= longueur: # altenate solution
dash01 = int(longueur / 6) # altenate solution
space01 = int(longueur / 6) # altenate solution
dash02 = int(longueur / 6) # altenate solution
space02 = int(longueur / 6) # altenate solution
FreeCAD.Console.PrintError("Alernate Dash"+"\n") # altenate solution
numberOfPoints = longueur #
points = selectedEdge.Edges[0].discretize(int(numberOfPoints)) # Dicretize
###########################################################################################################################
#######cut line in dashDot coordinates#########################################################################
compt = 0
points2 += [points[0]]
for ii2 in range(len(points)):
try:
compt += int(dash01)
points2 += [points[compt]]
compt += int(space01)
points2 += [points[compt]]
if typeLine > 1: # typeLine = 2 "___ _ ___ _ ___ _ " dash dot
compt += int(dash02)
points2 += [points[compt]]
compt += int(space01)
points2 += [points[compt]]
if typeLine > 2: # typeLine = 3 "___ _ _ ___ _ _ ___" dash dot dot
compt += int(dash02)
points2 += [points[compt]]
compt += int(space01)
points2 += [points[compt]]
except Exception:
points2 += [points[-1]]
points2[-1] = points[-1]
break
createLines(len(points2), points2)
#######cut line in dash coordinates##############################################################################
if compLine == 0:
comp = Part.makeCompound(ligne) # si compount ligne separee
Part.show(comp) # si compount ligne separee
else:
comp2 += ligne
colorize()
ligne[:] = [] # si compount ligne separee
points[:] = []
points2[:] = []
for i in nom:
FreeCAD.ActiveDocument.removeObject(i)
if compLine != 0: # 1 = toutes les selections en un compount
comp = Part.makeCompound(comp2) # si compount ensemble complet
Part.show(comp) # si compount ensemble complet
colorize()
nom[:] = []
ligne[:] = []
comp2[:] = []
points[:] = []
points2[:] = []
except Exception:
FreeCAD.Console.PrintError("can not create"+"\n")
else:
FreeCAD.Console.PrintError("Zero not permitted"+"\n")
#dashLine(dash01 = 1.0, space01 = 0.2, dash02 = 0.2, space02 = 0.2, compLine = 0, red = 0, green = 0, blue = 255, typeLine = 2)

View File

@ -0,0 +1,104 @@
# -*- coding: utf-8 -*-
"""
Created on Thu Jan 21 22:10:41 2016
@author: laurent
"""
import numpy as np
import scipy.optimize
def fitPLaneLTSQ(XYZ):
# Fits a plane to a point cloud,
# Where Z = aX + bY + c ----Eqn #1
# Rearanging Eqn1: aX + bY -Z +c =0
# Gives normal (a,b,-1)
# Normal = (a,b,-1)
[rows,cols] = XYZ.shape
G = np.ones((rows,3))
G[:,0] = XYZ[:,0] #X
G[:,1] = XYZ[:,1] #Y
Z = XYZ[:,2]
(a,b,c),resid,rank,s = np.linalg.lstsq(G,Z)
normal = (a,b,-1)
nn = np.linalg.norm(normal)
normal = normal / nn
return normal
def fitPlaneSVD(XYZ):
[rows,cols] = XYZ.shape
# Set up constraint equations of the form AB = 0,
# where B is a column vector of the plane coefficients
# in the form b(1)*X + b(2)*Y +b(3)*Z + b(4) = 0.
p = (np.ones((rows,1)))
AB = np.hstack([XYZ,p])
[u, d, v] = np.linalg.svd(AB,0)
B = v[3,:]; # Solution is last column of v.
nn = np.linalg.norm(B[0:3])
B = B / nn
return B[0:3]
def fitPlaneEigen(XYZ):
# Works, in this case but don't understand!
average=sum(XYZ)/XYZ.shape[0]
covariant=np.cov(XYZ - average)
eigenvalues,eigenvectors = np.linalg.eig(covariant)
want_max = eigenvectors[:,eigenvalues.argmax()]
(c,a,b) = want_max[3:6] # Do not understand! Why 3:6? Why (c,a,b)?
normal = np.array([a,b,c])
nn = np.linalg.norm(normal)
return normal / nn
def fitPlaneSolve(XYZ):
X = XYZ[:,0]
Y = XYZ[:,1]
Z = XYZ[:,2]
npts = len(X)
A = np.array([ [sum(X*X), sum(X*Y), sum(X)],
[sum(X*Y), sum(Y*Y), sum(Y)],
[sum(X), sum(Y), npts] ])
B = np.array([ [sum(X*Z), sum(Y*Z), sum(Z)] ])
normal = np.linalg.solve(A,B.T)
nn = np.linalg.norm(normal)
normal = normal / nn
return normal.ravel()
def fitPlaneOptimize(XYZ):
def residiuals(parameter,f,x,y):
return [(f[i] - model(parameter,x[i],y[i])) for i in range(len(f))]
def model(parameter, x, y):
a, b, c = parameter
return a*x + b*y + c
X = XYZ[:,0]
Y = XYZ[:,1]
Z = XYZ[:,2]
p0 = [1., 1.,1.] # initial guess
result = scipy.optimize.leastsq(residiuals, p0, args=(Z,X,Y))[0]
normal = result[0:3]
nn = np.linalg.norm(normal)
normal = normal / nn
return normal
if __name__=="__main__":
XYZ = np.array([
[0,0,1],
[0,1,2],
[0,2,3],
[1,0,1],
[1,1,2],
[1,2,3],
[2,0,1],
[2,1,2],
[2,2,3]
])
print "Solve: ",fitPlaneSolve(XYZ)
print "Optim: ",fitPlaneOptimize(XYZ)
print "SVD: ",fitPlaneSVD(XYZ)
print "LTSQ: ",fitPLaneLTSQ(XYZ)
print "Eigen: ",fitPlaneEigen(XYZ)

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -2,6 +2,7 @@
"""
"""
import os.path
#import FreeCAD as App
from PySide import QtCore
try:
@ -157,6 +158,359 @@ def read_text(filename):
###############################################################################
# Classes
class Selection():
"""
Create a Selection Object
*Gui_Selection* : selected object from GUI.
m_activeDoc = App.activeDocument()
if m_activeDoc == None:
message = "No Active document selected !"
return (None, message)
if m_activeDoc.Name:
m_selEx = Gui.Selection.getSelectionEx(m_activeDoc.Name)
m_sel = Selection(m_selEx)
"""
def __init__(self, Gui_Selection):
self.__numberOfEntities = 0
self.__numberOfVertexes = 0
self.__numberOfEdges = 0
self.__numberOfWires = 0
self.__numberOfFaces = 0
self.__numberOfObjects = 0
self.__numberOfImages = 0
self.__selectedVertices = []
self.__selectedEdges = []
self.__selectedWires = []
self.__selectedFaces = []
self.__selectedObjects = []
self.__selectedImages = []
self.__selEx = None
if Gui_Selection == None:
message = "No Selection from Active document passed !"
return (None, message)
self.__selEx = Gui_Selection
self.initialize()
def storeShapeType(self, Object):
if Object.ShapeType == "Vertex":
self.__selectedVertices.append(Object)
return True
if Object.ShapeType == "Edge":
self.__selectedEdges.append(Object)
return True
if Object.ShapeType == "Wire":
self.__selectedWires.append(Object)
return True
if Object.ShapeType == "Face":
self.__selectedFaces.append(Object)
return True
return False
def initialize(self):
self.__numberOfEntities = len (self.__selEx)
if self.__numberOfEntities >= 1:
for m_Sel_i_Object in self.__selEx:
if not m_Sel_i_Object.HasSubObjects:
if hasattr(m_Sel_i_Object, 'Object'):
m_Object = m_Sel_i_Object.Object
if hasattr(m_Object, 'ShapeType'):
self.storeShapeType(m_Object)
if hasattr(m_Object, 'Shape'):
self.__selectedObjects.append(m_Object)
if hasattr(m_Object, 'ImageFile'):
self.__selectedImages.append(m_Object)
# if hasattr(m_Sel_i_Object.Object, 'Shape'):
# # if hasattr(m_Sel_i_Object.Object.Shape, 'ShapeType'):
# # if not self.storeShapeType(m_Sel_i_Object.Object.Shape):
# # self.__selectedObjects.append(m_Sel_i_Object.Object)
else:
for m_Object in m_Sel_i_Object.SubObjects:
if hasattr(m_Object, 'ShapeType'):
self.storeShapeType(m_Object)
if hasattr(m_Object, 'Shape'):
self.__selectedObjects.append(m_Object)
if hasattr(m_Object, 'ImageFile'):
self.__selectedImages.append(m_Object)
self.__numberOfVertexes = len(self.__selectedVertices)
self.__numberOfEdges = len(self.__selectedEdges)
self.__numberOfWires = len(self.__selectedWires)
self.__numberOfFaces = len(self.__selectedFaces)
self.__numberOfObjects = len(self.__selectedObjects)
self.__numberOfImages = len(self.__selectedImages)
message = "Initialization done !"
return message
else:
message = "No Object selected !"
return (None, message)
message = ""
return (None, message)
def __getNumberOfEntities(self):
return self.__numberOfEntities
def __setNumberOfEntities(self, val):
self.__numberOfEntities = val
numberOfEntities = property(__getNumberOfEntities, __setNumberOfEntities)
def __getNumberOfPoints(self):
return self.__numberOfVertexes
def __setNumberOfPoints(self, val):
self.__numberOfVertexes = val
numberOfPoints = property(__getNumberOfPoints, __setNumberOfPoints)
def __getNumberOfSegments(self):
return self.__numberOfEdges
def __setNumberOfSegments(self, val):
self.__numberOfEdges = val
numberOfSegments = property(__getNumberOfSegments, __setNumberOfSegments)
def __getNumberOfCurves(self):
return self.__numberOfWires
def __setNumberOfCurves(self, val):
self.__numberOfWires = val
numberOfCurves = property(__getNumberOfCurves, __setNumberOfCurves)
def __getNumberOfPlanes(self):
return self.__numberOfFaces
def __setNumberOfPlanes(self, val):
self.__numberOfFaces = val
numberOfPlanes = property(__getNumberOfPlanes, __setNumberOfPlanes)
def __getNumberOfObjects(self):
return self.__numberOfObjects
def __setNumberOfObjects(self, val):
self.__numberOfObjects = val
numberOfObjects = property(__getNumberOfObjects, __setNumberOfObjects)
def __getNumberOfImages(self):
return self.__numberOfImages
def __setNumberOfImages(self, val):
self.__numberOfImages = val
numberOfImages = property(__getNumberOfImages, __setNumberOfImages)
def __str__(self):
message = "Gui_Selection : " + str(self.__selEx)
message += "\nNumberOfImages : " + str(self.__numberOfImages)
message += "\nNumberOfObjects : " + str(self.__numberOfObjects)
message += "\nNumberOfPlanes : " + str(self.__numberOfFaces)
message += "\nNumberOfCurves : " + str(self.__numberOfWires)
message += "\nNumberOfSegments : " + str(self.__numberOfEdges)
message += "\nNumberOfPoints : " + str(self.__numberOfVertexes)
message += "\nNumberOfEntities : " + str(self.__numberOfEntities)
return (message)
def get_points(self, getfrom=["Points","Segments","Curves","Planes","Objects"]):
""" Return all Points found in selection including the Points from objects as
(Number of Points, list of Vertexes)
Return None if no Point detected
"""
Selected_Entities = []
if self.numberOfEntities == 0 :
return None
if self.numberOfPoints > 0 and "Points" in getfrom :
for m_point in self.__selectedVertices:
Selected_Entities.append(m_point)
if self.numberOfSegments > 0 and "Segments" in getfrom :
for m_edge in self.__selectedEdges:
Selected_Entities.append(m_edge.Vertexes[0])
Selected_Entities.append(m_edge.Vertexes[-1])
# TOCOMPLETE
if self.numberOfCurves > 0 and "Curves" in getfrom :
pass
if self.numberOfPlanes > 0 and "Planes" in getfrom :
for m_face in self.__selectedFaces:
m_edges_list = m_face.Edges
for m_edge in m_edges_list:
Selected_Entities.append(m_edge.Vertexes[0])
Selected_Entities.append(m_edge.Vertexes[-1])
if self.numberOfObjects > 0 and "Objects" in getfrom :
for m_object in self.__selectedObjects:
for m_vertex in m_object.Shape.Vertexes:
Selected_Entities.append(m_vertex)
if len(Selected_Entities) != 0:
return (len(Selected_Entities), Selected_Entities)
else:
return (0, None)
def get_segments(self, getfrom=["Points","Segments","Curves","Planes","Objects"]):
""" Return all Segments found in selection including the Segments from objects as
(Number of Segments, list of Edges)
In case of at least 2 points selected it will create a line from these 2 points
Return None if no Segment detected
"""
Selected_Entities = []
if self.numberOfEntities == 0 :
return None
if self.numberOfPoints >= 2 and "Points" in getfrom :
import Part
for m_p1,m_p2 in zip(self.__selectedVertices, self.__selectedVertices[1:]):
m_diff = m_p2.Point.sub(m_p1.Point)
tolerance = 1e-10
if abs(m_diff.x) <= tolerance and abs(m_diff.y) <= tolerance and abs(m_diff.z) <= tolerance:
continue
Selected_Entities.append(Part.makeLine(m_p2.Point, m_p1.Point))
if self.numberOfSegments > 0 and "Segments" in getfrom :
for m_edge in self.__selectedEdges:
Selected_Entities.append(m_edge)
# TOCOMPLETE
if self.numberOfCurves > 0 and "Curves" in getfrom :
for m_wire in self.__selectedWires:
Selected_Entities.append(m_wire)
if self.numberOfPlanes > 0 and "Planes" in getfrom :
for m_face in self.__selectedFaces:
m_edges_list = m_face.Edges
for m_edge in m_edges_list:
Selected_Entities.append(m_edge)
if self.numberOfObjects > 0 and "Objects" in getfrom :
for m_object in self.__selectedObjects:
for m_edge in m_object.Shape.Edges:
Selected_Entities.append(m_edge)
if len(Selected_Entities) != 0:
return (len(Selected_Entities), Selected_Entities)
else:
return (0, None)
def get_curves(self, getfrom=["Points","Segments","Curves","Planes","Objects"]):
Selected_Entities = []
if self.numberOfEntities == 0 :
return None
if self.numberOfCurves > 0 and "Curves" in getfrom :
for m_wire in self.__selectedWires:
Selected_Entities.append(m_wire)
if self.numberOfPlanes > 0 and "Planes" in getfrom :
for m_face in self.__selectedFaces:
m_wires_list = m_face.Wires
for m_wire in m_wires_list:
Selected_Entities.append(m_wire)
if self.numberOfObjects > 0 and "Objects" in getfrom :
for m_object in self.__selectedObjects:
for m_wire in m_object.Shape.Wires:
Selected_Entities.append(m_wire)
if len(Selected_Entities) != 0:
return (len(Selected_Entities), Selected_Entities)
else:
return (0, None)
def get_planes(self, getfrom=["Points","Segments","Curves","Planes","Objects"]):
Selected_Entities = []
if self.numberOfEntities == 0 :
return None
# TOCOMPLETE
# if self.numberOfPoints >= 3 and "Points" in getfrom :
# import Part
# for m_p1,m_p2 in zip(self.__selectedVertices, self.__selectedVertices[1:]):
# m_diff = m_p2.Point.sub(m_p1.Point)
# tolerance = 1e-10
# if abs(m_diff.x) <= tolerance and abs(m_diff.y) <= tolerance and abs(m_diff.z) <= tolerance:
# continue
# Selected_Entities.append(Part.makeLine(m_p2.Point, m_p1.Point))
#
# # TOCOMPLETE
# if self.numberOfSegments >= 2 and "Segments" in getfrom :
# import Part
# for m_l1,m_l2 in zip(self.__selectedEdges, self.__selectedEdges[1:]):
# for m_edge in self.__selectedEdges
# Selected_Entities.append(m_edge)
if self.numberOfPlanes > 0 and "Planes" in getfrom :
for m_face in self.__selectedFaces:
Selected_Entities.append(m_face)
if self.numberOfObjects > 0 and "Objects" in getfrom :
for m_object in self.__selectedObjects:
for m_face in m_object.Shape.Faces:
Selected_Entities.append(m_face)
if len(Selected_Entities) != 0:
return (len(Selected_Entities), Selected_Entities)
else:
return (0, None)
def get_objects(self):
Selected_Entities = []
pass
def get_primer_selected_entities(self, selection_type):
Selected_Entities = selection_type
if len(Selected_Entities) != 0:
return (len(Selected_Entities), Selected_Entities)
else:
return (0, None)
def get_primerPoints(self):
return self.get_primer_selected_entities(self.__selectedVertices)
def get_primerSegments(self):
return self.get_primer_selected_entities(self.__selectedEdges)
def get_primerCurves(self):
return self.get_primer_selected_entities(self.__selectedWires)
def get_primerPlanes(self):
return self.get_primer_selected_entities(self.__selectedFaces)
def get_primerObjects(self):
return self.get_primer_selected_entities(self.__selectedObjects)
def get_primerImages(self):
return self.get_primer_selected_entities(self.__selectedImages)
class DefineAndConnectEvents():
def __init__(self, ui, obj):
"""

View File

@ -2,17 +2,40 @@
import sys
import os.path
# Change this by your own FreeCAD lib path to import FreeCAD
if not sys.path.__contains__("/usr/lib/freecad/lib"):
sys.path.append("/usr/lib/freecad/lib")
try:
# try import
import WorkFeature.WF_2015 as WF
except:
# get the path of the current python script
m_current_path = os.path.realpath(__file__)
m_current_path = os.path.dirname(m_current_path)
# check if this path belongs to the PYTHONPATH variable and if not add it
if not sys.path.__contains__(str(m_current_path)):
sys.path.append(str(m_current_path))
# retry import now
import WorkFeature.WF_2015 as WF
try:
import FreeCAD
# first check if the path to WorkFeature was set in the preferences
param = FreeCAD.ParamGet('User parameter:Plugins/workfeature')
m_current_path = param.GetString('destination','')
if not m_current_path:
# get the path of the current python script
m_current_path = os.path.realpath(__file__)
m_current_path = os.path.dirname(m_current_path)
# check if this path belongs to the PYTHONPATH variable and if not add it
if not sys.path.__contains__(str(m_current_path)):
sys.path.append(str(m_current_path))
# retry import now
try:
import WorkFeature.WF_2015 as WF
except:
# we still cannot find WorkFeature. Ask the user
from PySide import QtGui
folderDialog = QtGui.QFileDialog.getExistingDirectory(None,QtGui.QApplication.translate("WorkFeature", "Location of your WorkFeature folder", None, QtGui.QApplication.UnicodeUTF8))
param.SetString('destination',folderDialog)
m_current_path = param.GetString('destination')
sys.path.append(str(m_current_path))
# retry import
import WorkFeature.WF_2015 as WF
except:
print "ERROR:cannot load FreeCAD module...modify line 6 and 7 of this script !!"
sys.exit(1)
WF.myDialog = WF.WorkFeatureTab()