Skip to content

Commit

Permalink
Introduced ell primitive with example
Browse files Browse the repository at this point in the history
  • Loading branch information
Killthebug committed May 7, 2018
1 parent 1ec4e71 commit a0973c5
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 1 deletion.
31 changes: 31 additions & 0 deletions examples/elip.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import sys
import sys
import os
from math import atan
from math import degrees

from python_brlcad_tcl.brlcad_tcl import *

class elip_example(BrlCadModel):
def __init__(self, brl_db):
super(elip_example, self).__init__(brl_db)
v = (0, 0, 0)
a = (10, 0, 0)
b = (0, 10, 0)
c = (0, 0, 10)
brl_db.Ellipsoid("ellipsoid", v, a, b, c)

def main(argv):
#with wdb.WDB(argv[1], "My Database") as brl_db:
with brlcad_tcl(argv[1], "My Database") as brl_db:
new_ellipsoid = elip_example(brl_db)
# All units in the database file are stored in millimeters. This constrains
# the arguments to the mk_* routines to also be in millimeters.
# process the tcl script into a g database by calling mged
brl_db.save_g()
# process the g database into an STL file with a list of regions
#brl_db.save_stl(['room', 'mainroof', 'roof_window1', 'roof_window2'])
brl_db.save_stl(['elip_example'])

if __name__ == "__main__":
main(sys.argv)
16 changes: 15 additions & 1 deletion python_brlcad_tcl/brlcad_tcl.py
Original file line number Diff line number Diff line change
Expand Up @@ -871,8 +871,22 @@ def Cylinder_hyperbolic(self, name, rhc,vertex, height_vector, bvector, half_wid
def Cylinder_parabolic(self, name, rpc, vertex, height_vector, bvector, half_width):
is_string(name)

def Ellipsoid(self, name, ell, vertex, avector, bvector, cvector):
def Ellipsoid(self, name, vertex, avector, bvector, cvector):
is_string(name)
is_truple(vertex)
is_truple(avector)
is_truple(bvector)
is_truple(cvector)
v1, v2, v3 = vertex
a1, a2, a3 = avector
b1, b2, b3 = bvector
c1, c2, c3 = cvector
self.script_string_list.append('in {} ell {} {} {} {} {} {} {} {} {} {} {} {}\n'.format(name,
v1, v2, v3,
a1, a2, a3,
b1, b2, b3,
c1, c2, c3))
return name

def Hyperboloid_elliptical(self, name, ehy, vertex, height_vector, avector, bscalar, apex_to_asymptote):
is_string(name)
Expand Down

0 comments on commit a0973c5

Please sign in to comment.