Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Cura
CAD
CuraSolidworksPlugin
Commits
36963052
Commit
36963052
authored
Dec 23, 2019
by
Thomas Karl Pietrowski
Browse files
Merge branch 'master-migrate-com-self-test' into 'master'
0.6.0: Migrate COM self-test See merge request
!1
parents
fc86a5e5
d97cd16b
Pipeline
#601
failed with stage
in 28 seconds
Changes
13
Pipelines
2
Expand all
Hide whitespace changes
Inline
Side-by-side
.gitlab-ci.yml
View file @
36963052
...
...
@@ -12,7 +12,8 @@ all:
-
type:shell
script
:
-
curl https://thopiekar.eu:5443/cura-plugins/CuraPluginOven/raw/deployment/cpo.py?inline=false --output cpo.py
-
python3 ./cpo.py --create=package6 --source=./
-
python3 ./cpo.py --create=package610 --source=./
-
python3 ./cpo.py --create=package600 --source=./
-
python3 ./cpo.py --create=package5 --source=./
-
python3 ./cpo.py --create=package4 --source=./
-
python3 ./cpo.py --create=plugin4 --source=./
...
...
CadIntegrationUtils
@
1e4b40d8
Compare
48392759
...
1e4b40d8
Subproject commit
483927594720ab08b73a933e213421ed3d847fd3
Subproject commit
1e4b40d8dae2b7232321ea7abbd11f6fdd701c5e
CuraSolidWorksPlugin/SolidWorksConfiguration.qml
View file @
36963052
// Copyright (c) 2017 Ultimaker B.V.
// Copyright (c) 201
7
Thomas Karl Pietrowski
// Copyright (c) 201
9
Thomas Karl Pietrowski
import
QtQuick
2.1
import
QtQuick
.
Controls
1.4
...
...
@@ -14,7 +14,7 @@ UM.Dialog
minimumWidth
:
width
;
maximumWidth
:
width
;
height
:
Math
.
floor
(
screenScaleFactor
*
25
0
);
height
:
Math
.
floor
(
screenScaleFactor
*
18
0
);
minimumHeight
:
height
;
maximumHeight
:
height
;
...
...
@@ -24,315 +24,172 @@ UM.Dialog
{
if
(
visible
)
{
conversionTab
.
qualityDropdown
.
updateCurrentIndex
();
conversionTab
.
installations
.
updateCurrentIndex
();
conversionTab
.
showWizard
.
checked
=
manager
.
getBoolValue
(
"
show_export_settings_always
"
);
conversionTab
.
autoRotate
.
checked
=
manager
.
getBoolValue
(
"
auto_rotate
"
);
qualityDropdown
.
updateCurrentIndex
();
installations
Dropdown
.
updateCurrentIndex
();
showWizard
CheckBox
.
checked
=
manager
.
getBoolValue
(
"
show_export_settings_always
"
);
autoRotate
CheckBox
.
checked
=
manager
.
getBoolValue
(
"
auto_rotate
"
);
}
}
TabView
{
GridLayout
{
anchors.fill
:
parent
UM.I18nCatalog
{
id
:
catalog
;
name
:
"
SolidWorksPlugin
"
}
Tab
{
title
:
catalog
.
i18nc
(
"
@title:tab
"
,
"
Conversion settings
"
);
id
:
conversionTab
property
Item
showWizard
:
item
.
showWizard
property
Item
autoRotate
:
item
.
autoRotateCheckBox
property
Item
qualityDropdown
:
item
.
qualityDropdown
property
Item
qualityModel
:
item
.
choiceModel
property
Item
installations
:
item
.
installationsDropdown
GridLayout
{
Layout.fillWidth
:
true
columnSpacing
:
16
*
screenScaleFactor
rowSpacing
:
10
*
screenScaleFactor
Layout.margins
:
10
*
screenScaleFactor
columns
:
1
property
Item
showWizard
:
showWizardCheckBox
property
Item
autoRotateCheckBox
:
autoRotateCheckBox
property
Item
qualityDropdown
:
qualityDropdown
property
Item
choiceModel
:
choiceModel
property
Item
installationsDropdown
:
installationsDropdown
Row
{
width
:
parent
.
width
Label
{
text
:
catalog
.
i18nc
(
"
@label
"
,
"
First choice:
"
);
width
:
100
*
screenScaleFactor
anchors.verticalCenter
:
parent
.
verticalCenter
}
ComboBox
{
id
:
installationsDropdown
currentIndex
:
0
width
:
240
*
screenScaleFactor
//style: UM.Theme.styles.combobox_color
columns
:
1
function
ensureListWithEntries
()
{
var
versions
=
manager
.
getVersionsList
();
var
version
=
0
;
var
operational
=
true
;
model
.
clear
();
property
Item
showWizard
:
showWizardCheckBox
property
Item
autoRotateCheckBox
:
autoRotateCheckBox
property
Item
qualityDropdown
:
qualityDropdown
//property Item choiceModel: choiceModel
property
Item
installationsDropdown
:
installationsDropdown
model
.
append
({
text
:
catalog
.
i18nc
(
"
@text:menu
"
,
"
Latest installed version (Recommended)
"
),
code
:
-
1
});
for
(
var
i
=
0
;
i
<
versions
.
length
;
++
i
)
{
version
=
versions
[
i
];
operational
=
manager
.
isVersionOperational
(
version
);
if
(
operational
)
{
model
.
append
({
text
:
manager
.
getFriendlyName
(
version
),
code
:
version
});
}
}
model
.
append
({
text
:
catalog
.
i18nc
(
"
@text:menu
"
,
"
Default version
"
),
code
:
-
2
});
updateCurrentIndex
()
}
Row
{
width
:
parent
.
width
function
updateCurrentIndex
()
{
var
index
=
0
;
// Top element in the list below by default
var
currentSetting
=
manager
.
getIntValue
(
"
preferred_installation
"
);
for
(
var
i
=
0
;
i
<
model
.
count
;
++
i
)
{
if
(
model
.
get
(
i
).
code
==
currentSetting
)
{
index
=
i
;
break
;
}
}
currentIndex
=
index
;
}
Label
{
text
:
catalog
.
i18nc
(
"
@label
"
,
"
First choice:
"
);
width
:
100
*
screenScaleFactor
anchors.verticalCenter
:
parent
.
verticalCenter
}
Component.onCompleted
:
{
ensureListWithEntries
();
}
ComboBox
{
id
:
installationsDropdown
currentIndex
:
0
width
:
240
*
screenScaleFactor
function
saveInstallationCode
()
{
var
code
=
model
.
get
(
currentIndex
).
code
;
manager
.
setIntValue
(
"
preferred_installation
"
,
code
);
}
//style: UM.Theme.styles.combobox_color
model
:
ListModel
{
id
:
installationsModel
function
ensureListWithEntries
()
{
var
versions
=
manager
.
getVersionsList
();
var
version
=
0
;
var
operational
=
true
;
model
.
clear
();
Component.onCompleted
:
{
append
({
text
:
"
NONE
"
,
code
:
-
3
});
}
model
.
append
({
text
:
catalog
.
i18nc
(
"
@text:menu
"
,
"
Latest installed version (Recommended)
"
),
code
:
-
1
});
for
(
var
i
=
0
;
i
<
versions
.
length
;
++
i
)
{
version
=
versions
[
i
];
operational
=
manager
.
isVersionOperational
(
version
);
if
(
operational
)
{
model
.
append
({
text
:
manager
.
getFriendlyName
(
version
),
code
:
version
});
}
}
model
.
append
({
text
:
catalog
.
i18nc
(
"
@text:menu
"
,
"
Default version
"
),
code
:
-
2
});
updateCurrentIndex
()
}
Row
{
width
:
parent
.
width
Label
{
text
:
catalog
.
i18nc
(
"
@action:label
"
,
"
Quality:
"
)
width
:
100
*
screenScaleFactor
anchors.verticalCenter
:
parent
.
verticalCenter
}
ComboBox
function
updateCurrentIndex
()
{
var
index
=
0
;
// Top element in the list below by default
var
currentSetting
=
manager
.
getIntValue
(
"
preferred_installation
"
);
for
(
var
i
=
0
;
i
<
model
.
count
;
++
i
)
{
id
:
qualityDropdown
currentIndex
:
updateCurrentIndex
()
width
:
240
*
screenScaleFactor
function
updateCurrentIndex
()
if
(
model
.
get
(
i
).
code
==
currentSetting
)
{
var
index
=
0
;
// Top element in the list below by default
var
currentChoice
=
manager
.
getIntValue
(
"
export_quality
"
);
for
(
var
i
=
0
;
i
<
model
.
count
;
++
i
)
{
if
(
model
.
get
(
i
).
code
==
currentChoice
)
{
index
=
i
;
break
;
}
}
currentIndex
=
index
;
}
function
saveQualityCode
()
{
var
code
=
model
.
get
(
currentIndex
).
code
;
manager
.
setIntValue
(
"
export_quality
"
,
code
);
}
model
:
ListModel
{
id
:
choiceModel
Component.onCompleted
:
{
append
({
text
:
catalog
.
i18nc
(
"
@option:curaSolidworksStlQuality
"
,
"
Fine (3D-printing)
"
),
code
:
30
});
append
({
text
:
catalog
.
i18nc
(
"
@option:curaSolidworksStlQuality
"
,
"
Coarse (3D-printing)
"
),
code
:
20
});
append
({
text
:
catalog
.
i18nc
(
"
@option:curaSolidworksStlQuality
"
,
"
Fine (SolidWorks)
"
),
code
:
10
});
append
({
text
:
catalog
.
i18nc
(
"
@option:curaSolidworksStlQuality
"
,
"
Coarse (SolidWorks)
"
),
code
:
0
});
append
({
text
:
catalog
.
i18nc
(
"
@option:curaSolidworksStlQuality
"
,
"
Keep settings unchanged
"
),
code
:
-
1
});
}
index
=
i
;
break
;
}
}
currentIndex
=
index
;
}
Component.onCompleted
:
{
ensureListWithEntries
();
}
Row
function
saveInstallationCode
()
{
width
:
parent
.
width
CheckBox
{
id
:
showWizardCheckBox
text
:
catalog
.
i18nc
(
"
@label
"
,
"
Show wizard before opening SolidWorks files
"
);
checked
:
manager
.
getBoolValue
(
"
show_export_settings_always
"
);
}
var
code
=
model
.
get
(
currentIndex
).
code
;
manager
.
setIntValue
(
"
preferred_installation
"
,
code
);
}
Row
model
:
ListModel
{
width
:
parent
.
width
CheckBox
id
:
installationsModel
Component.onCompleted
:
{
id
:
autoRotateCheckBox
text
:
catalog
.
i18nc
(
"
@label
"
,
"
Automatically rotate opened file into normed orientation
"
);
checked
:
manager
.
getBoolValue
(
"
auto_rotate
"
);
append
({
text
:
"
NONE
"
,
code
:
-
3
});
}
}
}
}
Tab
{
title
:
catalog
.
i18nc
(
"
@title:tab
"
,
"
Installation(s)
"
);
id
:
installationsTab
Row
{
w
id
th
:
parent
.
width
property
Item
versionDropdown
:
item
.
installationCheckDropdown
Label
{
text
:
catalog
.
i18nc
(
"
@action:label
"
,
"
Quality:
"
)
width
:
100
*
screenScaleFactor
anchors.verticalCenter
:
parent
.
verticalCenter
}
GridLayout
ComboBox
{
Layout.fillWidth
:
true
columnSpacing
:
16
*
screenScaleFactor
rowSpacing
:
10
*
screenScaleFactor
columns
:
1
property
Item
installationCheckDropdown
:
installationCheckDropdown
id
:
qualityDropdown
Row
{
width
:
parent
.
width
currentIndex
:
updateCurrentIndex
()
width
:
240
*
screenScaleFactor
ComboBox
function
updateCurrentIndex
()
{
var
index
=
0
;
// Top element in the list below by default
var
currentChoice
=
manager
.
getIntValue
(
"
export_quality
"
);
for
(
var
i
=
0
;
i
<
model
.
count
;
++
i
)
{
id
:
installationCheckDropdown
currentIndex
:
0
width
:
parent
.
width
editable
:
false
function
ensureListWithEntries
()
{
var
versions
=
manager
.
getVersionsList
();
var
version
=
0
;
model
.
clear
();
for
(
var
i
=
0
;
i
<
versions
.
length
;
++
i
)
{
version
=
versions
[
i
];
model
.
append
({
text
:
manager
.
getFriendlyName
(
version
),
code
:
version
});
}
currentIndex
=
0
;
updateCheckBoxes
(
model
.
get
(
currentIndex
).
code
);
}
function
updateCheckBoxes
(
rev_code
)
{
checkCOMFound
.
checked
=
manager
.
getTechnicalInfoPerVersion
(
rev_code
,
"
COM registered
"
);
checkExecutableFound
.
checked
=
manager
.
getTechnicalInfoPerVersion
(
rev_code
,
"
Executable found
"
);
checkCOMStarting
.
checked
=
manager
.
getTechnicalInfoPerVersion
(
rev_code
,
"
COM starting
"
);
checkRevisionVerified
.
checked
=
manager
.
getTechnicalInfoPerVersion
(
rev_code
,
"
Revision number
"
);
checkFunctions
.
checked
=
manager
.
getTechnicalInfoPerVersion
(
rev_code
,
"
Functions available
"
);
}
onActivated
:
if
(
model
.
get
(
i
).
code
==
currentChoice
)
{
updateCheckBoxes
(
model
.
get
(
index
).
code
);
}
Component.onCompleted
:
{
ensureListWithEntries
();
index
=
i
;
break
;
}
model
:
ListModel
{
id
:
installationsModel
Component.onCompleted
:
{
append
({
text
:
"
- Nothing found -
"
,
code
:
-
3
});
}
}
}
}
Row
{
width
:
parent
.
width
CheckBox
{
id
:
checkCOMFound
text
:
catalog
.
i18nc
(
"
@label
"
,
"
COM service found
"
);
enabled
:
false
;
checked
:
false
;
}
currentIndex
=
index
;
}
Row
{
width
:
parent
.
width
CheckBox
{
id
:
checkExecutableFound
text
:
catalog
.
i18nc
(
"
@label
"
,
"
Executable found
"
);
enabled
:
false
;
checked
:
false
;
}
}
Row
{
width
:
parent
.
width
CheckBox
{
id
:
checkCOMStarting
text
:
catalog
.
i18nc
(
"
@label
"
,
"
COM starting
"
);
enabled
:
false
;
checked
:
false
;
}
}
Row
function
saveQualityCode
()
{
width
:
parent
.
width
CheckBox
{
id
:
checkRevisionVerified
text
:
catalog
.
i18nc
(
"
@label
"
,
"
Revision number
"
);
enabled
:
false
;
checked
:
false
;
}
var
code
=
model
.
get
(
currentIndex
).
code
;
manager
.
setIntValue
(
"
export_quality
"
,
code
);
}
Row
model
:
ListModel
{
width
:
parent
.
width
CheckBox
id
:
choiceModel
Component.onCompleted
:
{
id
:
checkFunctions
text
:
catalog
.
i18nc
(
"
@label
"
,
"
Functions available
"
);
enabled
:
false
;
checked
:
false
;
append
({
text
:
catalog
.
i18nc
(
"
@option:curaSolidworksStlQuality
"
,
"
Fine (3D-printing)
"
),
code
:
30
});
append
({
text
:
catalog
.
i18nc
(
"
@option:curaSolidworksStlQuality
"
,
"
Coarse (3D-printing)
"
),
code
:
20
});
append
({
text
:
catalog
.
i18nc
(
"
@option:curaSolidworksStlQuality
"
,
"
Fine (SolidWorks)
"
),
code
:
10
});
append
({
text
:
catalog
.
i18nc
(
"
@option:curaSolidworksStlQuality
"
,
"
Coarse (SolidWorks)
"
),
code
:
0
});
append
({
text
:
catalog
.
i18nc
(
"
@option:curaSolidworksStlQuality
"
,
"
Keep settings unchanged
"
),
code
:
-
1
});
}
}
}
}
Row
{
width
:
parent
.
width
CheckBox
{
id
:
showWizardCheckBox
text
:
catalog
.
i18nc
(
"
@label
"
,
"
Show wizard before opening SolidWorks files
"
);
checked
:
manager
.
getBoolValue
(
"
show_export_settings_always
"
);
}
}
Row
{
width
:
parent
.
width
CheckBox
{
id
:
autoRotateCheckBox
text
:
catalog
.
i18nc
(
"
@label
"
,
"
Automatically rotate opened file into normed orientation
"
);
checked
:
manager
.
getBoolValue
(
"
auto_rotate
"
);
}
}
}
rightButtons
:
[
...
...
@@ -342,10 +199,10 @@ UM.Dialog
text
:
catalog
.
i18nc
(
"
@action:button
"
,
"
Save
"
)
onClicked
:
{
conversionTab
.
qualityDropdown
.
saveQualityCode
();
conversionTab
.
installations
.
saveInstallationCode
();
manager
.
setBoolValue
(
"
show_export_settings_always
"
,
conversionTab
.
showWizard
.
checked
);
manager
.
setBoolValue
(
"
auto_rotate
"
,
conversionTab
.
autoRotate
.
checked
);
qualityDropdown
.
saveQualityCode
();
installations
Dropdown
.
saveInstallationCode
();
manager
.
setBoolValue
(
"
show_export_settings_always
"
,
showWizard
CheckBox
.
checked
);
manager
.
setBoolValue
(
"
auto_rotate
"
,
autoRotate
CheckBox
.
checked
);
close
();
}
enabled
:
true
...
...
CuraSolidWorksPlugin/SolidWorksConstants.py
View file @
36963052
# Copyright (c) 201
7
Thomas Karl Pietrowski
# Copyright (c) 201
9
Thomas Karl Pietrowski
class
SolidWorkVersions
:
major_version_name
=
{
16
:
"SolidWorks 2008"
,
...
...
CuraSolidWorksPlugin/SolidWorksDialogHandler.py
View file @
36963052
# Copyright (c) 201
7
Ultimaker B.V.
# Copyright (c) 201
7
Thomas Karl Pietrowski
# Copyright (c) 201
9
Ultimaker B.V.
# Copyright (c) 201
9
Thomas Karl Pietrowski
# Built-ins
import
os
import
threading
# PyQt5
from
PyQt5.QtCore
import
pyqtSignal
,
pyqtSlot
# @UnresolvedImport
from
PyQt5.QtCore
import
QUrl
,
QObject
# @UnresolvedImport
from
PyQt5.QtQml
import
QQmlComponent
,
QQmlContext
# @UnresolvedImport
# Uranium
from
UM.i18n
import
i18nCatalog
# @UnresolvedImport
from
UM.Application
import
Application
# @UnresolvedImport
...
...
@@ -13,11 +19,6 @@ from UM.Logger import Logger # @UnresolvedImport
from
UM.PluginRegistry
import
PluginRegistry
# @UnresolvedImport
from
UM.Preferences
import
Preferences
# @UnresolvedImport
# PyQt5
from
PyQt5.QtCore
import
pyqtSignal
,
pyqtSlot
# @UnresolvedImport
from
PyQt5.QtCore
import
QUrl
,
QObject
# @UnresolvedImport
from
PyQt5.QtQml
import
QQmlComponent
,
QQmlContext
# @UnresolvedImport
# CIU
from
.CadIntegrationUtils.Extras.Compat
import
ApplicationCompat
...
...
@@ -27,7 +28,7 @@ i18n_catalog = i18nCatalog("SolidWorksPlugin")
class
SolidWorksUiCommons
():
def
_createDialog
(
self
,
dialog_qml
,
directory
=
None
):
if
directory
is
None
:
directory
=
PluginRegistry
.
getInstance
().
getPluginPath
(
self
.
getPluginId
())
directory
=
PluginRegistry
.
getInstance
().
getPluginPath
(
self
.
extension
.
getPluginId
())
path
=
QUrl
.
fromLocalFile
(
os
.
path
.
join
(
directory
,
dialog_qml
))
component
=
QQmlComponent
(
ApplicationCompat
().
qml_engine
,
path
)
...
...
@@ -40,63 +41,75 @@ class SolidWorksUiCommons():
Logger
.
log
(
"e"
,
"QQmlComponent errorString %s"
,
component
.
errorString
())
return
dialog
,
context
,
component
@
pyqtSlot
(
str
,
result
=
bool
)
@
pyqtSlot
(
str
,
result
=
bool
)
def
getBoolValue
(
self
,
name
):
return
self
.
reader
.
preferences
.
getValue
(
name
,
forced_type
=
bool
)
return
self
.
reader
.
preference_storage
.
getValue
(
name
,
forced_type
=
bool
)
@
pyqtSlot
(
str
,
result
=
float
)
def
getFloatValue
(
self
,
name
):
return
self
.
reader
.
preferences
.
getValue
(
name
,
forced_type
=
float
)
@
pyqtSlot
(
str
,
result
=
int
)
def
getIntValue
(
self
,
name
):
return
self
.
reader
.
preference_storage
.
getValue
(
name
,
forced_type
=
int
)
@
pyqtSlot
(
str
,
result
=
float
)
@
pyqtSlot
(
str
,
result
=
float
)
def
getFloatValue
(
self
,
name
):
return
self
.
reader
.
preferences
.
getValue
(
name
,
forced_type
=
float
)
return
self
.
reader
.
preference_storage
.
getValue
(
name
,
forced_type
=
float
)
@
pyqtSlot
(
str
,
bool
)
def
setBoolValue
(
self
,
name
,
value
):
return
self
.
reader
.
preferences
.
setValue
(
name
,
value
,
forced_type
=
bool
)
return
self
.
reader
.
preference_storage
.
setValue
(
name
,
value
,
forced_type
=
bool
)
@
pyqtSlot
(
str
,
int
)
def
setIntValue
(
self
,
name
,
value
):
return
self
.
reader
.
preferences
.
setValue
(
name
,
value
,
forced_type
=
int
)
return
self
.
reader
.
preference_storage
.
setValue
(
name
,
value
,
forced_type
=
int
)
@
pyqtSlot
(
str
,
float
)
def
setFloatValue
(
self
,
name
,
value
):
return
self
.
reader
.
preferences
.
setValue
(
name
,
value
,
forced_type
=
float
)
return
self
.
reader
.
preference_storage
.
setValue
(
name
,
value
,
forced_type
=
float
)
@
pyqtSlot
(
int
,
result
=
bool
)
@
pyqtSlot
(
int
,
result
=
bool
)
def
isVersionOperational
(
self
,
major_version
):
return
major_version
in
self
.
reader
.
operational_versions
@
pyqtSlot
(
int
,
str
,
result
=
bool
)
@
pyqtSlot
(
int
,
str
,
result
=
bool
)
def
getTechnicalInfoPerVersion
(
self
,
revision
,
name
):
return
bool
(
self
.
reader
.
technical_infos_per_version
[
revision
][
name
])
@
pyqtSlot
(
result
=
list
)
@
pyqtSlot
(
result
=
list
)
def
getVersionsList
(
self
):
versions
=
list
(
self
.
reader
.
technical_infos_per_version
.
keys
())
versions
.
sort
()
versions
.
reverse
()
return
versions
@
pyqtSlot
(
result
=
int
)