Skip to content

Commit

Permalink
First shot at base algorithm for inserting holding tabs.
Browse files Browse the repository at this point in the history
  • Loading branch information
mlampert committed Nov 17, 2016
1 parent cb16eda commit 730e2c5
Show file tree
Hide file tree
Showing 5 changed files with 645 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/Mod/Path/CMakeLists.txt
Expand Up @@ -38,6 +38,7 @@ SET(PathScripts_SRCS
PathScripts/PathDrilling.py
PathScripts/PathDressup.py
PathScripts/DragknifeDressup.py
PathScripts/PathDressupHoldingTabs.py
PathScripts/PathHop.py
PathScripts/PathUtils.py
PathScripts/PathSelection.py
Expand Down
1 change: 1 addition & 0 deletions src/Mod/Path/Gui/Resources/Path.qrc
Expand Up @@ -90,5 +90,6 @@
<file>panels/DogboneEdit.ui</file>
<file>panels/DlgSelectPostProcessor.ui</file>
<file>preferences/PathJob.ui</file>
<file>panels/HoldingTabsEdit.ui</file>
</qresource>
</RCC>
121 changes: 121 additions & 0 deletions src/Mod/Path/Gui/Resources/panels/HoldingTabsEdit.ui
@@ -0,0 +1,121 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>TaskPanel</class>
<widget class="QWidget" name="TaskPanel">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>352</width>
<height>387</height>
</rect>
</property>
<property name="windowTitle">
<string>Holding Tabs</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="1" column="0">
<widget class="QToolBox" name="toolBox">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="holdingTabs">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>334</width>
<height>340</height>
</rect>
</property>
<attribute name="label">
<string>Holding Tabs</string>
</attribute>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="lCount">
<property name="text">
<string>Count</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="lWidth">
<property name="text">
<string>Width</string>
</property>
</widget>
</item>
<item row="5" column="0" colspan="2">
<widget class="QListWidget" name="lwHoldingTabs">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;List of holding tabs calculated by the paremeters entered above. You can un-check tabs you don't want to be inserted.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QSpinBox" name="sbCount">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Enter the number of tabs you wish to have.&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;p&gt;Note that sometimes it's necessary to enter a larger than desired count number and disable the ones tabs you don't want in order to get the holding tab layout you want.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QDoubleSpinBox" name="dsbWidth">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Width of each tab.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="lHeight">
<property name="text">
<string>Height</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QDoubleSpinBox" name="dsbHeight">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;The height of the holding tab measured from the bottom of the path. By default this is set to the (estimated) height of the path.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="lAngle">
<property name="enabled">
<bool>true</bool>
</property>
<property name="text">
<string>Angle</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QDoubleSpinBox" name="dsbAngle">
<property name="enabled">
<bool>true</bool>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Angle of tab walls.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
10 changes: 8 additions & 2 deletions src/Mod/Path/InitGui.py
Expand Up @@ -75,6 +75,7 @@ def Initialize(self):
from PathScripts import PathProfileEdges
from PathScripts import DogboneDressup
from PathScripts import PathMillFace
from PathScripts import PathDressupHoldingTabs
import PathCommands

# build commands list
Expand All @@ -84,7 +85,7 @@ def Initialize(self):
twodopcmdlist = ["Path_Contour", "Path_Profile", "Path_Profile_Edges", "Path_Pocket", "Path_Drilling", "Path_Engrave", "Path_MillFace"]
threedopcmdlist = ["Path_Surfacing"]
modcmdlist = ["Path_Copy", "Path_CompoundExtended", "Path_Array", "Path_SimpleCopy" ]
dressupcmdlist = ["Dogbone_Dressup", "DragKnife_Dressup"]
dressupcmdlist = ["Dogbone_Dressup", "DragKnife_Dressup", "PathDressup_HoldingTabs"]
extracmdlist = ["Path_SelectLoop"]
#modcmdmore = ["Path_Hop",]
#remotecmdlist = ["Path_Remote"]
Expand Down Expand Up @@ -119,6 +120,11 @@ def translate(context, text):
# "Path", "Remote Operations")], remotecmdlist)
self.appendMenu([translate("Path", "&Path")], extracmdlist)

# Add preferences pages
import os
FreeCADGui.addPreferencePage(FreeCAD.getHomePath(
) + os.sep + "Mod" + os.sep + "Path" + os.sep + "PathScripts" + os.sep + "DlgSettingsPath.ui", "Path")

Log('Loading Path workbench... done\n')

def GetClassName(self):
Expand All @@ -136,7 +142,7 @@ def ContextMenu(self, recipient):
if len(FreeCADGui.Selection.getSelection()) == 1:
if FreeCADGui.Selection.getSelection()[0].isDerivedFrom("Path::Feature"):
self.appendContextMenu("", ["Path_Inspect"])
if "Profile" or "Contour" in FreeCADGui.Selection.getSelection()[0].Name:
if "Profile" in FreeCADGui.Selection.getSelection()[0].Name:
self.appendContextMenu("", ["Add_Tag"])
self.appendContextMenu("", ["Set_StartPoint"])
self.appendContextMenu("", ["Set_EndPoint"])
Expand Down

0 comments on commit 730e2c5

Please sign in to comment.