Add "Auto element visibility" command

When enabled, it will hide all AsmElement, and AsmElementLink, and only
shown then when they are selected, or a AsmConstraint object is
selected in the tree view
This commit is contained in:
Zheng, Lei 2018-01-27 12:15:05 +08:00
parent 363a8cfeba
commit a8f11a4a50
4 changed files with 706 additions and 18 deletions

View File

@ -0,0 +1,603 @@
<?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="svg3612"
version="1.1"
inkscape:version="0.91 r13725"
sodipodi:docname="Assembly_ElementAutoView.svg">
<defs
id="defs3614">
<marker
inkscape:stockid="Arrow1Mend"
orient="auto"
refY="0.0"
refX="0.0"
id="Arrow1Mend"
style="overflow:visible;">
<path
id="path3835"
d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt;"
transform="scale(0.4) rotate(180) translate(10,0)" />
</marker>
<marker
inkscape:stockid="Arrow1Mstart"
orient="auto"
refY="0.0"
refX="0.0"
id="Arrow1Mstart"
style="overflow:visible">
<path
id="path3832"
d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt"
transform="scale(0.4) translate(10,0)" />
</marker>
<marker
inkscape:stockid="Arrow1Lstart"
orient="auto"
refY="0.0"
refX="0.0"
id="Arrow1Lstart"
style="overflow:visible">
<path
id="path3826"
d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt"
transform="scale(0.8) translate(12.5,0)" />
</marker>
<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="perspective3620" />
<inkscape:perspective
id="perspective3588"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective3692"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<linearGradient
id="linearGradient3144-6">
<stop
id="stop3146-9"
style="stop-color:#ffffff;stop-opacity:1"
offset="0" />
<stop
id="stop3148-2"
style="stop-color:#ffffff;stop-opacity:0"
offset="1" />
</linearGradient>
<linearGradient
id="linearGradient3701">
<stop
id="stop3703"
style="stop-color:#ffffff;stop-opacity:1"
offset="0" />
<stop
id="stop3705"
style="stop-color:#ffffff;stop-opacity:0"
offset="1" />
</linearGradient>
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3144-6"
id="radialGradient3688"
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
id="linearGradient3708">
<stop
id="stop3710"
style="stop-color:#ffffff;stop-opacity:1"
offset="0" />
<stop
id="stop3712"
style="stop-color:#ffffff;stop-opacity:0"
offset="1" />
</linearGradient>
<inkscape:perspective
id="perspective3805"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<linearGradient
id="linearGradient3864-0-0">
<stop
id="stop3866-5-7"
offset="0"
style="stop-color:#0619c0;stop-opacity:1;" />
<stop
id="stop3868-7-6"
offset="1"
style="stop-color:#379cfb;stop-opacity:1;" />
</linearGradient>
<linearGradient
id="linearGradient3377">
<stop
id="stop3379"
offset="0"
style="stop-color:#ffaa00;stop-opacity:1;" />
<stop
id="stop3381"
offset="1"
style="stop-color:#faff2b;stop-opacity:1;" />
</linearGradient>
<linearGradient
id="linearGradient3864-0">
<stop
id="stop3866-5"
offset="0"
style="stop-color:#0619c0;stop-opacity:1;" />
<stop
id="stop3868-7"
offset="1"
style="stop-color:#379cfb;stop-opacity:1;" />
</linearGradient>
<inkscape:perspective
id="perspective3902"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<linearGradient
id="linearGradient5048">
<stop
style="stop-color:black;stop-opacity:0;"
offset="0"
id="stop5050" />
<stop
id="stop5056"
offset="0.5"
style="stop-color:black;stop-opacity:1;" />
<stop
style="stop-color:black;stop-opacity:0;"
offset="1"
id="stop5052" />
</linearGradient>
<linearGradient
id="linearGradient3841-0-3">
<stop
id="stop3843-1-3"
offset="0"
style="stop-color:#0619c0;stop-opacity:1;" />
<stop
id="stop3845-0-8"
offset="1"
style="stop-color:#379cfb;stop-opacity:1;" />
</linearGradient>
<radialGradient
gradientUnits="userSpaceOnUse"
fy="114.5684"
fx="20.892099"
r="5.256"
cy="114.5684"
cx="20.892099"
id="aigrd2">
<stop
id="stop15566"
style="stop-color:#F0F0F0"
offset="0" />
<stop
id="stop15568"
style="stop-color:#9a9a9a;stop-opacity:1.0000000;"
offset="1.0000000" />
</radialGradient>
<radialGradient
gradientUnits="userSpaceOnUse"
fy="64.567902"
fx="20.892099"
r="5.257"
cy="64.567902"
cx="20.892099"
id="aigrd3">
<stop
id="stop15573"
style="stop-color:#F0F0F0"
offset="0" />
<stop
id="stop15575"
style="stop-color:#9a9a9a;stop-opacity:1.0000000;"
offset="1.0000000" />
</radialGradient>
<linearGradient
id="linearGradient15662">
<stop
style="stop-color:#ffffff;stop-opacity:1.0000000;"
offset="0.0000000"
id="stop15664" />
<stop
style="stop-color:#f8f8f8;stop-opacity:1.0000000;"
offset="1.0000000"
id="stop15666" />
</linearGradient>
<radialGradient
r="86.70845"
fy="35.736916"
fx="33.966679"
cy="35.736916"
cx="33.966679"
gradientTransform="matrix(0.96049297,0,0,1.041132,-52.144249,-702.33158)"
gradientUnits="userSpaceOnUse"
id="radialGradient4452"
xlink:href="#linearGradient259"
inkscape:collect="always" />
<linearGradient
id="linearGradient259">
<stop
style="stop-color:#fafafa;stop-opacity:1.0000000;"
offset="0.0000000"
id="stop260" />
<stop
style="stop-color:#bbbbbb;stop-opacity:1.0000000;"
offset="1.0000000"
id="stop261" />
</linearGradient>
<radialGradient
r="37.751713"
fy="3.7561285"
fx="8.824419"
cy="3.7561285"
cx="8.824419"
gradientTransform="matrix(0.96827297,0,0,1.032767,-48.790699,-701.68513)"
gradientUnits="userSpaceOnUse"
id="radialGradient4454"
xlink:href="#linearGradient269"
inkscape:collect="always" />
<linearGradient
id="linearGradient269">
<stop
style="stop-color:#a3a3a3;stop-opacity:1.0000000;"
offset="0.0000000"
id="stop270" />
<stop
style="stop-color:#4c4c4c;stop-opacity:1.0000000;"
offset="1.0000000"
id="stop271" />
</linearGradient>
<inkscape:perspective
id="perspective4947"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<linearGradient
id="linearGradient4095">
<stop
style="stop-color:#005bff;stop-opacity:1;"
offset="0"
id="stop4097" />
<stop
style="stop-color:#c1e3f7;stop-opacity:1;"
offset="1"
id="stop4099" />
</linearGradient>
<inkscape:perspective
id="perspective5027"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective5076"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4247"
id="linearGradient4253"
x1="394.15784"
y1="185.1304"
x2="434.73947"
y2="140.22731"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.94231826,0,0,0.94231826,23.727549,8.8262536)" />
<linearGradient
id="linearGradient4247">
<stop
style="stop-color:#2e8207;stop-opacity:1;"
offset="0"
id="stop4249" />
<stop
style="stop-color:#52ff00;stop-opacity:1;"
offset="1"
id="stop4251" />
</linearGradient>
<linearGradient
y2="140.22731"
x2="434.73947"
y1="185.1304"
x1="394.15784"
gradientTransform="matrix(0.94231826,0,0,0.94231826,23.727549,8.8262536)"
gradientUnits="userSpaceOnUse"
id="linearGradient5087"
xlink:href="#linearGradient4247"
inkscape:collect="always" />
<inkscape:perspective
id="perspective5141"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<marker
inkscape:stockid="Arrow1Mstart"
orient="auto"
refY="0"
refX="0"
id="Arrow1Mstart-9"
style="overflow:visible">
<path
inkscape:connector-curvature="0"
id="path3832-1"
d="M 0,0 5,-5 -12.5,0 5,5 0,0 z"
style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt"
transform="matrix(0.4,0,0,0.4,4,0)" />
</marker>
<marker
inkscape:stockid="Arrow1Mend"
orient="auto"
refY="0"
refX="0"
id="Arrow1Mend-2"
style="overflow:visible">
<path
inkscape:connector-curvature="0"
id="path3835-7"
d="M 0,0 5,-5 -12.5,0 5,5 0,0 z"
style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt"
transform="matrix(-0.4,0,0,-0.4,-4,0)" />
</marker>
<linearGradient
id="linearGradient3895-5">
<stop
style="stop-color:#729fcf;stop-opacity:1;"
offset="0"
id="stop3897-6" />
<stop
style="stop-color:#204a87;stop-opacity:1;"
offset="1"
id="stop3899-2" />
</linearGradient>
<linearGradient
id="linearGradient3094-7-8">
<stop
id="stop3096-6-7"
offset="0"
style="stop-color:#4e9a06;stop-opacity:1" />
<stop
id="stop3098-0-4"
offset="1"
style="stop-color:#8ae234;stop-opacity:1" />
</linearGradient>
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="6.6796363"
inkscape:cx="63.435878"
inkscape:cy="10.110619"
inkscape:current-layer="layer1"
showgrid="true"
inkscape:document-units="px"
inkscape:grid-bbox="true"
inkscape:window-width="1375"
inkscape:window-height="876"
inkscape:window-x="65"
inkscape:window-y="24"
inkscape:window-maximized="1"
inkscape:snap-bbox="true">
<inkscape:grid
type="xygrid"
id="grid3086"
empspacing="2"
visible="true"
enabled="true"
snapvisiblegridlinesonly="true" />
</sodipodi:namedview>
<metadata
id="metadata3617">
<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>
<dc:creator>
<cc:Agent>
<dc:title>[Sebastian Hoogen]</dc:title>
</cc:Agent>
</dc:creator>
<dc:title>OpenSCAD_RemoveSubtree</dc:title>
<dc:date>2012-05-03</dc:date>
<dc:relation>http://www.freecadweb.org/wiki/index.php?title=Artwork</dc:relation>
<dc:publisher>
<cc:Agent>
<dc:title>FreeCAD</dc:title>
</cc:Agent>
</dc:publisher>
<dc:identifier>FreeCAD/src/Mod/OpenSCAD/Resources/icons/OpenSCAD_RemoveSubtree.svg</dc:identifier>
<dc:rights>
<cc:Agent>
<dc:title>FreeCAD LGPL2+</dc:title>
</cc:Agent>
</dc:rights>
<cc:license>https://www.gnu.org/copyleft/lesser.html</cc:license>
<dc:contributor>
<cc:Agent>
<dc:title>[agryson] Alexander Gryson</dc:title>
</cc:Agent>
</dc:contributor>
</cc:Work>
</rdf:RDF>
</metadata>
<g
id="layer1"
inkscape:label="Layer 1"
inkscape:groupmode="layer">
<path
sodipodi:nodetypes="ccc"
id="path5098-3"
d="m 8.999987,12.999998 0,42.000002 12,0"
style="fill:none;stroke:#2e3436;stroke-width:6;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
inkscape:connector-curvature="0" />
<path
id="path5100-6"
d="m 23,23 -14.000013,-2e-6"
style="fill:none;stroke:#2e3436;stroke-width:6;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cc" />
<path
sodipodi:nodetypes="ccc"
id="path5098-36"
d="m 8.999987,12.999998 0,42.000002 12,0"
style="fill:none;stroke:#d3d7cf;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
inkscape:connector-curvature="0" />
<path
id="path5100-7"
d="m 24,23 -15.000013,-2e-6"
style="fill:none;stroke:#d3d7cf;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cc" />
<rect
ry="0"
rx="0"
y="3"
x="3.0000002"
height="10"
width="37.999989"
id="rect4258-1-7-4-5"
style="color:#000000;fill:#eeeeec;stroke:#2e3436;stroke-width:1.99999988;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
<rect
style="fill:#d3d7cf;fill-opacity:1;stroke:#ffffff;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
id="rect3852-5-3"
width="34"
height="6"
x="5"
y="5" />
<g
id="g4294"
transform="translate(8.5333989,-17.066798)">
<rect
style="color:#000000;display:inline;overflow:visible;visibility:visible;fill:#eeeeec;stroke:#2e3436;stroke-width:1.99999988;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate"
id="rect4258-1-7-4-3"
width="26.38888"
height="9.9999943"
x="21"
y="51"
rx="0"
ry="0" />
<rect
y="53"
x="23"
height="6"
width="22"
id="rect3852-5-5"
style="fill:#d3d7cf;fill-opacity:1;stroke:#ffffff;stroke-width:1.99999976;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
</g>
<path
sodipodi:nodetypes="ccc"
id="path5098-3-2"
d="m 17,24 0,15 12,0"
style="fill:none;stroke:#2e3436;stroke-width:5.99999952;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
inkscape:connector-curvature="0" />
<path
sodipodi:nodetypes="ccc"
id="path5098-36-6"
d="m 17,23 0,16 12,0"
style="fill:none;stroke:#d3d7cf;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
inkscape:connector-curvature="0" />
<g
id="g4290"
transform="translate(-1.1976703,-17.789654)">
<rect
style="color:#000000;display:inline;overflow:visible;visibility:visible;fill:#3465a4;stroke:#0b1521;stroke-width:1.99999976;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate"
id="rect4258-1-7-4-7-3-6"
width="24"
height="10"
x="25"
y="35"
rx="0"
ry="0" />
<rect
y="37"
x="27"
height="6"
width="20"
id="rect3852-5-0"
style="fill:#3465a4;fill-opacity:1;stroke:#729fcf;stroke-width:1.99999988;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
</g>
<g
id="g4298"
transform="translate(0.29941747,-1.0479616)">
<rect
ry="0"
rx="0"
y="51"
x="21"
height="9.9999943"
width="26.38888"
id="rect4300"
style="color:#000000;display:inline;overflow:visible;visibility:visible;fill:#eeeeec;stroke:#2e3436;stroke-width:1.99999988;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate" />
<rect
style="fill:#d3d7cf;fill-opacity:1;stroke:#ffffff;stroke-width:1.99999976;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect4302"
width="22"
height="6"
x="23"
y="53" />
</g>
<g
id="g4269"
transform="translate(89.959784,44.76323)">
<path
inkscape:connector-curvature="0"
d="m -51.570223,-24.594651 c -9.673905,0 -20.960132,6.23975 -25.797084,18.7192692 4.836952,9.359651 14.510857,15.599401 25.797084,15.599401 11.286237,0 20.960142,-6.23975 25.797094,-15.599401 -4.836952,-12.4795192 -16.123179,-18.7192692 -25.797094,-18.7192692 z m 0,31.1987862 c -9.673905,0 -17.73549,-6.23975001 -19.34781,-12.479517 1.61232,-6.2397512 9.673905,-12.4795192 19.34781,-12.4795192 9.673915,0 17.7355,6.239768 19.34782,12.4795192 -1.61232,6.23976699 -9.673905,12.479517 -19.34782,12.479517 z m 0,-21.8391522 c -1.007692,0 -1.914621,0.194993 -2.821549,0.438734 1.662698,0.731222 2.821549,2.339912 2.821549,4.241091 0,2.5836552 -2.166544,4.6798102 -4.836953,4.6798102 -1.965006,0 -3.627715,-1.121208 -4.383483,-2.729881 -0.251923,0.877467 -0.453469,1.754917 -0.453469,2.729881 0,5.16730599 4.333107,9.359651 9.673905,9.359651 5.340808,0 9.673915,-4.19234501 9.673915,-9.359651 0,-5.1672922 -4.333107,-9.3596352 -9.673915,-9.3596352 z"
id="path3599" />
<path
inkscape:connector-curvature="0"
id="path3630"
d="m -53.259637,6.4675682 c -4.354874,-0.463793 -8.192835,-1.869112 -11.411619,-4.178511 -2.536745,-1.82005201 -5.046299,-4.9198 -5.861666,-7.240204 -0.309115,-0.879688 -0.308248,-0.913841 0.04894,-1.928284 1.39318,-3.9567362 5.894877,-8.0253272 10.97742,-9.9212892 2.388118,-0.890851 4.189049,-1.243432 6.954324,-1.361503 3.700832,-0.158017 6.748099,0.39488 10.068295,1.826794 4.509958,1.945026 8.541022,5.827623 9.860413,9.4972422 l 0.343034,0.954079 -0.406823,1.087884 c -1.903008,5.08882999 -8.045412,9.656313 -14.648854,10.892867 -1.533211,0.287106 -4.793511,0.491266 -5.923465,0.370925 z m 3.944714,-3.168696 c 3.268532,-0.752696 6.040924,-3.25030901 7.009108,-6.314414 0.74188,-2.347903 0.609807,-4.448295 -0.422862,-6.724951 -1.727573,-3.8086552 -5.799065,-6.0001952 -10.098702,-5.4357712 -0.713226,0.09362 -1.36028,0.238742 -1.437897,0.322477 -0.07761,0.08374 0.205724,0.373163 0.629646,0.643172 2.40184,1.529797 2.621108,4.9303232 0.448249,6.9517122 -2.087088,1.941597 -5.735326,1.528636 -7.161292,-0.810623 -0.190194,-0.312008 -0.397714,-0.56753 -0.461157,-0.567826 -0.184558,-8.66e-4 -0.490195,1.808374 -0.485585,2.874447 0.0097,2.22833 0.762415,4.123494 2.376571,5.98316799 2.345137,2.70183501 6.063739,3.89386201 9.603921,3.07860901 z"
style="opacity:0.55800003;fill:#ffffff;stroke:#ed1521;stroke-width:0.18025407;stroke-opacity:1" />
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 22 KiB

View File

@ -48,7 +48,8 @@ def resolveAssembly(obj):
# For faking selection obtained from Gui.getSelectionEx()
Selection = namedtuple('AsmSelection',('Object','SubElementNames'))
_IgnoredProperties = set(['Visibility', 'Label', '_LinkRecomputed'])
_IgnoredProperties = set(['VisibilityList','Visibility',
'Label','_LinkRecomputed'])
class AsmBase(object):
def __init__(self):
@ -130,6 +131,7 @@ class AsmGroup(AsmBase):
self.Object.setPropertyStatus('GroupMode','Transient')
self.Object.setPropertyStatus('Group','Hidden')
self.Object.setPropertyStatus('Group','Immutable')
self.Object.setPropertyStatus('VisibilityList','Output')
def attach(self,obj):
obj.addProperty("App::PropertyLinkList","Group","Base",'')
@ -150,10 +152,9 @@ class ViewProviderAsmGroup(ViewProviderAsmBase):
class ViewProviderAsmGroupOnTop(ViewProviderAsmGroup):
def attach(self,vobj):
super(ViewProviderAsmGroupOnTop,self).attach(vobj)
def __init__(self,vobj):
vobj.OnTopWhenSelected = 2
super(ViewProviderAsmGroupOnTop,self).__init__(vobj)
class AsmPartGroup(AsmGroup):
def __init__(self,parent):
@ -474,6 +475,11 @@ class ViewProviderAsmElement(ViewProviderAsmOnTop):
vobj.PointSize = 8
super(ViewProviderAsmElement,self).__init__(vobj)
def attach(self,vobj):
super(ViewProviderAsmElement,self).attach(vobj)
if gui.AsmCmdManager.AutoElementVis:
vobj.OnTopWhenSelected = 2
def getDefaultColor(self):
return (60.0/255.0,1.0,1.0)
@ -782,8 +788,11 @@ class AsmElementLink(AsmBase):
ViewProviderAsmElementLink(link.ViewObject)
info.Constraint.setLink({-1:link})
link.Proxy.setLink(info.Owner,info.Subname)
if not gui.AsmCmdManager.AutoElementVis:
info.Constraint.setElementVisible(link.Name,False)
return link
def setPlacement(part,pla):
AsmElementLink.setPlacement(part,pla)
@ -795,6 +804,11 @@ class ViewProviderAsmElementLink(ViewProviderAsmOnTop):
vobj.ShapeMaterial.EmissiveColor = self.getDefaultColor()
super(ViewProviderAsmElementLink,self).__init__(vobj)
def attach(self,vobj):
super(ViewProviderAsmElementLink,self).attach(vobj)
if gui.AsmCmdManager.AutoElementVis:
vobj.OnTopWhenSelected = 2
def getDefaultColor(self):
return (1.0,60.0/255.0,60.0/255.0)
@ -855,9 +869,13 @@ class AsmConstraint(AsmGroup):
def linkSetup(self,obj):
self.elements = None
super(AsmConstraint,self).linkSetup(obj)
obj.setPropertyStatus('VisibilityList','Output')
for o in obj.Group:
group = obj.Group
for o in group:
getProxy(o,AsmElementLink).parent = self
if gui.AsmCmdManager.AutoElementVis:
obj.setPropertyStatus('VisibilityList','-Immutable')
obj.VisibilityList = [False]*len(group)
obj.setPropertyStatus('VisibilityList','Immutable')
Constraint.attach(obj)
obj.recompute()
@ -1040,6 +1058,11 @@ class AsmConstraint(AsmGroup):
class ViewProviderAsmConstraint(ViewProviderAsmGroup):
def attach(self,vobj):
super(ViewProviderAsmConstraint,self).attach(vobj)
if gui.AsmCmdManager.AutoElementVis:
vobj.OnTopWhenSelected = 2
def getIcon(self):
return Constraint.getIcon(self.ViewObject.Object)
@ -1092,7 +1115,6 @@ class AsmConstraintGroup(AsmGroup):
def linkSetup(self,obj):
super(AsmConstraintGroup,self).linkSetup(obj)
obj.setPropertyStatus('VisibilityList','Output')
for o in obj.Group:
cstr = getProxy(o,AsmConstraint)
if cstr:
@ -1122,7 +1144,6 @@ class AsmElementGroup(AsmGroup):
def linkSetup(self,obj):
super(AsmElementGroup,self).linkSetup(obj)
obj.setPropertyStatus('VisibilityList','Output')
for o in obj.Group:
getProxy(o,AsmElement).parent = self
obj.cacheChildLabel()
@ -1330,7 +1351,6 @@ class Assembly(AsmGroup):
self.partArrays = set()
obj.configLinkProperty('Placement')
super(Assembly,self).linkSetup(obj)
obj.setPropertyStatus('VisibilityList','Output')
System.attach(obj)
self.onChanged(obj,'BuildShape')
@ -1741,3 +1761,4 @@ class ViewProviderAsmWorkPlane(ViewProviderAsmBase):
def setDisplayMode(self, mode):
return mode

74
gui.py
View File

@ -5,31 +5,75 @@ from .proxy import ProxyType
from .FCADLogger import FCADLogger
class SelectionObserver:
def __init__(self, cmds):
def __init__(self):
self._attached = False
self.cmds = []
self.elements = set()
self.attach()
def setCommands(self,cmds):
self.cmds = cmds
def onChanged(self):
for cmd in self.cmds:
cmd.checkActive()
def addSelection(self,*_args):
self.onChanged()
def setElementVisible(self,docname,objname,subname,vis):
if not AsmCmdManager.AutoElementVis:
self.elements.clear()
return
from .assembly import isTypeOf,AsmConstraint,AsmElement,AsmElementLink
obj = FreeCAD.getDocument(docname).getObject(objname)
if not obj:
return
sobj = obj.getSubObject(subname,1)
if isTypeOf(sobj,(AsmElement,AsmElementLink)):
sobj.Proxy.parent.Object.setElementVisible(sobj.Name,vis)
elif isTypeOf(sobj,AsmConstraint):
vis = [vis] * len(sobj.Group)
sobj.setPropertyStatus('VisibilityList','-Immutable')
sobj.VisibilityList = vis
sobj.setPropertyStatus('VisibilityList','Immutable')
else:
return
if vis:
self.elements.add((docname,objname,subname))
FreeCADGui.Selection.updateSelection(obj,subname)
elif self.elements:
logger.catchTrace('',self.elements.remove,(docname,objname,subname))
def removeSelection(self,*_args):
def resetElementVisible(self):
elements = list(self.elements)
self.elements.clear()
for docname,objname,subname in elements:
self.setElementVisible(docname,objname,subname,False)
def addSelection(self,docname,objname,subname,_pos):
self.onChanged()
self.setElementVisible(docname,objname,subname,True)
def removeSelection(self,docname,objname,subname):
self.onChanged()
self.setElementVisible(docname,objname,subname,False)
def setSelection(self,*_args):
self.onChanged()
if AsmCmdManager.AutoElementVis:
self.resetElementVisible()
for sel in FreeCADGui.Selection.getSelectionEx('*',False):
for sub in sel.SubElementNames:
self.setElementVisible(sel.Object.Document.Name,
sel.Object.Name,sub,True)
def clearSelection(self,*_args):
for cmd in self.cmds:
cmd.onClearSelection()
self.resetElementVisible()
def attach(self):
logger.trace('attach selection aboserver {}'.format(self._attached))
if not self._attached:
FreeCADGui.Selection.addObserver(self)
FreeCADGui.Selection.addObserver(self,False)
self._attached = True
self.onChanged()
@ -224,6 +268,26 @@ class AsmCmdAutoRecompute(AsmCmdCheckable):
_iconName = 'Assembly_AutoRecompute.svg'
_saveParam = True
class AsmCmdAutoElementVis(AsmCmdCheckable):
_id = 9
_menuText = 'Auto element visibility'
_iconName = 'Assembly_AutoElementVis.svg'
_saveParam = True
@classmethod
def Activated(cls,checked):
super(AsmCmdAutoElementVis,cls).Activated(checked)
from .assembly import isTypeOf,AsmConstraint,AsmElement,AsmElementLink
visible = not checked
for doc in FreeCAD.listDocuments().values():
for obj in doc.Objects:
if isTypeOf(obj,AsmConstraint):
obj.ViewObject.OnTopWhenSelected = 2 if checked else 0
elif isTypeOf(obj,(AsmElementLink,AsmElement)):
vis = visible and not isTypeOf(obj,AsmElement)
obj.Proxy.parent.Object.setElementVisible(obj.Name,vis)
obj.ViewObject.OnTopWhenSelected = 2
class AsmCmdAddWorkplane(AsmCmdBase):
_id = 8
_menuText = 'Add workplane'

View File

@ -15,19 +15,19 @@ class Assembly3Workbench(FreeCADGui.Workbench):
MenuText = 'Assembly 3'
Icon = utils.addIconToFCAD('AssemblyWorkbench.svg')
from .gui import SelectionObserver
_observer = SelectionObserver()
def __init__(self):
self.observer = None
self.docObserver = None
def Activated(self):
self.observer.attach()
FreeCAD.addDocumentObserver(self.docObserver)
from .gui import AsmCmdManager
for cmd in AsmCmdManager.getInfo().Types:
cmd.workbenchActivated()
def Deactivated(self):
self.observer.detach()
FreeCAD.removeDocumentObserver(self.docObserver)
from .gui import AsmCmdManager
for cmd in AsmCmdManager.getInfo().Types:
@ -43,7 +43,7 @@ class Assembly3Workbench(FreeCADGui.Workbench):
for name,cmds in AsmCmdManager.Menus.items():
cmdSet.update(cmds)
self.appendMenu(name,[cmd.getName() for cmd in cmds])
self.observer = SelectionObserver(cmdSet)
self._observer.setCommands(cmdSet)
self.docObserver = AsmDocumentObserver()
# FreeCADGui.addPreferencePage(
# ':/assembly3/ui/assembly3_prefs.ui','Assembly3')