Skip to content

Commit

Permalink
v0.7.7
Browse files Browse the repository at this point in the history
moved the tutorials to Resources, updated Example #1 & #2
  • Loading branch information
Zolko-123 committed Jan 5, 2020
1 parent 2f60c15 commit 4c4eefd
Show file tree
Hide file tree
Showing 34 changed files with 2,064 additions and 463 deletions.
Binary file removed Examples/Asm4_Example1/Bague.fcstd
Binary file not shown.
Binary file removed Examples/Asm4_Example1/Bielle.fcstd
Binary file not shown.
Binary file removed Examples/Asm4_Example1/Cuve.fcstd
Binary file not shown.
Binary file removed Examples/Asm4_Example1/Screw_CHC.fcstd
Binary file not shown.
Binary file removed Examples/Asm4_Example1/asm_Bielle.fcstd
Binary file not shown.
Binary file added Examples/Asm4_Example1/asm_tuto1.FCStd
Binary file not shown.
Binary file added Examples/Asm4_Example1/axis.FCStd
Binary file not shown.
Binary file added Examples/Asm4_Example1/bearing.FCStd
Binary file not shown.
1,241 changes: 1,241 additions & 0 deletions Examples/Asm4_Example1/bearing_20x37x9.stp

Large diffs are not rendered by default.

Binary file modified Examples/Asm4_Example2/Bielle/Bague.fcstd
Binary file not shown.
Binary file modified Examples/Asm4_Example2/Bielle/Bielle.fcstd
Binary file not shown.
Binary file modified Examples/Asm4_Example2/Bielle/Cuve.fcstd
Binary file not shown.
Binary file removed Examples/Asm4_Example2/Bielle/Screw_CHC.fcstd
Binary file not shown.
Binary file modified Examples/Asm4_Example2/Bielle/asm_Bielle.fcstd
Binary file not shown.
Binary file modified Examples/Asm4_Example2/Crankshaft.FCStd
Binary file not shown.
Binary file modified Examples/Asm4_Example2/Cylindre.FCStd
Binary file not shown.
16 changes: 0 additions & 16 deletions Examples/Asm4_Example2/ReadMe.txt

This file was deleted.

Binary file modified Examples/Asm4_Example2/asm_V4.FCStd
Binary file not shown.
104 changes: 104 additions & 0 deletions HelpCmd.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
#!/usr/bin/env python3
# coding: utf-8
#
# HelpCmd.py


import math, re, os

from PySide import QtGui, QtCore
import FreeCADGui as Gui
import FreeCAD as App
import Part

import libAsm4 as Asm4




"""
+-----------------------------------------------+
| main class |
+-----------------------------------------------+
"""
class Asm4Help( QtGui.QDialog ):
"My tool object"


def __init__(self):
super(Asm4Help,self).__init__()


def GetResources(self):
return {"MenuText": "Help for Assembly4",
"ToolTip": "Show basic usage for FreeCAD and Assembly4",
"Pixmap" : os.path.join( Asm4.iconPath , 'Asm4_Help.svg')
}


def IsActive(self):
# is there an active document ?
if App.ActiveDocument:
# check that it's an Assembly4 'Model'
if App.ActiveDocument.getObject('Model') and App.ActiveDocument.getObject('Model').TypeId=='App::Part':
return True
return False


def Activated(self):
# Now we can draw the UI
self.drawUI()
self.show()


"""
+-----------------------------------------------+
| OK |
+-----------------------------------------------+
"""
def onOK(self):
self.close()



"""
+-----------------------------------------------+
| defines the UI, only static elements |
+-----------------------------------------------+
"""
def drawUI(self):
# Our main window will be a QDialog
self.setWindowTitle('Help for FreeCAD and Assembly4')
self.setWindowIcon( QtGui.QIcon( os.path.join( Asm4.iconPath , 'FreeCad.svg' ) ) )
self.setMinimumSize(600, 500)
self.resize(600,500)
self.setModal(False)
# make this dialog stay above the others, always visible
self.setWindowFlags( QtCore.Qt.WindowStaysOnTopHint )

# Variable Type
self.helpText = QtGui.QTextBrowser(self)
self.helpText.move(10,25)
self.helpText.setMinimumSize(580, 400)
self.helpText.setSearchPaths( [os.path.join( Asm4.wbPath, 'Resources' )] )
self.helpText.setSource( 'Asm4_Help.html' )
#self.helpText.setText("Help Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.\n \nSed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?")

# OK button
self.OKButton = QtGui.QPushButton('OK', self)
self.OKButton.setAutoDefault(True)
self.OKButton.move(500, 450)
self.OKButton.setDefault(True)

# Actions
self.OKButton.clicked.connect(self.onOK)




"""
+-----------------------------------------------+
| add the command to the workbench |
+-----------------------------------------------+
"""
Gui.addCommand( 'Asm4_Help', Asm4Help() )
2 changes: 1 addition & 1 deletion Init.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@
#
###################################################################################

print("Loading Assembly 4 WorkBench")
print("Loading Assembly 4 WorkBench. \xa9 Zoltan Hubert")
9 changes: 7 additions & 2 deletions InitGui.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ def Initialize(self):
import AnimationLib # creates an LCS in assembly and attaches it to an LCS relative to an external file
import updateAssemblyCmd # updates all parts and constraints in the assembly
import newLinkArray # creates a new array of App::Link
import HelpCmd # shows a basic help window

if self.checkWorkbench('FastenersWorkbench'):
import FastenersLib # a library to handle fasteners from the FastenersWorkbench
Expand Down Expand Up @@ -146,8 +147,10 @@ def Initialize(self):
"Asm4_importDatum",
"Asm4_addVariable",
"Asm4_Animate",
"Asm4_updateAssembly"]
"Asm4_updateAssembly",
"Asm4_Help"]
self.appendMenu("&Assembly",self.itemsMenu)
self.appendMenu("&Help", ["Asm4_Help"])
# commands to appear in the Assembly4 toolbar
self.itemsToolbar = [ "Asm4_newModel",
"Asm4_newBody",
Expand Down Expand Up @@ -230,7 +233,7 @@ def Deactivated(self):


def ContextMenu(self, recipient):
"This is executed whenever the user right-clicks on screen"
# This is executed whenever the user right-clicks on screen"
# "recipient" will be either "view" or "tree"
self.appendContextMenu( "Assembly", self.itemsContextMenu ) # add commands to the context menu
self.appendContextMenu( "Create", self.itemsCreateMenu ) # add commands to the context menu
Expand All @@ -248,9 +251,11 @@ def GetClassName(self):
+-----------------------------------------------+
"""
wb = Assembly4_WorkBench()
#print("Loading Assembly 4 WorkBench. \xa9 Zoltan Hubert")
Gui.addWorkbench(wb)






18 changes: 12 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,19 @@ Assembly 4 is available through the FreeCAD Addon Manager (menu Tools > Addon Ma

You can use the [example assemblies](https://github.com/Zolko-123/FreeCAD_Assembly4/tree/master/Examples) to experiment with this workbench's features. Open one _asm_something.fcstd_ file and try out the functions. There are `ReadMe.txt` files in each directory with some explanations. There are tutorials available to lear tu use Assembly4:

* [a quick assembly from scratch](TUTORIAL1.md)
* [a cinematic assembly reusing existing FreeCAD parts](TUTORIAL2.md)
* [a multy-layered assembly for advanced users](TUTORIAL3.md)
* [a Lego assembly](TUTORIAL4.md)
* [an architectural assembly](TUTORIAL5.md)
* [a quick assembly from scratch](Resources/TUTORIAL1.md)
* [a cinematic assembly reusing existing FreeCAD parts](Resources/TUTORIAL2.md)
* [a multy-layered assembly for advanced users](Resources/TUTORIAL3.md)
* [a Lego assembly](Resources/TUTORIAL4.md)
* [an architectural assembly](Resources/TUTORIAL5.md)



## Principle

Assembly4 uses a very powerful feature of FreeCAD, the **ExpressionEngine**. Some FreeCAD object's parameters can be entered through mathematical formulae, that are evaluated by this ExpressionEngine. For Assembly4, it's the parameter _`Placement`_ of the inserted _`App::Link`_ object that is calculated, such that 2 LCS - one in the linked part and the one in the assembly - are superimposed.

You can find more informations in the detailed [instructions](INSTRUCTIONS.md).
You can find more informations in the detailed [instructions](Resources/INSTRUCTIONS.md).


## Parts
Expand Down Expand Up @@ -74,6 +74,12 @@ This is then a raw interface between FreeCAD `App::Part` objects through the `Ap

## Release notes

* 2020.01.06 (**version 0.7.7**) :
Moved the turorials to the Resources directory
import libAsm4 as Asm4
Added a Help command (dummy placeholder)
Ported example2 to the latest Asm4 format

* 2019.12.12 (**version 0.7.6**) :
Improved animation and datum import.

Expand Down
12 changes: 12 additions & 0 deletions Resources/Asm4_Help.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<html>
<head>
<title></title>
<meta content="">
<style></style>
</head>
<body>
<p>Help Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>

<p>Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?</p>
</body>
</html>
Loading

0 comments on commit 4c4eefd

Please sign in to comment.