Pages

Tuesday, September 24, 2013

How to test the assembly module [updated]

While assembly tools are not available in the official packages, you can compile FreeCAD yourself  with the assembly module enabled.
Note: the module is unfinished, unstable and buggy. 

Instructions are similar to those provided in the older post. Alternatively you can use the dubstar-04's script.

Update: There is more up-to-date GitHub repository github.com/ickby/FreeCAD_constraint

Clone sources:

git clone https://github.com/ickby/FreeCAD_constraint.git

Change the directory and checkout the "assembly" branch:

cd FreeCAD_constraint
git checkout assembly

Repeat the normal steps:

mkdir Build && cd Build
cmake - DCMAKE_BUILD_TYPE=Debug ../
make -j8
./bin/FreeCAD 

Additional informations in that forum thread.

Old post:
Install development packages listed on the FreeCAD wiki. Then you can clone the sources from GitHub:

git clone git://git.code.sf.net/p/free-cad/code free-cad-code

Change the directory:

cd free-cad-code/

Now you can list available remote branches:

git branch -r
  origin/HEAD -> origin/master
  origin/dev-units
  origin/dvdjimmy/MachDist
  origin/jriegel/dev-assembly
  origin/logari81/PartDesign
  origin/logari81/PartDesignPattern
  origin/logari81/sketch-diagnostics
  origin/logari81/sketcher
  origin/master
  origin/releases/FreeCAD-0-13
  origin/sanguinariojoe-plot
  origin/sanguinariojoe-ship
  origin/snaptools
  origin/surfaces
  origin/wmayer/double-precision
  origin/wmayer/featurepython
  origin/wmayer/pcl-testing
  origin/wmayer/remote-debugger
  origin/yorik/archstyles


Switch to the "jriegel/dev-assembly" branch:

git checkout jriegel/dev-assembly

Create a new directory for a build:

mkdir Build && cd Build

Run cmake and enable debug build (FreeCAD may be a little slower but easier for debugging):

cmake - DCMAKE_BUILD_TYPE=Debug ../

Compile, the number should be equivalent to the number of threads in your CPU:

make -j8

Run FreeCAD:

./bin/FreeCAD

Example 1: an assembly created from external STEP files.

You have to download four STEP files:
All parts (piston, conrod, pin and pinring) was created in FreeCAD and then exported to the STEP files.

Open the Assembly module and create a new file. Double click on the Product in the Tree view to activate it. If the Product does not exist, you can create one choosing Add a new Component.
Next we have to add an part from an external file. Select Add a existing Component or File to the active Assembly and choose the piston.stp file.
 

Select a surface on the piston and use the Fix a part in its rotation and translation constraint. The piston cannot move now. Notice the new constraint in the Tree view.



In a exactly same way add the pin.stp file. You need two constraints between piston and pin.

Select a side face of pin and a corresponding face of piston (inside pin ring groove) using [Ctrl]. Then use the Align the selected entities constraint.
You have three options:
  • Equal - both faces normal vectors are equal,
  • Opposite - vectors are opposite,
  • Parallel - vectors are equal or opposite. 
In our case please select Equal.


In the next step select cylinder surfaces on pin and inside piston. Use the Make the selected entities coincident (Equal).


Please add conrod.stp selecting Add a existing Component or File to the active Assembly. As in earlier pair use the Align the selected entities (but this time select "Opposite) and the Make the selected entities coincident.



The conrod can be rotated in a specified angle relative to piston. To set the angle select the bottom conrod face.


Then, holding [Ctrl] key, select the top piston face and use the Set the angle between two selected entities. The angle will be 160.


Finally you have to insert pin rings. The procedure is similar to pin adding. You need an align constraint.


And a coincident constraint.


Repeat the procedure for the second pin ring.


Download file.

Download RAW Video. (Right click to save as...)



Example 2: an assembly created from the Part Design-created files.


In this example we will create an assembly containing fully parametric, Part Design parts. They will be created during assembly designing process - there is no graphical import tool for files containing feature tree yet.

Open the Assembly workbench and activate the Product object (double click in the Tree view). Add two new parts using Add a new Part into the active Assembly.


Add two new parts using Add a new Part into the active Assembly.


Expand the first part (click on the small triangle in the tree) and activate the Body. An active workbench should be changed to Part Design automatically. The Body is a container for all features.  


Select the XY plane and create a new sketch. Important: in the current implementation first sketch have to lie on XY. Subsequent sketches can be placed on other planes.


Draw a rectangle, constrain it and close the sketch.


Pad the sketch.


Select a face on the cuboid and place a second sketch.


Sketch a circle.


Use the Pocket tool to create an hole.


You finished the first part, let's try create another one. Expand Part001 and double click on the Body001 to activate it.


As before, select the XY plane and sketch a rectangle.


Revolve the rectangle on horizontal axis to create a cylinder.


You have two parts: a box with a hole and a cylinder. Try place the cylinder in the hole. Double click on the Product in the tree to activate. The Assembly workbench should be active now.

Select a surface on the box and use the Fix a part in its rotation and translation constraint.
Select cylinder surfaces on the both parts with [Ctrl] and use the Make the selected entities coincident (Parallel) tool.


Next use planar surfaces to align parts.


What if you want change something? Try translate the hole position. Activate the Body and then the Sketch001 inside the Pocket feature.



Edit the circle position and close the sketch.


Note: editing works fine only for features placed on the XY plane at this moment. This is a known issue.


Download file, download video.




More information

Assemebly Basic Tutorial - FreeCAD wiki
PartDesign Bearingholder Tutorial I (very useful!)
PartDesign Bearingholder Tutorial II

Used FreeCAD version:

Version: 0.14.2654 (Git)
Branch: jriegel/dev-assembly
Hash: 3d4dd4f64f24255dbaec25767cff7b74bb98fc6d


Trivia: today examples was created on fully open machine (except x86 microcode and some firmware;) - FreeCAD on Ubuntu x86-64 with R600g graphics driver.

Tuesday, April 30, 2013

How to run FreeCAD with the new drawing workbench

Luke Parry is working hard on the new Drawing module. Finally, parametric dimensioning tools has arrived!

If you want test (still in very early development) the workbench, you have to compile FreeCAD yourself. You can find a short how-to below (based on Luke's tips).

First of all, you need tools and development packages listed on the FreeCAD wiki.
Then you can clone the sources from github:

git clone https://github.com/mrlukeparry/FreeCAD_sf_master.git
 

Next go to the downloaded directory:

cd FreeCAD_sf_master/

Switch to the "drawing" branch:

git checkout drawing

Create a new directory for a build (not necessary but recommended):

mkdir Build && cd Build

Run cmake and enable debug build (FreeCAD may be a little slower but easier for debugging):

cmake - DCMAKE_BUILD_TYPE=Debug ../
 

Compile, the number should be equivalent to the number of threads in your CPU:

make -j8

An finally run FreeCAD:

./bin/FreeCAD



Open or create a solid part. Switch to the drawing workbench and create a new page.


Double click (in tree) to open the page view.


Select a solid from the tree and create a new view. Views (dimensions too) dragging using mouse is now possible - as opposition to the old drawing workbench.





Select an edge and add a new dimension. Tip: enable the Selection view in the View menu to see what is selected.


In the Data tab you can change the radius to a diameter.


Add some other dimensions: line length, distance between points (use Ctrl to select two points), radius and diameter are available.


Back to the 3D model and change something.


The drawing should change as well.


Any good ideas? Share your opinion!