Skip to content

Commit

Permalink
Merge pull request #34 from luzpaz/whitespace-fix
Browse files Browse the repository at this point in the history
Fix all trailing whitespace
  • Loading branch information
kbwbe authored Aug 3, 2018
2 parents 68cd788 + 82dc8c3 commit da4bc46
Show file tree
Hide file tree
Showing 17 changed files with 446 additions and 1,134 deletions.
20 changes: 10 additions & 10 deletions InitGui.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,16 @@



class a2pWorkbench (Workbench):
class a2pWorkbench (Workbench):

def __init__(self):
import a2plib
self.__class__.Icon = a2plib.pathOfModule() + "/icons/a2p_workbench.svg"
self.__class__.MenuText = 'A2plus'
self.__class__.ToolTip = 'An other assembly workbench for FreeCAD'

def Initialize(self):

import a2plib #QtCore.QResource.registerResource happens in assembly2lib
import a2p_importpart
import a2p_CircularEdgeConnection
Expand Down Expand Up @@ -84,20 +84,20 @@ def Initialize(self):
commandslist
)
self.appendMenu(
'A2p',
'A2p',
menuEntries
)
#FreeCADGui.addPreferencePage( a2plib.pathOfModule() + '/GuiA2p/ui/a2p_prefs.ui','A2plus' )
FreeCADGui.addPreferencePage(
a2plib.pathOfModule() +
'/GuiA2p/Resources/ui/a2p_prefs.ui','A2plus'
)


def Activated(self):
import observers
FreeCAD.addDocumentObserver(observers.redoUndoObserver)

def Deactivated(self):
import observers
FreeCAD.removeDocumentObserver(observers.redoUndoObserver)
Expand All @@ -108,9 +108,9 @@ def ContextMenu(self, recipient):
if len(selection) == 1:
obj = selection[0]
if 'sourceFile' in obj.Content:
self.appendContextMenu(
"A2p",
[
self.appendContextMenu(
"A2p",
[
'a2p_movePart',
'a2p_duplicatePart',
'a2p_editImportedPart',
Expand Down
46 changes: 23 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Similar is:

Different is:
* A new designed solving algorithm, able to solve some more complicated relations.
* Different and in future more constraints, internally with different names.
* Different and in future more constraints, internally with different names.
* No animation for degrees of freedom, as difficult for new solver type.
* No parts list at moment. Export to office spreadsheats planned for future versions.
* No collision check of parts at moment. Planned for future versions
Expand Down Expand Up @@ -107,48 +107,48 @@ As your first steps learning this workbench, please have look at tutorials relat
You can follow the tool-tips in the workbench's toolbar. They describe exactly what to do in which order.

Current Features like shown in the workbench's toolbar:
* Add a part from external file (Shift+A) -
* Add a part from external file (Shift+A) -
Begin and continue here with adding (importing existing files) .fcstd parts
* Update parts imported into the assembly -
* Update parts imported into the assembly -
Use this to refresh changed parts already assembled
* Move part -
Just move selected part
* Duplicate part -
* Duplicate part -
Adds one or more previously imported part into assembly
* Edit -
* Edit -
Opens the selected assembly part to be changed in a new tab
* Add a point-to-point identity {pointIdentityConstraint} -
* Add a point-to-point identity {pointIdentityConstraint} -
Fix a point vertex to another point vertex
* Add a point-on-line match {pointOnLineConstraint} -
* Add a point-on-line match {pointOnLineConstraint} -
Fix a point vertex to a line vertex
* Add a point-on-plane match {pointOnPlaneConstraint} -
* Add a point-on-plane match {pointOnPlaneConstraint} -
Fix a point vertex to be on a plane
* Add a circular-to-circular edge match {circularEdgeConstraint} -
Fix one circular edge to another. You can choose a special direction (aligned, opposed or none).
* Add a circular-to-circular edge match {circularEdgeConstraint} -
Fix one circular edge to another. You can choose a special direction (aligned, opposed or none).
An offset can be applied
* Add a plane-to-plane parallelism {planeParallel} -
* Add a plane-to-plane parallelism {planeParallel} -
Adjust selected planes to be parallel. You can choose a special direction (aligned, opposed)
* Add a plane-to-plane offset {planeConstraint} -
* Add a plane-to-plane offset {planeConstraint} -
Makes planes parallel and offers to give an offset value and direction (aligned, opposed,none)
* Add an axis-to-axis identity {axialConstraint} -
* Add an axis-to-axis identity {axialConstraint} -
Makes cylindrical objects or two axes to be axially aligned
* Add an angle between planes {angledPlanesConstraint} -
* Add an angle between planes {angledPlanesConstraint} -
Selected planes make the latter object to be rotated by your edited 'angle' value.
Keep the angle between aprox 0.1° and 179.9° or use workarounds.
* Add a spherical constraint between objects -
Keep the angle between aprox 0.1° and 179.9° or use workarounds.
* Add a spherical constraint between objects -
Select spheres to be aligned or vertex/sphere or vertex/vertex
* Solve A2plus constraints -
* Solve A2plus constraints -
Manually invoke the A2pus solver (especially when AutoSolve is OFF)
* Delete constraints -
* Delete constraints -
Remove all constraints of selected part in one step
* View constrained element -
* View constrained element -
Show all elements for a Tree view selected constraint
* SAS Create or refresh simple shape of complete assembly -
* SAS Create or refresh simple shape of complete assembly -
the newly created compound can be found in tree vies
* Toggle transparency of assembly -
* Toggle transparency of assembly -
The whole assembly will get transparent
* Show only selected items (or all if none selected) -
* Show only selected items (or all if none selected) -
Just another visibility helper
* Toggle AutoSolve -
* Toggle AutoSolve -
Normally the solver defaults to and works with AutoSolve, but for larger
assemblies one may chose OFF and solve manually, as it saves computation time.
105 changes: 20 additions & 85 deletions a2p_AxialConnection.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ def parseSelection(selection, objectToUpdate=None):
[s2.ObjectName, s2.SubElementNames[0], s2.Object.Label ] ]
if not validSelection:
msg = '''
To add an axial constraint select two cylindrical surfaces or two
To add an axial constraint select two cylindrical surfaces or two
straight lines, each from a different part. Selection made:%s
''' % printSelection(selection)
QtGui.QMessageBox.information( QtGui.QApplication.activeWindow(), "Incorrect Usage", msg)
return
return

if objectToUpdate == None:
cName = findUnusedObjectName('axialConstraint')
Expand All @@ -60,15 +60,15 @@ def parseSelection(selection, objectToUpdate=None):
c.addProperty("App::PropertyString","SubElement1","ConstraintInfo").SubElement1 = cParms[0][1]
c.addProperty("App::PropertyString","Object2","ConstraintInfo").Object2 = cParms[1][0]
c.addProperty("App::PropertyString","SubElement2","ConstraintInfo").SubElement2 = cParms[1][1]

c.addProperty("App::PropertyEnumeration","directionConstraint", "ConstraintInfo")
c.directionConstraint = ["none","aligned","opposed"]
c.addProperty("App::PropertyBool","lockRotation","ConstraintInfo")

c.setEditorMode('Type',1)
for prop in ["Object1","Object2","SubElement1","SubElement2"]:
c.setEditorMode(prop, 1)
c.setEditorMode(prop, 1)

#-------------------------------------------
# Group correctly under ParentObject in tree
#-------------------------------------------
Expand All @@ -79,11 +79,11 @@ def parseSelection(selection, objectToUpdate=None):
#-------------------------------------------

c.Proxy = ConstraintObjectProxy()
c.ViewObject.Proxy = ConstraintViewProviderProxy(
c,
path_a2p + '/icons/a2p_axialConstraint.svg',
True,
cParms[1][2],
c.ViewObject.Proxy = ConstraintViewProviderProxy(
c,
path_a2p + '/icons/a2p_axialConstraint.svg',
True,
cParms[1][2],
cParms[0][2]
)
else:
Expand All @@ -93,7 +93,7 @@ def parseSelection(selection, objectToUpdate=None):
c.Object2 = cParms[1][0]
c.SubElement2 = cParms[1][1]
updateObjectProperties(c)

c.purgeTouched()
c.Proxy.callSolveConstraints()

Expand Down Expand Up @@ -121,83 +121,18 @@ def Activated(self):
parseSelection( selection )
else:
FreeCADGui.Selection.clearSelection()
ConstraintSelectionObserver(
AxialSelectionGate(),
ConstraintSelectionObserver(
AxialSelectionGate(),
parseSelection,
taskDialog_title ='add axial constraint',
taskDialog_iconPath = self.GetResources()['Pixmap'],
taskDialog_title ='add axial constraint',
taskDialog_iconPath = self.GetResources()['Pixmap'],
taskDialog_text = selection_text
)
def GetResources(self):
def GetResources(self):
return {
'Pixmap' : path_a2p + '/icons/a2p_axialConstraint.svg',
'MenuText': 'Add axial constraint',
'Pixmap' : path_a2p + '/icons/a2p_axialConstraint.svg',
'MenuText': 'Add axial constraint',
'ToolTip': toolTipText
}
}

FreeCADGui.addCommand('a2p_AxialConnection', a2p_AxialConnectionCommand())

































































Loading

0 comments on commit da4bc46

Please sign in to comment.