Skip to content

Commit

Permalink
Merge pull request #283 from kbwbe/devel
Browse files Browse the repository at this point in the history
Devel
  • Loading branch information
kbwbe authored May 18, 2019
2 parents b2c53a4 + f75a314 commit 65fefe0
Show file tree
Hide file tree
Showing 12 changed files with 725 additions and 45 deletions.
4 changes: 2 additions & 2 deletions InitGui.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
__title__ = 'A2plus assembly Workbench - InitGui file'
__author__ = 'kbwbe'

A2P_VERSION = 'V0.4.21'
A2P_VERSION = 'V0.4.22'



Expand Down Expand Up @@ -173,7 +173,7 @@ def Initialize(self):
'a2p_AxialConstraintCommand',
'a2p_AxisParallelConstraintCommand',
'a2p_AxisPlaneParallelCommand',
'a2p_AxisPlaneVerticalCommand',
'a2p_AxisPlaneNormalCommand',
'a2p_PlanesParallelConstraintCommand',
'a2p_PlaneCoincidentConstraintCommand',
'a2p_AngledPlanesConstraintCommand',
Expand Down
2 changes: 2 additions & 0 deletions a2p_MuxAssembly.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ def muxAssemblyWithTopoNames(doc, desiredShapeLabel=None):
solid = shell
except:
# keeping a shell if solid is failing
FreeCAD.Console.PrintWarning('Union of Shapes FAILED\n')
solid = shell

# transparency could change to different values depending
Expand Down Expand Up @@ -286,6 +287,7 @@ def createOrUpdateSimpleAssemblyShape(doc):
solid = shell
except:
# keeping a shell if solid is failing
FreeCAD.Console.PrintWarning('Union of Shapes FAILED\n')
solid = shell
sas.Shape = solid #shell
sas.ViewObject.Visibility = False
Expand Down
8 changes: 4 additions & 4 deletions a2p_Resources2.py

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions a2p_Resources3.py

Large diffs are not rendered by default.

24 changes: 12 additions & 12 deletions a2p_constraintDialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -517,19 +517,19 @@ def initUI(self):
QtCore.QObject.connect(self.axisPlaneParallelButton, QtCore.SIGNAL("clicked()"), self.onAxisPlaneParallelButton)
self.constraintButtons.append(self.axisPlaneParallelButton)
#-------------------------------------
self.axisPlaneVerticalButton = QtGui.QPushButton(self.panel2)
self.axisPlaneVerticalButton.setFixedSize(32,32)
self.axisPlaneVerticalButton.setIcon(QtGui.QIcon(':/icons/a2p_AxisPlaneVerticalConstraint.svg'))
self.axisPlaneVerticalButton.setToolTip(a2p_constraints.AxisPlaneVerticalConstraint.getToolTip())
self.axisPlaneVerticalButton.setText("")
QtCore.QObject.connect(self.axisPlaneVerticalButton, QtCore.SIGNAL("clicked()"), self.onAxisPlaneVerticalButton)
self.constraintButtons.append(self.axisPlaneVerticalButton)
self.axisPlaneNormalButton = QtGui.QPushButton(self.panel2)
self.axisPlaneNormalButton.setFixedSize(32,32)
self.axisPlaneNormalButton.setIcon(QtGui.QIcon(':/icons/a2p_AxisPlaneNormalConstraint.svg'))
self.axisPlaneNormalButton.setToolTip(a2p_constraints.AxisPlaneNormalConstraint.getToolTip())
self.axisPlaneNormalButton.setText("")
QtCore.QObject.connect(self.axisPlaneNormalButton, QtCore.SIGNAL("clicked()"), self.onAxisPlaneNormalButton)
self.constraintButtons.append(self.axisPlaneNormalButton)
#-------------------------------------
panel2_Layout.addWidget(self.circularEdgeButton)
panel2_Layout.addWidget(self.axialButton)
panel2_Layout.addWidget(self.axisParallelButton)
panel2_Layout.addWidget(self.axisPlaneParallelButton)
panel2_Layout.addWidget(self.axisPlaneVerticalButton)
panel2_Layout.addWidget(self.axisPlaneNormalButton)
panel2_Layout.addStretch(1)
self.panel2.setLayout(panel2_Layout)
#-------------------------------------
Expand Down Expand Up @@ -647,8 +647,8 @@ def parseSelections(self):
self.axialButton.setEnabled(True)
if a2p_constraints.AxisPlaneParallelConstraint.isValidSelection(selection):
self.axisPlaneParallelButton.setEnabled(True)
if a2p_constraints.AxisPlaneVerticalConstraint.isValidSelection(selection):
self.axisPlaneVerticalButton.setEnabled(True)
if a2p_constraints.AxisPlaneNormalConstraint.isValidSelection(selection):
self.axisPlaneNormalButton.setEnabled(True)
if a2p_constraints.CircularEdgeConstraint.isValidSelection(selection):
self.circularEdgeButton.setEnabled(True)
if a2p_constraints.PlanesParallelConstraint.isValidSelection(selection):
Expand Down Expand Up @@ -723,9 +723,9 @@ def onAxisPlaneParallelButton(self):
self.activeConstraint = a2p_constraints.AxisPlaneParallelConstraint(selection)
self.manageConstraint()

def onAxisPlaneVerticalButton(self):
def onAxisPlaneNormalButton(self):
selection = FreeCADGui.Selection.getSelectionEx()
self.activeConstraint = a2p_constraints.AxisPlaneVerticalConstraint(selection)
self.activeConstraint = a2p_constraints.AxisPlaneNormalConstraint(selection)
self.manageConstraint()

def onPlanesParallelButton(self):
Expand Down
14 changes: 7 additions & 7 deletions a2p_constraintcommands.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,30 +235,30 @@ def GetResources(self):

FreeCADGui.addCommand('a2p_AxisPlaneParallelCommand', a2p_AxisPlaneParallelCommand())
#==============================================================================
class a2p_AxisPlaneVerticalCommand:
class a2p_AxisPlaneNormalCommand:
def Activated(self):
selection = FreeCADGui.Selection.getSelectionEx()

c = a2p_constraints.AxisPlaneVerticalConstraint(selection)
c = a2p_constraints.AxisPlaneNormalConstraint(selection)
cvp = a2p_constraintDialog.a2p_ConstraintValuePanel(
c.constraintObject,
'createConstraint'
)
FreeCADGui.Selection.clearSelection()

def IsActive(self):
return a2p_constraints.AxisPlaneVerticalConstraint.isValidSelection(
return a2p_constraints.AxisPlaneNormalConstraint.isValidSelection(
FreeCADGui.Selection.getSelectionEx()
)

def GetResources(self):
return {
'Pixmap' : ':/icons/a2p_AxisPlaneVerticalConstraint.svg',
'MenuText': 'Add axisPlaneVertical constraint',
'ToolTip': a2p_constraints.AxisPlaneVerticalConstraint.getToolTip()
'Pixmap' : ':/icons/a2p_AxisPlaneNormalConstraint.svg',
'MenuText': 'Add axisPlaneNormal constraint',
'ToolTip': a2p_constraints.AxisPlaneNormalConstraint.getToolTip()
}

FreeCADGui.addCommand('a2p_AxisPlaneVerticalCommand', a2p_AxisPlaneVerticalCommand())
FreeCADGui.addCommand('a2p_AxisPlaneNormalCommand', a2p_AxisPlaneNormalCommand())
#==============================================================================
class a2p_PlanesParallelConstraintCommand:
def Activated(self):
Expand Down
10 changes: 5 additions & 5 deletions a2p_constraints.py
Original file line number Diff line number Diff line change
Expand Up @@ -451,12 +451,12 @@ def isValidSelection(selection):
return validSelection

#==============================================================================
class AxisPlaneVerticalConstraint(BasicConstraint):
class AxisPlaneNormalConstraint(BasicConstraint):
def __init__(self,selection):
BasicConstraint.__init__(self, selection)
self.typeInfo = 'axisPlaneVertical'
self.constraintBaseName = 'axisPlaneVertical'
self.iconPath = ':/icons/a2p_AxisPlaneVerticalConstraint.svg'
self.typeInfo = 'axisPlaneNormal'
self.constraintBaseName = 'axisPlaneNormal'
self.iconPath = ':/icons/a2p_AxisPlaneNormalConstraint.svg'
self.create(selection)

def calcInitialValues(self):
Expand All @@ -475,7 +475,7 @@ def calcInitialValues(self):
def getToolTip():
return \
'''
Add an axisPlaneVertical constraint
Add an axisPlaneNormal constraint
1) select a linear edge or cylinder axis
2) select a plane face on another part
Expand Down
14 changes: 4 additions & 10 deletions a2p_dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,9 +340,9 @@ def Create(doc, constraint, solver, rigid1, rigid2):
normal2 = a2plib.getPlaneNormal(plane2.Surface)
dep2.refAxisEnd = dep2.refPoint.add(normal2)

elif c.Type == "axisPlaneVertical":
dep1 = DependencyAxisPlaneVertical(c, "pointAxis")
dep2 = DependencyAxisPlaneVertical(c, "pointNormal")
elif c.Type == "axisPlaneVertical" or c.Type == "axisPlaneNormal": # axisPlaneVertical for compat.
dep1 = DependencyAxisPlaneNormal(c, "pointAxis")
dep2 = DependencyAxisPlaneNormal(c, "pointNormal")

ob1 = doc.getObject(c.Object1)
ob2 = doc.getObject(c.Object2)
Expand Down Expand Up @@ -379,13 +379,7 @@ def Create(doc, constraint, solver, rigid1, rigid2):
elif c.SubElement2.startswith('Edge'):
plane2 = Part.Face(Part.Wire(getObjectEdgeFromName(ob2, c.SubElement2)))
dep2.refPoint = plane2.CenterOfMass
#plane1 = getObjectFaceFromName(ob1, c.SubElement1)
#plane2 = getObjectFaceFromName(ob2, c.SubElement2)
# dep1.refPoint = plane1.Faces[0].CenterOfMass
# dep2.refPoint = plane2.Faces[0].CenterOfMass

#normal1 = plane1.Surface.Axis
#normal2 = plane2.Surface.Axis
normal1 = a2plib.getPlaneNormal(plane1.Surface)
normal2 = a2plib.getPlaneNormal(plane2.Surface)

Expand Down Expand Up @@ -859,7 +853,7 @@ def calcDOF(self, _dofPos, _dofRot, _pointconstraints=[]):
tmpaxis.Direction.Length = 2.0
return _dofPos, AngleAlignment(tmpaxis,_dofRot)

class DependencyAxisPlaneVertical(Dependency):
class DependencyAxisPlaneNormal(Dependency):
def __init__(self, constraint, refType):
Dependency.__init__(self, constraint, refType, True)
self.isPointConstraint = False
Expand Down
2 changes: 1 addition & 1 deletion a2p_importedPart_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def getIcon(self):
if hasattr(self,"Object"):
if hasattr(self.Object,"sourceFile") and hasattr(self.Object,"sourcePart"):
if self.Object.sourcePart is not None and self.Object.sourcePart !='':
return ":/icons/a2p_ShapeReference.svg"
return a2plib.pathOfModule()+'/icons/a2p_ObjReference.svg'
if hasattr(self.Object,"subassemblyImport"):
if self.Object.subassemblyImport:
return ":/icons/a2p_Asm.svg"
Expand Down
1 change: 1 addition & 0 deletions a2p_topomapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,7 @@ def createTopoNames(self, desiredShapeLabel = None):
solid = shell # fall back to shell if faces are missing
except:
# keeping a shell if solid is failing
FreeCAD.Console.PrintWarning('Union of Shapes FAILED\n')
solid = shell

#-------------------------------------------
Expand Down
Loading

0 comments on commit 65fefe0

Please sign in to comment.