46
freeCAD Installation freeCAD pyhton scripts Drawing sheet freeCAD open source CAD Diljot kaur [email protected] Dept. of Computer Science October 16, 2011 Guru Nanak Dev Engineering College [email protected]

6 week training presentation

Embed Size (px)

DESCRIPTION

This presenation on my project freeCAD

Citation preview

Page 1: 6 week training presentation

freeCADInstallation

freeCADpyhton scriptsDrawing sheet

freeCADopen source CAD

Diljot [email protected]

Dept. of Computer Science

October 16, 2011

Guru Nanak Dev Engineering College [email protected]

Page 2: 6 week training presentation

freeCADInstallation

freeCADpyhton scriptsDrawing sheet

Contents1 freeCAD2 Installation3 freeCAD4 pyhton scripts

line scriptcircle scriptcube scriptcylinder scriptfusion script using macrofusion scriptbottle script

5 Drawing sheetHow to show object in drawing sheetDrawing sheet of objectDrawing sheet of bottleDrawing sheet of tablepython script to change 3D object to 2D on Drawing

Guru Nanak Dev Engineering College [email protected]

Page 3: 6 week training presentation

freeCADInstallation

freeCADpyhton scriptsDrawing sheet

Contents1 freeCAD2 Installation3 freeCAD4 pyhton scripts

line scriptcircle scriptcube scriptcylinder scriptfusion script using macrofusion scriptbottle script

5 Drawing sheetHow to show object in drawing sheetDrawing sheet of objectDrawing sheet of bottleDrawing sheet of tablepython script to change 3D object to 2D on Drawing

Guru Nanak Dev Engineering College [email protected]

Page 4: 6 week training presentation

freeCADInstallation

freeCADpyhton scriptsDrawing sheet

Contents1 freeCAD2 Installation3 freeCAD4 pyhton scripts

line scriptcircle scriptcube scriptcylinder scriptfusion script using macrofusion scriptbottle script

5 Drawing sheetHow to show object in drawing sheetDrawing sheet of objectDrawing sheet of bottleDrawing sheet of tablepython script to change 3D object to 2D on Drawing

Guru Nanak Dev Engineering College [email protected]

Page 5: 6 week training presentation

freeCADInstallation

freeCADpyhton scriptsDrawing sheet

Contents1 freeCAD2 Installation3 freeCAD4 pyhton scripts

line scriptcircle scriptcube scriptcylinder scriptfusion script using macrofusion scriptbottle script

5 Drawing sheetHow to show object in drawing sheetDrawing sheet of objectDrawing sheet of bottleDrawing sheet of tablepython script to change 3D object to 2D on Drawing

Guru Nanak Dev Engineering College [email protected]

Page 6: 6 week training presentation

freeCADInstallation

freeCADpyhton scriptsDrawing sheet

Contents1 freeCAD2 Installation3 freeCAD4 pyhton scripts

line scriptcircle scriptcube scriptcylinder scriptfusion script using macrofusion scriptbottle script

5 Drawing sheetHow to show object in drawing sheetDrawing sheet of objectDrawing sheet of bottleDrawing sheet of tablepython script to change 3D object to 2D on Drawing

Guru Nanak Dev Engineering College [email protected]

Page 7: 6 week training presentation

freeCADInstallation

freeCADpyhton scriptsDrawing sheet

Introduction

Introduction

FreeCAD is a general purpose Open Source 3D CADmodeler, aimed directly at mechanical engineering andproduct design but also fits in a wider range of uses aroundengineering, such as architecture or other engineeringspecialties. It is a feature-based parametric modeler with amodular software architecture which makes it easy to provideadditional functionality without modifying the core system.

Guru Nanak Dev Engineering College [email protected]

Page 8: 6 week training presentation

freeCADInstallation

freeCADpyhton scriptsDrawing sheet

Figure: Freecad software

Guru Nanak Dev Engineering College [email protected]

Page 9: 6 week training presentation

freeCADInstallation

freeCADpyhton scriptsDrawing sheet

Installation

Installation of freeCAD software

Download the package freeCAD software from the followinglink:https://sourceforge.net/projects/free-cad/

Guru Nanak Dev Engineering College [email protected]

Page 10: 6 week training presentation

freeCADInstallation

freeCADpyhton scriptsDrawing sheet

Features

1 FreeCAD is multi-platform. It runs and behaves exactlythe same way on Windows Linux and Mac OSXplatforms.

2 FreeCAD also runs as a command line application, withlow memory footprint. In command line mode, FreeCADruns without its interface, but with all its geometrytools. It can be, for example, used as server to producecontent for other applications.

3 FreeCAD can be imported as a Python module, insideother applications that can run python scripts, or in apython console.

Guru Nanak Dev Engineering College [email protected]

Page 11: 6 week training presentation

freeCADInstallation

freeCADpyhton scriptsDrawing sheet

Features

1 FreeCAD is multi-platform. It runs and behaves exactlythe same way on Windows Linux and Mac OSXplatforms.

2 FreeCAD also runs as a command line application, withlow memory footprint. In command line mode, FreeCADruns without its interface, but with all its geometrytools. It can be, for example, used as server to producecontent for other applications.

3 FreeCAD can be imported as a Python module, insideother applications that can run python scripts, or in apython console.

Guru Nanak Dev Engineering College [email protected]

Page 12: 6 week training presentation

freeCADInstallation

freeCADpyhton scriptsDrawing sheet

Features

1 FreeCAD is multi-platform. It runs and behaves exactlythe same way on Windows Linux and Mac OSXplatforms.

2 FreeCAD also runs as a command line application, withlow memory footprint. In command line mode, FreeCADruns without its interface, but with all its geometrytools. It can be, for example, used as server to producecontent for other applications.

3 FreeCAD can be imported as a Python module, insideother applications that can run python scripts, or in apython console.

Guru Nanak Dev Engineering College [email protected]

Page 13: 6 week training presentation

freeCADInstallation

freeCADpyhton scriptsDrawing sheet

Features

1 FreeCAD is multi-platform. It runs and behaves exactlythe same way on Windows Linux and Mac OSXplatforms.

2 FreeCAD also runs as a command line application, withlow memory footprint. In command line mode, FreeCADruns without its interface, but with all its geometrytools. It can be, for example, used as server to producecontent for other applications.

3 FreeCAD can be imported as a Python module, insideother applications that can run python scripts, or in apython console.

Guru Nanak Dev Engineering College [email protected]

Page 14: 6 week training presentation

freeCADInstallation

freeCADpyhton scriptsDrawing sheet

Features

4 Built-in scripting framework: FreeCAD features abuilt-in Python interpreter, and an API that coversalmost any part of the application, the interface, thegeometry and the representation of this geometry in the3D viewer. The interpreter can run single commands upto complex scripts, in fact entire modules can even beprogrammed completely in Python.

5 a modular MSI installer allows flexible installations onWindows systems. Packages for Ubuntu systems are alsomaintained.

Guru Nanak Dev Engineering College [email protected]

Page 15: 6 week training presentation

freeCADInstallation

freeCADpyhton scriptsDrawing sheet

Features

4 Built-in scripting framework: FreeCAD features abuilt-in Python interpreter, and an API that coversalmost any part of the application, the interface, thegeometry and the representation of this geometry in the3D viewer. The interpreter can run single commands upto complex scripts, in fact entire modules can even beprogrammed completely in Python.

5 a modular MSI installer allows flexible installations onWindows systems. Packages for Ubuntu systems are alsomaintained.

Guru Nanak Dev Engineering College [email protected]

Page 16: 6 week training presentation

freeCADInstallation

freeCADpyhton scriptsDrawing sheet

Features

4 Built-in scripting framework: FreeCAD features abuilt-in Python interpreter, and an API that coversalmost any part of the application, the interface, thegeometry and the representation of this geometry in the3D viewer. The interpreter can run single commands upto complex scripts, in fact entire modules can even beprogrammed completely in Python.

5 a modular MSI installer allows flexible installations onWindows systems. Packages for Ubuntu systems are alsomaintained.

Guru Nanak Dev Engineering College [email protected]

Page 17: 6 week training presentation

freeCADInstallation

freeCADpyhton scriptsDrawing sheet

line scriptcircle scriptcube scriptcylinder scriptfusion script using macro

fusion scriptbottle 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 [email protected]

Page 18: 6 week training presentation

freeCADInstallation

freeCADpyhton scriptsDrawing sheet

line scriptcircle scriptcube scriptcylinder scriptfusion script using macro

fusion scriptbottle script

Figure: image of line

Guru Nanak Dev Engineering College [email protected]

Page 19: 6 week training presentation

freeCADInstallation

freeCADpyhton scriptsDrawing sheet

line scriptcircle scriptcube scriptcylinder scriptfusion script using macro

fusion scriptbottle 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 [email protected]

Page 20: 6 week training presentation

freeCADInstallation

freeCADpyhton scriptsDrawing sheet

line scriptcircle scriptcube scriptcylinder scriptfusion script using macro

fusion scriptbottle script

Figure: image of circle

Guru Nanak Dev Engineering College [email protected]

Page 21: 6 week training presentation

freeCADInstallation

freeCADpyhton scriptsDrawing sheet

line scriptcircle scriptcube scriptcylinder scriptfusion script using macro

fusion scriptbottle 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 [email protected]

Page 22: 6 week training presentation

freeCADInstallation

freeCADpyhton scriptsDrawing sheet

line scriptcircle scriptcube scriptcylinder scriptfusion script using macro

fusion scriptbottle script

Figure: image of cube

Guru Nanak Dev Engineering College [email protected]

Page 23: 6 week training presentation

freeCADInstallation

freeCADpyhton scriptsDrawing sheet

line scriptcircle scriptcube scriptcylinder scriptfusion script using macro

fusion scriptbottle 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 [email protected]

Page 24: 6 week training presentation

freeCADInstallation

freeCADpyhton scriptsDrawing sheet

line scriptcircle scriptcube scriptcylinder scriptfusion script using macro

fusion scriptbottle script

Figure: image of cylinder

Guru Nanak Dev Engineering College [email protected]

Page 25: 6 week training presentation

freeCADInstallation

freeCADpyhton scriptsDrawing sheet

line scriptcircle scriptcube scriptcylinder scriptfusion script using macro

fusion scriptbottle 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.00Guru Nanak Dev Engineering College [email protected]

Page 26: 6 week training presentation

freeCADInstallation

freeCADpyhton scriptsDrawing sheet

line scriptcircle scriptcube scriptcylinder scriptfusion script using macro

fusion scriptbottle 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 [email protected]

Page 27: 6 week training presentation

freeCADInstallation

freeCADpyhton scriptsDrawing sheet

line scriptcircle scriptcube scriptcylinder scriptfusion script using macro

fusion scriptbottle 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 =

App.activeDocument().FusionGuru Nanak Dev Engineering College [email protected]

Page 28: 6 week training presentation

freeCADInstallation

freeCADpyhton scriptsDrawing sheet

line scriptcircle scriptcube scriptcylinder scriptfusion script using macro

fusion scriptbottle 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 [email protected]

Page 29: 6 week training presentation

freeCADInstallation

freeCADpyhton scriptsDrawing sheet

line scriptcircle scriptcube scriptcylinder scriptfusion script using macro

fusion scriptbottle 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 [email protected]

Page 30: 6 week training presentation

freeCADInstallation

freeCADpyhton scriptsDrawing sheet

line scriptcircle scriptcube scriptcylinder scriptfusion script using macro

fusion scriptbottle script

Figure: image of line

Guru Nanak Dev Engineering College [email protected]

Page 31: 6 week training presentation

freeCADInstallation

freeCADpyhton scriptsDrawing sheet

line scriptcircle scriptcube scriptcylinder scriptfusion script using macro

fusion scriptbottle 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 [email protected]

Page 32: 6 week training presentation

freeCADInstallation

freeCADpyhton scriptsDrawing sheet

line scriptcircle scriptcube scriptcylinder scriptfusion script using macro

fusion scriptbottle script

Figure: image of object

Guru Nanak Dev Engineering College [email protected]

Page 33: 6 week training presentation

freeCADInstallation

freeCADpyhton scriptsDrawing sheet

line scriptcircle scriptcube scriptcylinder scriptfusion script using macro

fusion scriptbottle script

Python script in freeCAD

bottle script

import Part

import MakeBottle

bottle = MakeBottle.makeBottle()

Part.show(bottle)

Guru Nanak Dev Engineering College [email protected]

Page 34: 6 week training presentation

freeCADInstallation

freeCADpyhton scriptsDrawing sheet

line scriptcircle scriptcube scriptcylinder scriptfusion script using macro

fusion scriptbottle script

Figure: image of bottle

Guru Nanak Dev Engineering College [email protected]

Page 35: 6 week training presentation

freeCADInstallation

freeCADpyhton scriptsDrawing sheet

How to show object in drawing sheetDrawing sheet of objectDrawing sheet of bottleDrawing sheet of tablepython 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 infreeCAD and run it.

2 Go to view > workbench > Drawing. This will open thedrawing sheet.

3 Now, select the object click on insert button to insertthe drawing view of object. This will insert the page ofdrawing sheet. Select the object and click on button andthis will insert the part object in the drawing view. Nowclick on view to insert the the object in drawing sheet.

Guru Nanak Dev Engineering College [email protected]

Page 36: 6 week training presentation

freeCADInstallation

freeCADpyhton scriptsDrawing sheet

How to show object in drawing sheetDrawing sheet of objectDrawing sheet of bottleDrawing sheet of tablepython 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 infreeCAD and run it.

2 Go to view > workbench > Drawing. This will open thedrawing sheet.

3 Now, select the object click on insert button to insertthe drawing view of object. This will insert the page ofdrawing sheet. Select the object and click on button andthis will insert the part object in the drawing view. Nowclick on view to insert the the object in drawing sheet.

Guru Nanak Dev Engineering College [email protected]

Page 37: 6 week training presentation

freeCADInstallation

freeCADpyhton scriptsDrawing sheet

How to show object in drawing sheetDrawing sheet of objectDrawing sheet of bottleDrawing sheet of tablepython 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 infreeCAD and run it.

2 Go to view > workbench > Drawing. This will open thedrawing sheet.

3 Now, select the object click on insert button to insertthe drawing view of object. This will insert the page ofdrawing sheet. Select the object and click on button andthis will insert the part object in the drawing view. Nowclick on view to insert the the object in drawing sheet.

Guru Nanak Dev Engineering College [email protected]

Page 38: 6 week training presentation

freeCADInstallation

freeCADpyhton scriptsDrawing sheet

How to show object in drawing sheetDrawing sheet of objectDrawing sheet of bottleDrawing sheet of tablepython 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 infreeCAD and run it.

2 Go to view > workbench > Drawing. This will open thedrawing sheet.

3 Now, select the object click on insert button to insertthe drawing view of object. This will insert the page ofdrawing sheet. Select the object and click on button andthis will insert the part object in the drawing view. Nowclick on view to insert the the object in drawing sheet.

Guru Nanak Dev Engineering College [email protected]

Page 39: 6 week training presentation

freeCADInstallation

freeCADpyhton scriptsDrawing sheet

How to show object in drawing sheetDrawing sheet of objectDrawing sheet of bottleDrawing sheet of tablepython 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 comboview and change the size of the object according to yourrequirment.

5 To change the rotation, click on rotation button incombo view and change the coordinates of x,y,z incombo view.

Guru Nanak Dev Engineering College [email protected]

Page 40: 6 week training presentation

freeCADInstallation

freeCADpyhton scriptsDrawing sheet

How to show object in drawing sheetDrawing sheet of objectDrawing sheet of bottleDrawing sheet of tablepython 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 comboview and change the size of the object according to yourrequirment.

5 To change the rotation, click on rotation button incombo view and change the coordinates of x,y,z incombo view.

Guru Nanak Dev Engineering College [email protected]

Page 41: 6 week training presentation

freeCADInstallation

freeCADpyhton scriptsDrawing sheet

How to show object in drawing sheetDrawing sheet of objectDrawing sheet of bottleDrawing sheet of tablepython 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 comboview and change the size of the object according to yourrequirment.

5 To change the rotation, click on rotation button incombo view and change the coordinates of x,y,z incombo view.

Guru Nanak Dev Engineering College [email protected]

Page 42: 6 week training presentation

freeCADInstallation

freeCADpyhton scriptsDrawing sheet

How to show object in drawing sheetDrawing sheet of objectDrawing sheet of bottleDrawing sheet of tablepython script to change 3D object to 2D on Drawing

Figure: Drawing view of object

Guru Nanak Dev Engineering College [email protected]

Page 43: 6 week training presentation

freeCADInstallation

freeCADpyhton scriptsDrawing sheet

How to show object in drawing sheetDrawing sheet of objectDrawing sheet of bottleDrawing sheet of tablepython script to change 3D object to 2D on Drawing

Figure: Drawing view of bottle

Guru Nanak Dev Engineering College [email protected]

Page 44: 6 week training presentation

freeCADInstallation

freeCADpyhton scriptsDrawing sheet

How to show object in drawing sheetDrawing sheet of objectDrawing sheet of bottleDrawing sheet of tablepython script to change 3D object to 2D on Drawing

Figure: Drawing view of table

Guru Nanak Dev Engineering College [email protected]

Page 45: 6 week training presentation

freeCADInstallation

freeCADpyhton scriptsDrawing sheet

How to show object in drawing sheetDrawing sheet of objectDrawing sheet of bottleDrawing sheet of tablepython script to change 3D object to 2D on Drawing

Any Question?

Guru Nanak Dev Engineering College [email protected]

Page 46: 6 week training presentation

freeCADInstallation

freeCADpyhton scriptsDrawing sheet

How to show object in drawing sheetDrawing sheet of objectDrawing sheet of bottleDrawing sheet of tablepython script to change 3D object to 2D on Drawing

Thank You

Diljot Kaur95011

Guru Nanak Dev Engineering College [email protected]