Skip to content

Commit

Permalink
Example scripts using third angle projection added
Browse files Browse the repository at this point in the history
  • Loading branch information
danielhatton authored Aug 29, 2021
1 parent 2cab759 commit 2f7efb8
Show file tree
Hide file tree
Showing 6 changed files with 699 additions and 0 deletions.
110 changes: 110 additions & 0 deletions EXAMPLES/Anisotropic_part_third.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
# This is file Anisotropic_part_third.py

# This is an example script intended to be distributed as part of a
# software library centred on file eights.py

# Anisotropic_part_third.py and eights.py were written by Dr. Daniel C. Hatton

# Material up to and including release 0.2 copyright (C) 2017
# University of Plymouth Higher Education Corporation

# Changes since release 0.2 copyright (C) 2020-2021 Dr. Daniel C. Hatton

# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation: version 3 of the
# License.

# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License, and the GNU General Public License
# which it incorporates, for more details.

# You should have received a copy of the GNU Lesser General Public
# License [in file ../LICENSE] along with this program. If not,
# see <https://www.gnu.org/licenses/>.

# Daniel Hatton thanks Dr. Justin E. Rigden, Specialist Intellectual
# Property Advisor, for authorizing, on behalf of the University of
# Plymouth Higher Education Corporation, the release of this program
# under the licence terms stated above.

# Daniel Hatton can be contacted on <[email protected]>

import FreeCAD
import Part
import eights

pagesize = 'A3'
pageorientation = 'Landscape'
creator = 'Joe D. Draftsman'
longtitle = 'A very important anisotropic part'
legalowner = 'Acme Design Company'
approver = 'Jane C. Manager'
doctype = 'part drawing'
docstatus = 'for review'
sheetnum = 4
totalsheets = 6
inversescale = 2
partnumber = 'P1'
partlist = partnumber
drawingnum = 'TRY4'
year = 2020
month = 6
day = 26
revision = 'A'

# All distances in millimetres

conelargediameter = 15.0
conesmalldiameter = 7.5
drawingviewspacing = 5.0
symbolviewspacing = drawingviewspacing/3.0
symbolxposition = 190.0
symbolyposition = 280.0

C1side = 100.0
C1posn = FreeCAD.Vector(0.0,0.0,0.0)
theshape = Part.makeBox(0.5*C1side,C1side,1.5*C1side,C1posn)
scale = 1.0/inversescale
drawingxposn = 100.0
drawingyposn = 40.0

thedocument = FreeCAD.newDocument("try_it")

pagetitle = "try_this_bit"

page_creator = eights.create_eights_drawing_sheet(thedocument, pagetitle,
pagesize, pageorientation,
creator,
longtitle,
legalowner,
approver,
doctype,
docstatus,
sheetnum, totalsheets,
inversescale, partlist,
drawingnum, year,
month, day, revision)
dummyone = page_creator.create_it('putanyoldrubbishhere')

thepage = thedocument.getObject(pagetitle)

symbol_adder = eights.add_third_angle_projection_symbol(conelargediameter,
conesmalldiameter,
symbolviewspacing,
symbolxposition,
symbolyposition,
thepage)
dummytwo = symbol_adder.put_it_in('putanyoldrubbishhere')

drawings_adder = eights.third_angle_projection(partnumber, theshape,
drawingviewspacing,
drawingxposn,
drawingyposn,
scale,thepage)

dummythree = drawings_adder.tap('putanyoldrubbishhere')

Gui.getDocument("try_it").show("try_this_bit")
117 changes: 117 additions & 0 deletions EXAMPLES/Assembly_back_third.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
# This is file Assembly_back_third.py

# This is an example script intended to be distributed as part of a
# software library centred on file eights.py

# Assembly_back_third.py and eights.py were written by Dr. Daniel C. Hatton

# Material up to and including release 0.2 copyright (C) 2017
# University of Plymouth Higher Education Corporation

# Changes since release 0.2 copyright (C) 2020-2021 Dr. Daniel C. Hatton

# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation: version 3 of the
# License.

# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License, and the GNU General Public License
# which it incorporates, for more details.

# You should have received a copy of the GNU Lesser General Public
# License [in file ../LICENSE] along with this program. If not, see
# <https://www.gnu.org/licenses/>.

# Daniel Hatton thanks Dr. Justin E. Rigden, Specialist Intellectual
# Property Advisor, for authorizing, on behalf of the University of
# Plymouth Higher Education Corporation, the release of this program
# under the licence terms stated above.

# Daniel Hatton can be contacted on <[email protected]>

import FreeCAD
import Part
import eights

pagesize = 'A3'
pageorientation = 'Landscape'
creator = 'Joe D. Draftsman'
longtitle = 'A very important assembly laying on its back'
legalowner = 'Acme Design Company'
approver = 'Jane C. Manager'
doctype = 'assembly drawing'
docstatus = 'for review'
sheetnum = 6
totalsheets = 6
inversescale = 2
firstpartnumber = 'C2'
secondpartnumber = 'S1'
partlist = firstpartnumber+','+secondpartnumber
drawingnum = 'TRY6'
year = 2020
month = 6
day = 26
revision = 'A'

# All distances in millimetres

conelargediameter = 15.0
conesmalldiameter = 7.5
drawingviewspacing = 5.0
symbolviewspacing = drawingviewspacing/3.0
symbolxposition = 190.0
symbolyposition = 280.0

C1side = 100.0
C1posn = FreeCAD.Vector(0.0,0.0,0.0)
thefirstshape = Part.makeBox(C1side,C1side,C1side,C1posn)
scale = 1.0/inversescale
drawingxposn = 30.0
drawingyposn = 15.0
S1diam = 100.0
S1posn = FreeCAD.Vector(S1diam/2.0,3.0*S1diam/2.0,S1diam/2.0)
thesecondshape = Part.makeSphere(S1diam/2.0,S1posn)
scale = 1.0/inversescale

theshape = thefirstshape.fuse(thesecondshape)

thedocument = FreeCAD.newDocument("try_it")

pagetitle = "try_this_bit"

page_creator = eights.create_eights_drawing_sheet(thedocument, pagetitle,
pagesize, pageorientation,
creator,
longtitle,
legalowner,
approver,
doctype,
docstatus,
sheetnum, totalsheets,
inversescale, partlist,
drawingnum, year,
month, day, revision)
dummyone = page_creator.create_it('putanyoldrubbishhere')

thepage = thedocument.getObject(pagetitle)

symbol_adder = eights.add_third_angle_projection_symbol(conelargediameter,
conesmalldiameter,
symbolviewspacing,
symbolxposition,
symbolyposition,
thepage)
dummytwo = symbol_adder.put_it_in('putanyoldrubbishhere')

drawings_adder = eights.third_angle_projection('Assembly', theshape,
drawingviewspacing,
drawingxposn,
drawingyposn,
scale,thepage)

dummythree = drawings_adder.tap('putanyoldrubbishhere')

Gui.getDocument("try_it").show("try_this_bit")
117 changes: 117 additions & 0 deletions EXAMPLES/Assembly_side_third.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
# This is file Assembly_side_third.py

# This is an example script intended to be distributed as part of a
# software library centred on file eights.py

# Assembly_side_third.py and eights.py were written by Dr. Daniel C. Hatton

# Material up to and including release 0.2 copyright (C) 2017
# University of Plymouth Higher Education Corporation

# Changes since release 0.2 copyright (C) 2020-2021 Dr. Daniel C. Hatton

# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation: version 3 of the
# License.

# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License, and the GNU General Public License
# which it incorporates, for more details.

# You should have received a copy of the GNU Lesser General Public
# License [in file ../LICENSE] along with this program. If not, see
# <https://www.gnu.org/licenses/>.

# Daniel Hatton thanks Dr. Justin E. Rigden, Specialist Intellectual
# Property Advisor, for authorizing, on behalf of the University of
# Plymouth Higher Education Corporation, the release of this program
# under the licence terms stated above.

# Daniel Hatton can be contacted on <[email protected]>

import FreeCAD
import Part
import eights

pagesize = 'A3'
pageorientation = 'Landscape'
creator = 'Joe D. Draftsman'
longtitle = 'A very important assembly laying on its side'
legalowner = 'Acme Design Company'
approver = 'Jane C. Manager'
doctype = 'assembly drawing'
docstatus = 'for review'
sheetnum = 5
totalsheets = 6
inversescale = 2
firstpartnumber = 'C2'
secondpartnumber = 'S1'
partlist = firstpartnumber+','+secondpartnumber
drawingnum = 'TRY5'
year = 2020
month = 6
day = 26
revision = 'A'

# All distances in millimetres

conelargediameter = 15.0
conesmalldiameter = 7.5
drawingviewspacing = 5.0
symbolviewspacing = drawingviewspacing/3.0
symbolxposition = 190.0
symbolyposition = 280.0

C1side = 100.0
C1posn = FreeCAD.Vector(0.0,0.0,0.0)
thefirstshape = Part.makeBox(C1side,C1side,C1side,C1posn)
scale = 1.0/inversescale
drawingxposn = 50.0
drawingyposn = 40.0
S1diam = 100.0
S1posn = FreeCAD.Vector(3.0*S1diam/2.0,S1diam/2.0,S1diam/2.0)
thesecondshape = Part.makeSphere(S1diam/2.0,S1posn)
scale = 1.0/inversescale

theshape = thefirstshape.fuse(thesecondshape)

thedocument = FreeCAD.newDocument("try_it")

pagetitle = "try_this_bit"

page_creator = eights.create_eights_drawing_sheet(thedocument, pagetitle,
pagesize, pageorientation,
creator,
longtitle,
legalowner,
approver,
doctype,
docstatus,
sheetnum, totalsheets,
inversescale, partlist,
drawingnum, year,
month, day, revision)
dummyone = page_creator.create_it('putanyoldrubbishhere')

thepage = thedocument.getObject(pagetitle)

symbol_adder = eights.add_third_angle_projection_symbol(conelargediameter,
conesmalldiameter,
symbolviewspacing,
symbolxposition,
symbolyposition,
thepage)
dummytwo = symbol_adder.put_it_in('putanyoldrubbishhere')

drawings_adder = eights.third_angle_projection('Assembly', theshape,
drawingviewspacing,
drawingxposn,
drawingyposn,
scale,thepage)

dummythree = drawings_adder.tap('putanyoldrubbishhere')

Gui.getDocument("try_it").show("try_this_bit")
Loading

0 comments on commit 2f7efb8

Please sign in to comment.