Esempio n. 1
0
def get_cube(basepoint, length):
    def scale( point ):
        return ( (basepoint[0]+point[0]*length),
                 (basepoint[1]+point[1]*length),
                 (basepoint[2]+point[2]*length))
    pface = dxf.polyface()
    # cube corner points
    p1 = scale( (0,0,0) )
    p2 = scale( (0,0,1) )
    p3 = scale( (0,1,0) )
    p4 = scale( (0,1,1) )
    p5 = scale( (1,0,0) )
    p6 = scale( (1,0,1) )
    p7 = scale( (1,1,0) )
    p8 = scale( (1,1,1) )

    # define the 6 cube faces
    # look into -x direction
    # Every add_face adds 4 vertices 6x4 = 24 vertices
    # On dxf output double vertices will be removed.
    pface.add_face([p1, p5, p7, p3], color=1) # base
    pface.add_face([p1, p5, p6, p2], color=2) # left
    pface.add_face([p5, p7, p8, p6], color=3) # front
    pface.add_face([p7, p8, p4, p3], color=4) # right
    pface.add_face([p1, p3, p4, p2], color=5) # back
    pface.add_face([p2, p6, p8, p4], color=6) # top
    return pface
Esempio n. 2
0
def get_cube(basepoint, length):
    def scale(point):
        return ((basepoint[0] + point[0] * length),
                (basepoint[1] + point[1] * length),
                (basepoint[2] + point[2] * length))

    pface = dxf.polyface()
    # cube corner points
    p1 = scale((0, 0, 0))
    p2 = scale((0, 0, 1))
    p3 = scale((0, 1, 0))
    p4 = scale((0, 1, 1))
    p5 = scale((1, 0, 0))
    p6 = scale((1, 0, 1))
    p7 = scale((1, 1, 0))
    p8 = scale((1, 1, 1))

    # define the 6 cube faces
    # look into -x direction
    # Every add_face adds 4 vertices 6x4 = 24 vertices
    # On dxf output double vertices will be removed.
    pface.add_face([p1, p5, p7, p3], color=1)  # base
    pface.add_face([p1, p5, p6, p2], color=2)  # left
    pface.add_face([p5, p7, p8, p6], color=3)  # front
    pface.add_face([p7, p8, p4, p3], color=4)  # right
    pface.add_face([p1, p3, p4, p2], color=5)  # back
    pface.add_face([p2, p6, p8, p4], color=6)  # top
    return pface
Esempio n. 3
0
def export_dxf(glider, path="", midribs=0, numpoints=None, *other):
    outfile = dxf.drawing(path)
    other = glider.copy_complete()
    if numpoints:
        other.numpoints = numpoints
    ribs = other.return_ribs(midribs)
    panels = []
    points = []
    outfile.add_layer('RIBS', color=2)
    for rib in ribs:
        outfile.add(dxf.polyface(rib * 1000, layer='RIBS'))
        outfile.add(dxf.polyline(rib * 1000, layer='RIBS'))
    return outfile.save()
Esempio n. 4
0
def simple_faces():
    pface = dxf.polyface()
    p1 = (0,0,0)
    p2 = (0,1,0)
    p3 = (1,1,0)
    p4 = (1,0,0)

    p5 = (0,0,1)
    p6 = (0,1,1)
    p7 = (1,1,1)
    p8 = (1,0,1)

    pface.add_face([p1, p2, p3, p4]) # base
    pface.add_face([p5, p6, p7, p8]) # top
    return pface
Esempio n. 5
0
def simple_faces():
    pface = dxf.polyface()
    p1 = (0, 0, 0)
    p2 = (0, 1, 0)
    p3 = (1, 1, 0)
    p4 = (1, 0, 0)

    p5 = (0, 0, 1)
    p6 = (0, 1, 1)
    p7 = (1, 1, 1)
    p8 = (1, 0, 1)

    pface.add_face([p1, p2, p3, p4])  # base
    pface.add_face([p5, p6, p7, p8])  # top
    return pface
Esempio n. 6
0
def room_to_polyface(fp, room_id):

	# prepare the polyface object
	pface = dxf.polyface()

	# add each triangle to the face
	for ti in fp.room_tris[room_id]:

		# get the vertices of this triangle
		(i,j,k) = fp.tris[ti]

		# add this triangle to the polyface
		pface.add_face( [ fp.verts[i], fp.verts[j], fp.verts[k] ] )

	# return the final polyface
	return pface