[2024]Digital Global Overview Report 2024 Meltwater.pdf
6 week training presentation
1. freeCAD
Installation
freeCAD
pyhton scripts
Drawing sheet
freeCAD
open source CAD
Diljot kaur
diljot6791@gmail.com
Dept. of Computer Science
October 16, 2011
Guru Nanak Dev Engineering College diljot6791@wordpress.com
2. freeCAD
Installation
freeCAD
pyhton scripts
Drawing sheet
Contents
1 freeCAD
2 Installation
3 freeCAD
4 pyhton scripts
line script
circle script
cube script
cylinder script
fusion script using macro
fusion script
bottle script
5 Drawing sheet
How to show object in drawing sheet
Drawing sheet of object
Guru Nanak Dev Engineering College diljot6791@wordpress.com
3. freeCAD
Installation
freeCAD
pyhton scripts
Drawing sheet
Contents
1 freeCAD
2 Installation
3 freeCAD
4 pyhton scripts
line script
circle script
cube script
cylinder script
fusion script using macro
fusion script
bottle script
5 Drawing sheet
How to show object in drawing sheet
Drawing sheet of object
Guru Nanak Dev Engineering College diljot6791@wordpress.com
4. freeCAD
Installation
freeCAD
pyhton scripts
Drawing sheet
Contents
1 freeCAD
2 Installation
3 freeCAD
4 pyhton scripts
line script
circle script
cube script
cylinder script
fusion script using macro
fusion script
bottle script
5 Drawing sheet
How to show object in drawing sheet
Drawing sheet of object
Guru Nanak Dev Engineering College diljot6791@wordpress.com
5. freeCAD
Installation
freeCAD
pyhton scripts
Drawing sheet
Contents
1 freeCAD
2 Installation
3 freeCAD
4 pyhton scripts
line script
circle script
cube script
cylinder script
fusion script using macro
fusion script
bottle script
5 Drawing sheet
How to show object in drawing sheet
Drawing sheet of object
Guru Nanak Dev Engineering College diljot6791@wordpress.com
6. freeCAD
Installation
freeCAD
pyhton scripts
Drawing sheet
Contents
1 freeCAD
2 Installation
3 freeCAD
4 pyhton scripts
line script
circle script
cube script
cylinder script
fusion script using macro
fusion script
bottle script
5 Drawing sheet
How to show object in drawing sheet
Drawing sheet of object
Guru Nanak Dev Engineering College diljot6791@wordpress.com
7. freeCAD
Installation
freeCAD
pyhton scripts
Drawing sheet
Introduction
Introduction
FreeCAD is a general purpose Open Source 3D CAD
modeler, aimed directly at mechanical engineering and
product design but also fits in a wider range of uses around
engineering, such as architecture or other engineering
specialties. It is a feature-based parametric modeler with a
modular software architecture which makes it easy to provide
additional functionality without modifying the core system.
Guru Nanak Dev Engineering College diljot6791@wordpress.com
8. freeCAD
Installation
freeCAD
pyhton scripts
Drawing sheet
Figure: Freecad software
Guru Nanak Dev Engineering College diljot6791@wordpress.com
9. freeCAD
Installation
freeCAD
pyhton scripts
Drawing sheet
Installation
Installation of freeCAD software
Download the package freeCAD software from the following
link:
https://sourceforge.net/projects/free-cad/
Guru Nanak Dev Engineering College diljot6791@wordpress.com
10. freeCAD
Installation
freeCAD
pyhton scripts
Drawing sheet
Features
1 FreeCAD is multi-platform. It runs and behaves exactly
the same way on Windows Linux and Mac OSX
platforms.
2 FreeCAD also runs as a command line application, with
low memory footprint. In command line mode, FreeCAD
runs without its interface, but with all its geometry
tools. It can be, for example, used as server to produce
content for other applications.
3 FreeCAD can be imported as a Python module, inside
other applications that can run python scripts, or in a
python console.
Guru Nanak Dev Engineering College diljot6791@wordpress.com
11. freeCAD
Installation
freeCAD
pyhton scripts
Drawing sheet
Features
1 FreeCAD is multi-platform. It runs and behaves exactly
the same way on Windows Linux and Mac OSX
platforms.
2 FreeCAD also runs as a command line application, with
low memory footprint. In command line mode, FreeCAD
runs without its interface, but with all its geometry
tools. It can be, for example, used as server to produce
content for other applications.
3 FreeCAD can be imported as a Python module, inside
other applications that can run python scripts, or in a
python console.
Guru Nanak Dev Engineering College diljot6791@wordpress.com
12. freeCAD
Installation
freeCAD
pyhton scripts
Drawing sheet
Features
1 FreeCAD is multi-platform. It runs and behaves exactly
the same way on Windows Linux and Mac OSX
platforms.
2 FreeCAD also runs as a command line application, with
low memory footprint. In command line mode, FreeCAD
runs without its interface, but with all its geometry
tools. It can be, for example, used as server to produce
content for other applications.
3 FreeCAD can be imported as a Python module, inside
other applications that can run python scripts, or in a
python console.
Guru Nanak Dev Engineering College diljot6791@wordpress.com
13. freeCAD
Installation
freeCAD
pyhton scripts
Drawing sheet
Features
1 FreeCAD is multi-platform. It runs and behaves exactly
the same way on Windows Linux and Mac OSX
platforms.
2 FreeCAD also runs as a command line application, with
low memory footprint. In command line mode, FreeCAD
runs without its interface, but with all its geometry
tools. It can be, for example, used as server to produce
content for other applications.
3 FreeCAD can be imported as a Python module, inside
other applications that can run python scripts, or in a
python console.
Guru Nanak Dev Engineering College diljot6791@wordpress.com
14. freeCAD
Installation
freeCAD
pyhton scripts
Drawing sheet
Features
4 Built-in scripting framework: FreeCAD features a
built-in Python interpreter, and an API that covers
almost any part of the application, the interface, the
geometry and the representation of this geometry in the
3D viewer. The interpreter can run single commands up
to complex scripts, in fact entire modules can even be
programmed completely in Python.
5 a modular MSI installer allows flexible installations on
Windows systems. Packages for Ubuntu systems are also
maintained.
Guru Nanak Dev Engineering College diljot6791@wordpress.com
15. freeCAD
Installation
freeCAD
pyhton scripts
Drawing sheet
Features
4 Built-in scripting framework: FreeCAD features a
built-in Python interpreter, and an API that covers
almost any part of the application, the interface, the
geometry and the representation of this geometry in the
3D viewer. The interpreter can run single commands up
to complex scripts, in fact entire modules can even be
programmed completely in Python.
5 a modular MSI installer allows flexible installations on
Windows systems. Packages for Ubuntu systems are also
maintained.
Guru Nanak Dev Engineering College diljot6791@wordpress.com
16. freeCAD
Installation
freeCAD
pyhton scripts
Drawing sheet
Features
4 Built-in scripting framework: FreeCAD features a
built-in Python interpreter, and an API that covers
almost any part of the application, the interface, the
geometry and the representation of this geometry in the
3D viewer. The interpreter can run single commands up
to complex scripts, in fact entire modules can even be
programmed completely in Python.
5 a modular MSI installer allows flexible installations on
Windows systems. Packages for Ubuntu systems are also
maintained.
Guru Nanak Dev Engineering College diljot6791@wordpress.com
17. line script
circle script
freeCAD
cube script
Installation
cylinder script
freeCAD
fusion script using macro
pyhton scripts
Drawing sheet
fusion script
bottle script
Python script in freeCAD
line script
import Part,PartGui
doc=App.newDocument()
l=Part.Line()
l.StartPoint=(0.0,0.0,0.0)
l.EndPoint=(1.0,1.0,1.0)
doc.addObject("Part::Feature","Line").
Shape=l.toShape()
doc.recompute()
Guru Nanak Dev Engineering College diljot6791@wordpress.com
18. line script
circle script
freeCAD
cube script
Installation
cylinder script
freeCAD
fusion script using macro
pyhton scripts
Drawing sheet
fusion script
bottle script
Figure: image of line
Guru Nanak Dev Engineering College diljot6791@wordpress.com
19. line script
circle script
freeCAD
cube script
Installation
cylinder script
freeCAD
fusion script using macro
pyhton scripts
Drawing sheet
fusion script
bottle script
Python script in freeCAD
circle script
import Part,PartGui
doc=App.newDocument()
c=Part.Circle()
c.Radius=10.0
f=doc.addObject("Part::Feature", "Circle").
Shape=c.toShape()
doc.recompute()
Guru Nanak Dev Engineering College diljot6791@wordpress.com
20. line script
circle script
freeCAD
cube script
Installation
cylinder script
freeCAD
fusion script using macro
pyhton scripts
Drawing sheet
fusion script
bottle script
Figure: image of circle
Guru Nanak Dev Engineering College diljot6791@wordpress.com
21. line script
circle script
freeCAD
cube script
Installation
cylinder script
freeCAD
fusion script using macro
pyhton scripts
Drawing sheet
fusion script
bottle script
Python script in freeCAD
cube script
import Part,PartGui
doc=App.newDocument()
App.ActiveDocument.addObject("Part::Box",
"Box")
App.ActiveDocument.Box.Length=10.00
App.ActiveDocument.Box.Width=10.00
App.ActiveDocument.Box.Height=10.00
doc.recompute()
Guru Nanak Dev Engineering College diljot6791@wordpress.com
22. line script
circle script
freeCAD
cube script
Installation
cylinder script
freeCAD
fusion script using macro
pyhton scripts
Drawing sheet
fusion script
bottle script
Figure: image of cube
Guru Nanak Dev Engineering College diljot6791@wordpress.com
23. line script
circle script
freeCAD
cube script
Installation
cylinder script
freeCAD
fusion script using macro
pyhton scripts
Drawing sheet
fusion script
bottle script
Python script in freeCAD
cylinder script
import Part,PartGui
doc=App.newDocument()
App.ActiveDocument.addObject("Part::Cylinder",
"Cylinder")
App.ActiveDocument.Cylinder.Radius=80.00
App.ActiveDocument.Cylinder.Height=100.00
App.ActiveDocument.Cylinder.Angle=360.00
doc.recompute()
Guru Nanak Dev Engineering College diljot6791@wordpress.com
24. line script
circle script
freeCAD
cube script
Installation
cylinder script
freeCAD
fusion script using macro
pyhton scripts
Drawing sheet
fusion script
bottle script
Figure: image of cylinder
Guru Nanak Dev Engineering College diljot6791@wordpress.com
25. line script
circle script
freeCAD
cube script
Installation
cylinder script
freeCAD
fusion script using macro
pyhton scripts
Drawing sheet
fusion script
bottle script
Python script in freeCAD
fusion script using macro
import Part,PartGui
doc=App.newDocument()
# Create three boxes and a cylinder
App.ActiveDocument.addObject("Part::Box","Box")
App.ActiveDocument.Box.Length=100.00
App.ActiveDocument.Box.Width=100.00
App.ActiveDocument.Box.Height=100.00
App.ActiveDocument.addObject("Part::Box","Box1")
App.ActiveDocument.Box1.Length=90.00
App.ActiveDocument.Box1.Width=40.00
App.ActiveDocument.Box1.Height=100.00
Guru Nanak Dev Engineering College diljot6791@wordpress.com
26. line script
circle script
freeCAD
cube script
Installation
cylinder script
freeCAD
fusion script using macro
pyhton scripts
Drawing sheet
fusion script
bottle script
Python script in freeCAD
fusion script using macro
App.ActiveDocument.addObject("Part::Box","Box2")
App.ActiveDocument.Box2.Length=20.00
App.ActiveDocument.Box2.Width=85.00
App.ActiveDocument.Box2.Height=100.00
App.ActiveDocument.addObject("Part::Cylinder",
"Cylinder")
App.ActiveDocument.Cylinder.Radius=80.00
App.ActiveDocument.Cylinder.Height=100.00
App.ActiveDocument.Cylinder.Angle=360.00
Guru Nanak Dev Engineering College diljot6791@wordpress.com
27. line script
circle script
freeCAD
cube script
Installation
cylinder script
freeCAD
fusion script using macro
pyhton scripts
Drawing sheet
fusion script
bottle script
Python script in freeCAD
fusion script using macro
# Fuse two boxes and the cylinder
App.activeDocument().addObject("Part::Fuse",
"Fusion")
App.activeDocument().Fusion.Base = App.
activeDocument().Cylinder
App.activeDocument().Fusion.Tool = App.
activeDocument().Box1
App.activeDocument().addObject("Part::Fuse","Fusion1")
App.activeDocument().Fusion1.Base =
App.activeDocument().Box2
App.activeDocument().Fusion1.Tool =
Guru Nanak Dev Engineering College diljot6791@wordpress.com
28. line script
circle script
freeCAD
cube script
Installation
cylinder script
freeCAD
fusion script using macro
pyhton scripts
Drawing sheet
fusion script
bottle script
Python script in freeCAD
fusion script using macro
# Cut the fused shapes from the first box
App.activeDocument().addObject("Part::Cut","Shape")
App.activeDocument().Shape.Base =
App.activeDocument().Box
App.activeDocument().Shape.Tool =
App.activeDocument().Fusion1
Guru Nanak Dev Engineering College diljot6791@wordpress.com
29. line script
circle script
freeCAD
cube script
Installation
cylinder script
freeCAD
fusion script using macro
pyhton scripts
Drawing sheet
fusion script
bottle script
Python script in freeCAD
fusion script using macro
# Hide all the intermediate shapes
Gui.activeDocument().Box.Visibility=False
Gui.activeDocument().Box1.Visibility=False
Gui.activeDocument().Box2.Visibility=False
Gui.activeDocument().Cylinder.Visibility=False
Gui.activeDocument().Fusion.Visibility=False
Gui.activeDocument().Fusion1.Visibility=False
doc.recompute()
Guru Nanak Dev Engineering College diljot6791@wordpress.com
30. line script
circle script
freeCAD
cube script
Installation
cylinder script
freeCAD
fusion script using macro
pyhton scripts
Drawing sheet
fusion script
bottle script
Figure: image of line
Guru Nanak Dev Engineering College diljot6791@wordpress.com
31. line script
circle script
freeCAD
cube script
Installation
cylinder script
freeCAD
fusion script using macro
pyhton scripts
Drawing sheet
fusion script
bottle script
Python script in freeCAD
fusion script
import Part,PartGui
doc=App.newDocument()
Part.show(Part.makeBox(100,100,100).cut(Part.
makeCylinder(80,100)).cut(Part.makeBox(90,40,100)).
cut(Part.makeBox(20,85,100)))
Shape = App.ActiveDocument.Shape.Shape
print "visible edges:", len(visibleG0.Edges)
doc.recompute()
Guru Nanak Dev Engineering College diljot6791@wordpress.com
32. line script
circle script
freeCAD
cube script
Installation
cylinder script
freeCAD
fusion script using macro
pyhton scripts
Drawing sheet
fusion script
bottle script
Figure: image of object
Guru Nanak Dev Engineering College diljot6791@wordpress.com
33. line script
circle script
freeCAD
cube script
Installation
cylinder script
freeCAD
fusion script using macro
pyhton scripts
Drawing sheet
fusion script
bottle script
Python script in freeCAD
bottle script
import Part
import MakeBottle
bottle = MakeBottle.makeBottle()
Part.show(bottle)
Guru Nanak Dev Engineering College diljot6791@wordpress.com
34. line script
circle script
freeCAD
cube script
Installation
cylinder script
freeCAD
fusion script using macro
pyhton scripts
Drawing sheet
fusion script
bottle script
Figure: image of bottle
Guru Nanak Dev Engineering College diljot6791@wordpress.com
35. freeCAD How to show object in drawing sheet
Installation Drawing sheet of object
freeCAD Drawing sheet of bottle
pyhton scripts Drawing sheet of table
Drawing sheet python script to change 3D object to 2D on Drawing
How to show object in drawing sheet in freeCAD
Drawing sheet
1 Firsty, to show the drawing view open the script in
freeCAD and run it.
2 Go to view > workbench > Drawing. This will open the
drawing sheet.
3 Now, select the object click on insert button to insert
the drawing view of object. This will insert the page of
drawing sheet. Select the object and click on button and
this will insert the part object in the drawing view. Now
click on view to insert the the object in drawing sheet.
Guru Nanak Dev Engineering College diljot6791@wordpress.com
36. freeCAD How to show object in drawing sheet
Installation Drawing sheet of object
freeCAD Drawing sheet of bottle
pyhton scripts Drawing sheet of table
Drawing sheet python script to change 3D object to 2D on Drawing
How to show object in drawing sheet in freeCAD
Drawing sheet
1 Firsty, to show the drawing view open the script in
freeCAD and run it.
2 Go to view > workbench > Drawing. This will open the
drawing sheet.
3 Now, select the object click on insert button to insert
the drawing view of object. This will insert the page of
drawing sheet. Select the object and click on button and
this will insert the part object in the drawing view. Now
click on view to insert the the object in drawing sheet.
Guru Nanak Dev Engineering College diljot6791@wordpress.com
37. freeCAD How to show object in drawing sheet
Installation Drawing sheet of object
freeCAD Drawing sheet of bottle
pyhton scripts Drawing sheet of table
Drawing sheet python script to change 3D object to 2D on Drawing
How to show object in drawing sheet in freeCAD
Drawing sheet
1 Firsty, to show the drawing view open the script in
freeCAD and run it.
2 Go to view > workbench > Drawing. This will open the
drawing sheet.
3 Now, select the object click on insert button to insert
the drawing view of object. This will insert the page of
drawing sheet. Select the object and click on button and
this will insert the part object in the drawing view. Now
click on view to insert the the object in drawing sheet.
Guru Nanak Dev Engineering College diljot6791@wordpress.com
38. freeCAD How to show object in drawing sheet
Installation Drawing sheet of object
freeCAD Drawing sheet of bottle
pyhton scripts Drawing sheet of table
Drawing sheet python script to change 3D object to 2D on Drawing
How to show object in drawing sheet in freeCAD
Drawing sheet
1 Firsty, to show the drawing view open the script in
freeCAD and run it.
2 Go to view > workbench > Drawing. This will open the
drawing sheet.
3 Now, select the object click on insert button to insert
the drawing view of object. This will insert the page of
drawing sheet. Select the object and click on button and
this will insert the part object in the drawing view. Now
click on view to insert the the object in drawing sheet.
Guru Nanak Dev Engineering College diljot6791@wordpress.com
39. freeCAD How to show object in drawing sheet
Installation Drawing sheet of object
freeCAD Drawing sheet of bottle
pyhton scripts Drawing sheet of table
Drawing sheet python script to change 3D object to 2D on Drawing
drawing sheet in freeCAD
Drawing sheet
4 To change the scale, click on scale button in the combo
view and change the size of the object according to your
requirment.
5 To change the rotation, click on rotation button in
combo view and change the coordinates of x,y,z in
combo view.
Guru Nanak Dev Engineering College diljot6791@wordpress.com
40. freeCAD How to show object in drawing sheet
Installation Drawing sheet of object
freeCAD Drawing sheet of bottle
pyhton scripts Drawing sheet of table
Drawing sheet python script to change 3D object to 2D on Drawing
drawing sheet in freeCAD
Drawing sheet
4 To change the scale, click on scale button in the combo
view and change the size of the object according to your
requirment.
5 To change the rotation, click on rotation button in
combo view and change the coordinates of x,y,z in
combo view.
Guru Nanak Dev Engineering College diljot6791@wordpress.com
41. freeCAD How to show object in drawing sheet
Installation Drawing sheet of object
freeCAD Drawing sheet of bottle
pyhton scripts Drawing sheet of table
Drawing sheet python script to change 3D object to 2D on Drawing
drawing sheet in freeCAD
Drawing sheet
4 To change the scale, click on scale button in the combo
view and change the size of the object according to your
requirment.
5 To change the rotation, click on rotation button in
combo view and change the coordinates of x,y,z in
combo view.
Guru Nanak Dev Engineering College diljot6791@wordpress.com
42. freeCAD How to show object in drawing sheet
Installation Drawing sheet of object
freeCAD Drawing sheet of bottle
pyhton scripts Drawing sheet of table
Drawing sheet python script to change 3D object to 2D on Drawing
Figure: Drawing view of object
Guru Nanak Dev Engineering College diljot6791@wordpress.com
43. freeCAD How to show object in drawing sheet
Installation Drawing sheet of object
freeCAD Drawing sheet of bottle
pyhton scripts Drawing sheet of table
Drawing sheet python script to change 3D object to 2D on Drawing
Figure: Drawing view of bottle
Guru Nanak Dev Engineering College diljot6791@wordpress.com
44. freeCAD How to show object in drawing sheet
Installation Drawing sheet of object
freeCAD Drawing sheet of bottle
pyhton scripts Drawing sheet of table
Drawing sheet python script to change 3D object to 2D on Drawing
Figure: Drawing view of table
Guru Nanak Dev Engineering College diljot6791@wordpress.com
45. freeCAD How to show object in drawing sheet
Installation Drawing sheet of object
freeCAD Drawing sheet of bottle
pyhton scripts Drawing sheet of table
Drawing sheet python script to change 3D object to 2D on Drawing
Any Question?
Guru Nanak Dev Engineering College diljot6791@wordpress.com
46. freeCAD How to show object in drawing sheet
Installation Drawing sheet of object
freeCAD Drawing sheet of bottle
pyhton scripts Drawing sheet of table
Drawing sheet python script to change 3D object to 2D on Drawing
Thank You
Diljot Kaur
95011
Guru Nanak Dev Engineering College diljot6791@wordpress.com