Resolve "Предикат стабильности"

This commit is contained in:
IDONTSUDO 2023-07-04 07:57:09 +00:00 committed by Igor Brylyov
parent 247c84d718
commit 5239e6d091
12 changed files with 1188 additions and 1 deletions

View file

@ -0,0 +1,4 @@
import os
from .version import __version__
ICONPATH = os.path.join(os.path.dirname(__file__), "resources")

View file

@ -0,0 +1,89 @@
import os
import FreeCADGui as Gui
import FreeCAD as App
from PySide.QtCore import QT_TRANSLATE_NOOP
import shutil
ICONPATH = os.path.join(os.path.dirname(__file__), "resources")
zone = "StabilityZone"
import requests
import importOBJ
class AddStabilityZone:
def __init__(self):
pass
def GetResources(self):
return {'Pixmap': os.path.join(ICONPATH, "stability_zone.svg"),
'Accel': "Ctrl+A",
'MenuText': QT_TRANSLATE_NOOP("My_Command", "My Command"),
'ToolTip': QT_TRANSLATE_NOOP("My_Command", "Runs my command in the active document")}
def Activated(self):
App.ActiveDocument.addObject("Part::Box", "Box")
App.ActiveDocument.ActiveObject.Label = zone
selected_object = App.ActiveDocument.getObjectsByLabel(zone)[0]
selected_object.ViewObject.Transparency = 50
selected_object.ViewObject.ShapeColor = (0.15, 0.80, 0.50)
pass
def IsActive(self):
return True
class SyncServer:
httpURL = None
def __init__(self, httpURL):
self.httpURL = httpURL
def GetResources(self):
return {'Pixmap': os.path.join(ICONPATH, "server_sync.svg"),
'Accel': "Ctrl+A",
'MenuText': QT_TRANSLATE_NOOP("My_Command", "My Command"),
'ToolTip': QT_TRANSLATE_NOOP("My_Command", "Runs my command in the active document")}
def Activated(self):
StabilityZone = App.ActiveDocument.getObjectsByLabel(zone)
dir_path = os.path.dirname(os.path.realpath(__file__))
dir_out = dir_path + '/out/'
if not os.path.exists(dir_out):
os.makedirs(dir_out)
importOBJ.export(StabilityZone, u"" + dir_out + 'StabilityZone.obj')
shutil.make_archive(dir_out + '/' + 'geometry', 'zip',)
zipArch = dir_out + 'geometry.zip'
requests.post(url=self.httpURL, files={'zip': open(zipArch, "rb")})
shutil.rmtree(dir_out)
pass
def IsActive(self):
return True
class StabilityWorkbench(Gui.Workbench):
MenuText = "stability workbench"
ToolTip = "a simple template workbench"
Icon = os.path.join(ICONPATH, "template_resource.svg")
toolbox = ['AddStabilityZone', 'SyncServer']
httpURL = None
def __init__(self,httpURL):
self.httpURL = httpURL
def GetClassName(self):
return "Gui::PythonWorkbench"
def Initialize(self):
Gui.addCommand('AddStabilityZone', AddStabilityZone())
Gui.addCommand('SyncServer', SyncServer(
self.httpURL))
self.appendToolbar("Tools", self.toolbox)
self.appendMenu("Tools", self.toolbox)
def Activated(self):
pass
def Deactivated(self):
pass

View file

@ -0,0 +1,4 @@
import numpy as np
def my_foo(value):
return np.sqrt(value)

View file

@ -0,0 +1,134 @@
<?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="64"
height="64"
id="svg2985"
version="1.1"
inkscape:version="0.48.5 r10040"
sodipodi:docname="button_valid.svg">
<defs
id="defs2987">
<linearGradient
inkscape:collect="always"
id="linearGradient3774">
<stop
style="stop-color:#4e9a06;stop-opacity:1"
offset="0"
id="stop3776" />
<stop
style="stop-color:#8ae234;stop-opacity:1"
offset="1"
id="stop3778" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4082"
id="linearGradient3922-0"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(-0.56091264,-0.498646,0.48035179,-0.58227539,-177.89813,269.15635)"
x1="10.387"
y1="453.77875"
x2="56.319412"
y2="483.99524" />
<linearGradient
id="linearGradient4082">
<stop
id="stop4084"
offset="0"
style="stop-color:#4e9a06;stop-opacity:1" />
<stop
id="stop4086"
offset="1"
style="stop-color:#8ae234;stop-opacity:1" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3774"
id="linearGradient3780"
x1="30"
y1="-2"
x2="26"
y2="-26"
gradientUnits="userSpaceOnUse" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3774"
id="linearGradient2999"
gradientUnits="userSpaceOnUse"
x1="30"
y1="-2"
x2="26"
y2="-26" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="15.696216"
inkscape:cx="42.681569"
inkscape:cy="45.101596"
inkscape:current-layer="g2995"
showgrid="true"
inkscape:grid-bbox="true"
inkscape:document-units="px"
inkscape:window-width="1600"
inkscape:window-height="837"
inkscape:window-x="0"
inkscape:window-y="27"
inkscape:window-maximized="1">
<inkscape:grid
type="xygrid"
id="grid2983"
empspacing="2"
visible="true"
enabled="true"
snapvisiblegridlinesonly="true" />
</sodipodi:namedview>
<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></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
id="layer1"
inkscape:label="Layer 1"
inkscape:groupmode="layer"
transform="translate(0,48)">
<g
id="g2995"
transform="matrix(1.2252683,0,0,1.2252683,-6.3014179,2.4330891)">
<path
sodipodi:nodetypes="ccccccc"
inkscape:connector-curvature="0"
id="path4088"
d="m 15.48076,-21.246576 10.519239,10.519232 21.038474,-21.038464 7.889428,7.889424 L 25.999999,5.0515065 7.5913312,-13.357152 z"
style="fill:url(#linearGradient2999);fill-opacity:1;stroke:#172a04;stroke-width:1.63229537;stroke-linecap:butt;stroke-linejoin:round;stroke-opacity:1" />
<path
sodipodi:nodetypes="ccccccc"
inkscape:connector-curvature="0"
id="path3004"
d="M 9.9510978,-13.350403 15.477822,-18.889628 26,-8.4375583 47.031855,-29.448573 52.57108,-23.872581 26,2.7352662 z"
style="fill:none;stroke:#8ae234;stroke-width:1.63229549;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 4.1 KiB

View file

@ -0,0 +1,142 @@
<?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="svg6248"
height="64px"
width="64px">
<defs
id="defs6250">
<linearGradient
id="linearGradient3253">
<stop
id="stop3255"
offset="0"
style="stop-color:#89d5f8;stop-opacity:1;" />
<stop
id="stop3257"
offset="1"
style="stop-color:#00899e;stop-opacity:1;" />
</linearGradient>
<linearGradient
id="linearGradient6816">
<stop
id="stop6818"
offset="0"
style="stop-color:#000000;stop-opacity:1;" />
<stop
id="stop6820"
offset="1"
style="stop-color:#000000;stop-opacity:0;" />
</linearGradient>
<linearGradient
id="linearGradient6781">
<stop
id="stop6783"
offset="0"
style="stop-color:#ffffff;stop-opacity:1;" />
<stop
id="stop6785"
offset="1"
style="stop-color:#3465a4;stop-opacity:0;" />
</linearGradient>
<radialGradient
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.1581633,0,0,0.6558985,-7.29237,16.126077)"
r="25.198714"
fy="51.929391"
fx="33.369828"
cy="51.929391"
cx="33.369828"
id="radialGradient6822"
xlink:href="#linearGradient6816" />
<radialGradient
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.9724373,-0.105657,5.0523169e-2,0.4650009,-0.3519546,9.5854384)"
r="27.986705"
fy="17.013988"
fx="18.417862"
cy="17.013988"
cx="18.417862"
id="radialGradient3259"
xlink:href="#linearGradient3253" />
<radialGradient
r="27.986705"
fy="17.013988"
fx="18.417862"
cy="17.013988"
cx="18.417862"
gradientTransform="matrix(0.9724373,-0.105657,0.05052317,0.4650009,-0.3519546,9.5854384)"
gradientUnits="userSpaceOnUse"
id="radialGradient3270"
xlink:href="#linearGradient3253" />
</defs>
<metadata
id="metadata6253">
<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">
<g
transform="matrix(-1,0,0,0.99363058,4,0.0382165)"
id="g3913-7">
<path
style="fill:none;stroke:#042a2a;stroke-width:6.01919985;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:6.01920039"
d="M -55,47.282051 -28,35.564103 -28,4.974359 -55,16.692308 z"
id="path3003-5-3-0" />
<path
style="fill:none;stroke:#16d0d2;stroke-width:2.00640011;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:6.01920003"
d="M -55,47.282051 -28,35.564103 -28,4.974359 -55,16.692308 z"
id="path3003-5-3-1-9" />
</g>
<g
transform="translate(60,0)"
id="g3913">
<path
style="fill:none;stroke:#042a2a;stroke-width:6;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:6"
d="M -55,47.307692 -28,35.615385 -28,5 -55,16.692308 z"
id="path3003-5-3" />
<path
style="fill:none;stroke:#16d0d2;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:6"
d="M -55,47.307692 -28,35.615385 -28,5 -55,16.692308 z"
id="path3003-5-3-1" />
</g>
<path
id="path3003"
d="M 32,59 5,47.307692 5,16.692308 32,28.384615 z"
style="fill:none;stroke:#042a2a;stroke-width:6;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
<path
id="path3003-5"
d="M 32,59 59,47.307692 59,16.692308 32,28.384615 z"
style="fill:none;stroke:#042a2a;stroke-width:6;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
<path
id="path3003-2-2"
d="M 59,16.692308 32,28.384615 5,16.692308 32,5 z"
style="fill:none;stroke:#042a2a;stroke-width:6;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
<path
id="path3003-3"
d="M 32,59 5,47.307692 5,16.692308 32,28.384615 z"
style="fill:none;stroke:#16d0d2;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
<path
id="path3003-5-6"
d="M 32,59 59,47.307692 59,16.692308 32,28.384615 z"
style="fill:none;stroke:#16d0d2;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
<path
id="path3003-2"
d="M 59,16.692308 32,28.384615 5,16.692308 32,5 z"
style="fill:none;stroke:#34e0e2;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 5.4 KiB

View file

@ -0,0 +1,166 @@
<?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:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.1"
width="64.1875"
height="64.1875"
id="svg3799"
inkscape:version="0.91 r13725"
sodipodi:docname="my_resources.svg">
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1855"
inkscape:window-height="1056"
id="namedview3241"
showgrid="false"
inkscape:zoom="3.2883564"
inkscape:cx="103.51645"
inkscape:cy="-10.131949"
inkscape:window-x="65"
inkscape:window-y="24"
inkscape:window-maximized="1"
inkscape:current-layer="svg3799" />
<defs
id="defs3801">
<marker
refX="0"
refY="0"
orient="auto"
id="EmptyTriangleOutL"
style="overflow:visible">
<path
d="m 5.77,0 -8.65,5 0,-10 8.65,5 z"
transform="matrix(0.8,0,0,0.8,-4.8,0)"
id="path4487"
style="fill:#ffffff;fill-rule:evenodd;stroke:#000000;stroke-width:1pt" />
</marker>
<marker
refX="0"
refY="0"
orient="auto"
id="DotS"
style="overflow:visible">
<path
d="m -2.5,-1 c 0,2.76 -2.24,5 -5,5 -2.76,0 -5,-2.24 -5,-5 0,-2.76 2.24,-5 5,-5 2.76,0 5,2.24 5,5 z"
transform="matrix(0.2,0,0,0.2,1.48,0.2)"
id="path4394"
style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt" />
</marker>
<marker
refX="0"
refY="0"
orient="auto"
id="DotL"
style="overflow:visible">
<path
d="m -2.5,-1 c 0,2.76 -2.24,5 -5,5 -2.76,0 -5,-2.24 -5,-5 0,-2.76 2.24,-5 5,-5 2.76,0 5,2.24 5,5 z"
transform="matrix(0.8,0,0,0.8,5.92,0.8)"
id="path4388"
style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt" />
</marker>
<marker
refX="0"
refY="0"
orient="auto"
id="Tail"
style="overflow:visible">
<g
transform="scale(-1.2,-1.2)"
id="g4363">
<path
d="M -3.8048674,-3.9585227 0.54352094,0"
id="path4365"
style="fill:none;stroke:#000000;stroke-width:0.80000001;stroke-linecap:round" />
<path
d="M -1.2866832,-3.9585227 3.0617053,0"
id="path4367"
style="fill:none;stroke:#000000;stroke-width:0.80000001;stroke-linecap:round" />
<path
d="M 1.3053582,-3.9585227 5.6537466,0"
id="path4369"
style="fill:none;stroke:#000000;stroke-width:0.80000001;stroke-linecap:round" />
<path
d="M -3.8048674,4.1775838 0.54352094,0.21974226"
id="path4371"
style="fill:none;stroke:#000000;stroke-width:0.80000001;stroke-linecap:round" />
<path
d="M -1.2866832,4.1775838 3.0617053,0.21974226"
id="path4373"
style="fill:none;stroke:#000000;stroke-width:0.80000001;stroke-linecap:round" />
<path
d="M 1.3053582,4.1775838 5.6537466,0.21974226"
id="path4375"
style="fill:none;stroke:#000000;stroke-width:0.80000001;stroke-linecap:round" />
</g>
</marker>
<marker
refX="0"
refY="0"
orient="auto"
id="Arrow1Sstart"
style="overflow:visible">
<path
d="M 0,0 5,-5 -12.5,0 5,5 0,0 z"
transform="matrix(0.2,0,0,0.2,1.2,0)"
id="path4339"
style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt" />
</marker>
<marker
refX="0"
refY="0"
orient="auto"
id="Arrow1Lstart"
style="overflow:visible">
<path
d="M 0,0 5,-5 -12.5,0 5,5 0,0 z"
transform="matrix(0.8,0,0,0.8,10,0)"
id="path4327"
style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt" />
</marker>
</defs>
<metadata
id="metadata3804">
<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>
<rect
style="fill:none;stroke:#ff0000;stroke-width:10"
id="rect4592"
width="43.182667"
height="47.440113"
x="10.643615"
y="8.2324944" />
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:40px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
x="19.766714"
y="45.637199"
id="text4594"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan4596"
x="19.766714"
y="45.637199">T</tspan></text>
</svg>

After

Width:  |  Height:  |  Size: 5.2 KiB

View file

@ -0,0 +1 @@
__version__ = "0.8.1"