adding checking3Dmodels plugin
This commit is contained in:
@ -12,3 +12,5 @@ from . import PcbToDxf
|
||||
|
||||
from . import Snap2Grid
|
||||
|
||||
from . import checking3Dmodels
|
||||
|
||||
|
2
checking3Dmodels/__init__.py
Normal file
2
checking3Dmodels/__init__.py
Normal file
@ -0,0 +1,2 @@
|
||||
from .model3d_list import checkMissing3Dmodels
|
||||
checkMissing3Dmodels().register()
|
BIN
checking3Dmodels/missing3dmodels.png
Normal file
BIN
checking3Dmodels/missing3dmodels.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
296
checking3Dmodels/missing3dmodels.svg
Normal file
296
checking3Dmodels/missing3dmodels.svg
Normal file
@ -0,0 +1,296 @@
|
||||
<?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"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
inkscape:export-ydpi="118.15385"
|
||||
inkscape:export-xdpi="118.15385"
|
||||
inkscape:export-filename="C:\Users\userC\AppData\Roaming\kicad\scripting\plugins\kicad-action-tools\checking3Dmodels\missing3dmodels.png"
|
||||
height="26"
|
||||
width="26"
|
||||
version="1.1"
|
||||
id="svg2"
|
||||
inkscape:version="1.0beta2 (c8d5c0e, 2020-01-08)"
|
||||
sodipodi:docname="missing3dmodels.svg">
|
||||
<metadata
|
||||
id="metadata28">
|
||||
<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>
|
||||
<sodipodi:namedview
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1"
|
||||
objecttolerance="10"
|
||||
gridtolerance="10"
|
||||
guidetolerance="10"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="1010"
|
||||
id="namedview26"
|
||||
showgrid="true"
|
||||
inkscape:zoom="10.865385"
|
||||
inkscape:cx="-3.6215668"
|
||||
inkscape:cy="9.4767812"
|
||||
inkscape:window-x="-7"
|
||||
inkscape:window-y="-7"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="svg2"
|
||||
inkscape:document-rotation="0">
|
||||
<inkscape:grid
|
||||
type="xygrid"
|
||||
id="grid3005"
|
||||
empspacing="2"
|
||||
visible="true"
|
||||
enabled="true"
|
||||
snapvisiblegridlinesonly="true" />
|
||||
</sodipodi:namedview>
|
||||
<defs
|
||||
id="defs4">
|
||||
<linearGradient
|
||||
id="linearGradient3840">
|
||||
<stop
|
||||
style="stop-color:#ffffff;stop-opacity:1;"
|
||||
offset="0"
|
||||
id="stop3842" />
|
||||
<stop
|
||||
id="stop3844"
|
||||
offset="0.09375"
|
||||
style="stop-color:#4d4d4d;stop-opacity:1" />
|
||||
<stop
|
||||
id="stop3846"
|
||||
offset="0.1875"
|
||||
style="stop-color:#000000;stop-opacity:1" />
|
||||
<stop
|
||||
id="stop3848"
|
||||
offset="0.28125"
|
||||
style="stop-color:#4d4d4d;stop-opacity:1" />
|
||||
<stop
|
||||
id="stop3850"
|
||||
offset="0.93556416"
|
||||
style="stop-color:#4d4d4d;stop-opacity:1" />
|
||||
<stop
|
||||
style="stop-color:#999999;stop-opacity:1"
|
||||
offset="1"
|
||||
id="stop3852" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
id="linearGradient3824">
|
||||
<stop
|
||||
style="stop-color:#ffffff;stop-opacity:0"
|
||||
offset="0"
|
||||
id="stop3826" />
|
||||
<stop
|
||||
id="stop3832"
|
||||
offset="0.5"
|
||||
style="stop-color:#ffffff;stop-opacity:1" />
|
||||
<stop
|
||||
style="stop-color:#ffffff;stop-opacity:0"
|
||||
offset="1"
|
||||
id="stop3828" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
id="linearGradient3808"
|
||||
inkscape:collect="always">
|
||||
<stop
|
||||
id="stop3810"
|
||||
offset="0"
|
||||
style="stop-color:#4d4d4d;stop-opacity:1" />
|
||||
<stop
|
||||
style="stop-color:#4d4d4d;stop-opacity:1"
|
||||
offset="0.0625"
|
||||
id="stop3812" />
|
||||
<stop
|
||||
style="stop-color:#1a1a1a;stop-opacity:1"
|
||||
offset="0.1875"
|
||||
id="stop3814" />
|
||||
<stop
|
||||
style="stop-color:#4d4d4d;stop-opacity:1"
|
||||
offset="0.3125"
|
||||
id="stop3816" />
|
||||
<stop
|
||||
style="stop-color:#4d4d4d;stop-opacity:1"
|
||||
offset="0.93556416"
|
||||
id="stop3818" />
|
||||
<stop
|
||||
id="stop3820"
|
||||
offset="1"
|
||||
style="stop-color:#4d4d4d;stop-opacity:1" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
id="linearGradient3784">
|
||||
<stop
|
||||
style="stop-color:#4d4d4d;stop-opacity:1"
|
||||
offset="0"
|
||||
id="stop3786" />
|
||||
<stop
|
||||
id="stop3798"
|
||||
offset="0.0625"
|
||||
style="stop-color:#4d4d4d;stop-opacity:1" />
|
||||
<stop
|
||||
id="stop3796"
|
||||
offset="0.1875"
|
||||
style="stop-color:#000000;stop-opacity:1" />
|
||||
<stop
|
||||
id="stop3794"
|
||||
offset="0.3125"
|
||||
style="stop-color:#4d4d4d;stop-opacity:1" />
|
||||
<stop
|
||||
id="stop3792"
|
||||
offset="0.93556416"
|
||||
style="stop-color:#4d4d4d;stop-opacity:1" />
|
||||
<stop
|
||||
style="stop-color:#999999;stop-opacity:1"
|
||||
offset="1"
|
||||
id="stop3788" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
id="c"
|
||||
y2="17.729"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
x2="3.0458"
|
||||
gradientTransform="translate(0,1.4775)"
|
||||
y1="17.729"
|
||||
x1="81.898003">
|
||||
<stop
|
||||
stop-color="#cc8000"
|
||||
offset="0"
|
||||
id="stop7" />
|
||||
<stop
|
||||
stop-color="#ffed00"
|
||||
offset="1"
|
||||
id="stop9" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
id="d"
|
||||
y2="1.8468"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
x2="48.259998"
|
||||
gradientTransform="matrix(1.3537,0,0,0.73873,0,1.4775)"
|
||||
y1="33.612"
|
||||
x1="34.290001">
|
||||
<stop
|
||||
stop-color="#af7d00"
|
||||
offset="0"
|
||||
id="stop12" />
|
||||
<stop
|
||||
stop-color="#ffed00"
|
||||
offset="1"
|
||||
id="stop14" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient3784"
|
||||
id="linearGradient3790"
|
||||
x1="25.5"
|
||||
y1="17.5"
|
||||
x2="25.5"
|
||||
y2="1.5"
|
||||
gradientUnits="userSpaceOnUse" />
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient3808"
|
||||
id="linearGradient3806"
|
||||
x1="0.5"
|
||||
y1="17.5"
|
||||
x2="0.5"
|
||||
y2="1.5"
|
||||
gradientUnits="userSpaceOnUse" />
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient3824"
|
||||
id="linearGradient3830"
|
||||
x1="5.5"
|
||||
y1="9.5"
|
||||
x2="20.5"
|
||||
y2="9.5"
|
||||
gradientUnits="userSpaceOnUse" />
|
||||
</defs>
|
||||
<path
|
||||
inkscape:export-ydpi="7.0721998"
|
||||
inkscape:export-xdpi="7.0721998"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path3836"
|
||||
d="m 16.5,18 0,8"
|
||||
style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||
sodipodi:nodetypes="cc" />
|
||||
<path
|
||||
inkscape:export-ydpi="7.0721998"
|
||||
inkscape:export-xdpi="7.0721998"
|
||||
style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||
d="m 9.5,18 0,8"
|
||||
id="path3834"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="cc" />
|
||||
<path
|
||||
inkscape:export-ydpi="7.0721998"
|
||||
inkscape:export-xdpi="7.0721998"
|
||||
style="fill:#49a749;fill-opacity:1;stroke:#008000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
|
||||
d="m 27.5,19.5 -29,0 0,3 29,0 z"
|
||||
id="rect3811"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="ccccc" />
|
||||
<path
|
||||
inkscape:export-ydpi="7.0721998"
|
||||
inkscape:export-xdpi="7.0721998"
|
||||
style="fill:url(#linearGradient3790);fill-opacity:1;stroke:url(#linearGradient3806);stroke-width:1;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
|
||||
d="m 5.5,17.5 0,-1.5 1,-1.5 -1,-1.5 0,-10.5 1,-1 13,0 1,1 0,10.5 -1,1.5 1,1.5 0,1.5 z"
|
||||
id="path3782"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="ccccccccccccc" />
|
||||
<path
|
||||
inkscape:export-ydpi="7.0721998"
|
||||
inkscape:export-xdpi="7.0721998"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path3822"
|
||||
d="m 5.5,17.5 0,-1.5 1,-1.5 -1,-1.5 0,-10.5 1,-1 13,0 1,1 0,10.5 -1,1.5 1,1.5 0,1.5 z"
|
||||
style="opacity:0.323741;fill:url(#linearGradient3830);fill-opacity:1;stroke:none"
|
||||
sodipodi:nodetypes="ccccccccccccc" />
|
||||
<path
|
||||
inkscape:export-ydpi="7.0721998"
|
||||
inkscape:export-xdpi="7.0721998"
|
||||
style="fill:#999999;stroke:none"
|
||||
d="m 8,23 1,1 1,0 1,-1 z"
|
||||
id="path3877"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="ccccc" />
|
||||
<path
|
||||
inkscape:export-ydpi="7.0721998"
|
||||
inkscape:export-xdpi="7.0721998"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path3879"
|
||||
d="m 15,23 1,1 1,0 1,-1 z"
|
||||
style="fill:#999999;stroke:none"
|
||||
sodipodi:nodetypes="ccccc" />
|
||||
<path
|
||||
inkscape:export-ydpi="7.0721998"
|
||||
inkscape:export-xdpi="7.0721998"
|
||||
sodipodi:nodetypes="ccccccccccscsccccccscc"
|
||||
style="fill:#ff0000"
|
||||
inkscape:connector-curvature="0"
|
||||
d="m 19.55311,6.4757 c 1.987453,0 3.309839,0.5074 4.451588,1.3507 0.761129,0.5719 1.141693,1.2578 1.141747,2.0581 -1.3e-5,0.9863 -0.697711,2.0939 -2.093187,3.323 -0.253728,0.2144 -0.643905,0.5685 -1.214778,1.0401 -0.749692,0.6034 -1.316258,1.5376 -1.633404,2.6809 -0.02115,0.1 -0.04229,0.4543 -0.06343,0.5544 h -0.981107 c 0.04228,-1.1005 0.138454,-2.1928 0.73047,-3.1217 L 21,13 c 0.782553,-1.215 1.173564,-2.1863 1.173564,-3.2012 0,-0.9285 -0.423648,-1.5555 -1.459555,-2.07 -0.550093,-0.2716 -1.259503,-0.2589 -1.957428,-0.2589 -1.099113,0 -1.690084,0.132 -2.105516,0.394 -0.323103,0.2213 -0.39491,0.3895 -0.45741,0.6118 0.02154,0.2944 -0.159103,0.5061 0.262891,0.8082 0.359429,0.3287 0.539165,0.6075 0.539165,0.836 -5e-6,0.4432 -0.29601,0.7219 -0.88802,0.8362 -0.126866,0.029 -0.264291,0.043 -0.412292,0.043 -1.014857,-2e-4 -1.522312,-0.4433 -1.522312,-1.3293 -2e-6,-1.0863 0.687159,-1.9296 2.061424,-2.5298 0.888019,-0.3859 1.913428,-0.6647 3.076333,-0.6648"
|
||||
id="path3094" />
|
||||
<circle
|
||||
inkscape:export-ydpi="7.0721998"
|
||||
inkscape:export-xdpi="7.0721998"
|
||||
r="1.5"
|
||||
cy="20.969181"
|
||||
cx="19.63533"
|
||||
id="path4212"
|
||||
style="opacity:0.8;fill:#ff0000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
|
||||
</svg>
|
After Width: | Height: | Size: 9.9 KiB |
215
checking3Dmodels/model3d_list.py
Normal file
215
checking3Dmodels/model3d_list.py
Normal file
@ -0,0 +1,215 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# A script to checking 3D models in kicad_pcb
|
||||
# requirements: KiCAD pcbnew >= 4.0
|
||||
# release "1.0.0"
|
||||
# copyright https://github.com/MitjaNemec
|
||||
# copyright Maurice easyw
|
||||
#
|
||||
# main script from https://forum.kicad.info/t/report-that-lists-step-models/29594/5
|
||||
#
|
||||
#
|
||||
|
||||
### plugins errors
|
||||
#import pcbnew
|
||||
#pcbnew.GetWizardsBackTrace()
|
||||
|
||||
|
||||
___version___="1.0.0"
|
||||
#wx.LogMessage("My message")
|
||||
#mm_ius = 1000000.0
|
||||
|
||||
import sys, os
|
||||
import pcbnew
|
||||
import datetime
|
||||
import wx
|
||||
from pcbnew import *
|
||||
import base64
|
||||
from wx.lib.embeddedimage import PyEmbeddedImage
|
||||
from sys import platform as _platform
|
||||
|
||||
"""
|
||||
execfile (r"C:\Users\userC\AppData\Roaming\kicad\scripting\plugins\model3d-list.py")
|
||||
"""
|
||||
|
||||
import pcbnew
|
||||
import os.path
|
||||
|
||||
def check3D():
|
||||
import os
|
||||
|
||||
|
||||
# board = pcbnew.LoadBoard(r'C:\Cad\Project_K\testboard.kicad_pcb')
|
||||
my_board = pcbnew.GetBoard()
|
||||
fileName = pcbnew.GetBoard().GetFileName()
|
||||
|
||||
dirpath = os.path.abspath(os.path.expanduser(fileName))
|
||||
path, fname = os.path.split(dirpath)
|
||||
ext = os.path.splitext(os.path.basename(fileName))[1]
|
||||
name = os.path.splitext(os.path.basename(fileName))[0]
|
||||
#wx.LogMessage(dir)
|
||||
#lsep=os.linesep
|
||||
lsep='\n'
|
||||
|
||||
# if running standalone (outside of pcbnew)
|
||||
if os.getenv("KISYS3DMOD") is None:
|
||||
pt_lnx = False;pt_osx = False;pt_win = False;
|
||||
if _platform == "linux" or _platform == "linux2":
|
||||
# linux
|
||||
pt_lnx = True
|
||||
default_prefix3d = '/usr/share/kicad/modules/packages3d'
|
||||
#'/usr/share/kicad/modules/packages3d'
|
||||
elif _platform == "darwin":
|
||||
#osx
|
||||
pt_osx = True
|
||||
default_prefix3d = '/Library/Application Support/kicad/packages3d'
|
||||
#/Library/Application Support/kicad/modules/packages3d/' wrong location
|
||||
else:
|
||||
# Windows
|
||||
pt_win = True
|
||||
#default_prefix3d = os.path.join(os.environ["ProgramFiles"],u'\\KiCad\\share\\kicad\\modules\\packages3d')
|
||||
default_prefix3d = (os.environ["ProgramFiles"]+u'\\KiCad\\share\\kicad\\modules\\packages3d')
|
||||
#print (default_prefix3d)
|
||||
default_prefix3d = re.sub("\\\\", "/", default_prefix3d) #default_prefix3d.replace('\\','/')
|
||||
#print (default_prefix3d)
|
||||
|
||||
os.environ["KISYS3DMOD"] = os.path.normpath(default_prefix3d)
|
||||
if os.getenv("KIPRJMOD") is None:
|
||||
os.environ["KIPRJMOD"] = os.path.abspath(os.path.dirname(my_board.GetFileName()))
|
||||
|
||||
# prepare folder for 3Dmodels
|
||||
proj_path = os.path.dirname(os.path.abspath(my_board.GetFileName()))
|
||||
out_filename_missing_3D_models=proj_path+os.sep+name+"_missing3Dmodels.txt"
|
||||
|
||||
# get all footprints
|
||||
footprints = my_board.GetModules()
|
||||
fp_without_models = []
|
||||
|
||||
# go through all the footprints
|
||||
for fp in footprints:
|
||||
fp_ref = fp.GetReference()
|
||||
|
||||
# for each footprint get all 3D models
|
||||
fp_models = fp.Models()
|
||||
|
||||
# for each 3D model find it's path
|
||||
for model in fp_models:
|
||||
model_path = model.m_Filename
|
||||
|
||||
# check if path is encoded with variables
|
||||
if "${" in model_path or "$(" in model_path:
|
||||
# get environment variable name
|
||||
start_index = model_path.find("${") + 2 or model_path.find("$(") + 2
|
||||
end_index = model_path.find("}") or model_path.find(")")
|
||||
env_var = model_path[start_index:end_index]
|
||||
|
||||
# check if variable is defined
|
||||
path = os.getenv(env_var)
|
||||
|
||||
# if variable is defined, get absolute path
|
||||
if path is not None:
|
||||
clean_model_path = os.path.normpath(path + model_path[end_index + 1:])
|
||||
# if variable is not defined, we can not find the model. Thus don't put it on the list
|
||||
else:
|
||||
print("Can not find model defined with enviroment variable:\n" + model_path)
|
||||
fp_without_models.append((fp_ref, model_path))
|
||||
continue
|
||||
# check if path is absolute or relative
|
||||
elif model_path == os.path.basename(model_path):
|
||||
clean_model_path = os.path.normpath(proj_path + "//" + model_path)
|
||||
# check if model is given with absolute path
|
||||
elif os.path.exists(model_path):
|
||||
clean_model_path = model_path
|
||||
# otherwise we don't know how to parse the path
|
||||
else:
|
||||
print("Ambiguios path for the model: " + model_path)
|
||||
# test default 3D_library location "KISYS3DMOD"
|
||||
if os.path.exists(os.path.normpath(os.path.join(os.getenv("KISYS3DMOD"), model_path))):
|
||||
clean_model_path = os.path.normpath(os.path.join(os.getenv("KISYS3DMOD"), model_path))
|
||||
print("Going with: " + clean_model_path)
|
||||
# test in project folder location
|
||||
elif os.path.exists(os.path.normpath(os.path.join(proj_path, model_path))):
|
||||
clean_model_path = os.path.normpath(os.path.join(proj_path, model_path))
|
||||
print("Going with: " + clean_model_path)
|
||||
else:
|
||||
print("Can not find model defined with path:\n" + model_path)
|
||||
fp_without_models.append((fp_ref, model_path))
|
||||
clean_model_path = None
|
||||
continue
|
||||
|
||||
model_path_without_extension = clean_model_path.rsplit('.', 1)[0]
|
||||
|
||||
found_at_least_one = False
|
||||
if clean_model_path:
|
||||
model_without_extension = clean_model_path.rsplit('.', 1)[0]
|
||||
for ext in ['.stp', '.step', '.stpZ']:
|
||||
if os.path.exists(model_without_extension + ext):
|
||||
found_at_least_one = True
|
||||
if not found_at_least_one:
|
||||
fp_without_models.append((fp.GetReference(), clean_model_path))
|
||||
|
||||
pass
|
||||
pass
|
||||
print(repr(fp_without_models))
|
||||
Header_1="### Missing 3D models - created on " + datetime.datetime.now().strftime("%Y-%m-%d %H:%M")+lsep
|
||||
Header_1+="### Printed by checking_3D_models plugin"+lsep
|
||||
#LogMsg+="## Side : All"+lsep
|
||||
Header_2="Board file: " + str(fileName)+lsep
|
||||
Header_2+="3D missing models written to:" + lsep + out_filename_missing_3D_models + lsep
|
||||
Header_2+="-------" + lsep
|
||||
content=Header_1+Header_2
|
||||
for fp in fp_without_models:
|
||||
content+=str(fp)+lsep
|
||||
content += "-------" + lsep + "NBR of 3D missing models:" + str(len(fp_without_models)) + lsep
|
||||
content += "checked extensions ['.stp', '.step', '.stpZ']"
|
||||
Header_2+="NBR of 3D missing models:" + str(len(fp_without_models))+ lsep
|
||||
# new_content = "\n".join(content)
|
||||
with open(out_filename_missing_3D_models,'w') as f_out:
|
||||
f_out.write(content)
|
||||
return Header_2
|
||||
|
||||
class checkMissing3Dmodels( pcbnew.ActionPlugin ):
|
||||
"""
|
||||
A script to checking 3D models in kicad_pcb
|
||||
requirements: KiCAD pcbnew >= 4.0
|
||||
release "1.0.0"
|
||||
"""
|
||||
|
||||
def defaults( self ):
|
||||
"""
|
||||
Method defaults must be redefined
|
||||
self.name should be the menu label to use
|
||||
self.category should be the category (not yet used)
|
||||
self.description should be a comprehensive description
|
||||
of the plugin
|
||||
"""
|
||||
self.name = "Missing 3D models \nversion "+___version___
|
||||
self.category = "Missing 3D models"
|
||||
self.description = "Missing 3D models\non kicad_pcb file"
|
||||
#self.SetIcon(PyEmbeddedImage(getPos_ico_b64_data).GetIcon())
|
||||
self.icon_file_name = os.path.join(os.path.dirname(__file__), "./missing3dmodels.png")
|
||||
self.show_toolbar_button = True
|
||||
|
||||
def Run( self ):
|
||||
_pcbnew_frame = [x for x in wx.GetTopLevelWindows() if x.GetTitle().lower().startswith('pcbnew')][0]
|
||||
check3DMissing()
|
||||
|
||||
def check3DMissing():
|
||||
|
||||
board = pcbnew.GetBoard()
|
||||
|
||||
#fileName = GetBoard().GetFileName()
|
||||
fileName = pcbnew.GetBoard().GetFileName()
|
||||
if len(fileName)==0:
|
||||
wx.MessageBox("a board needs to be saved/loaded!")
|
||||
else:
|
||||
LogMsg=''
|
||||
# msg="'get_pos.py'"+os.linesep
|
||||
msg="Missing 3D models \nversion "+___version___+os.linesep
|
||||
|
||||
#print(msg)
|
||||
LogMsg+=msg
|
||||
reply=check3D()
|
||||
LogMsg+=reply
|
||||
wx.LogMessage(LogMsg)
|
||||
|
Reference in New Issue
Block a user