def circle(radius=1.0, center=(0., 0.), **kwargs): """ Create a new circle-entity. :param float radius: circle radius :param center: center point (xy- or xyz-tuple), z-axis is 0 by default """ return Circle(radius=radius, center=center, **kwargs)
def setup(drawing): """ Insert necessary definitions into drawing: - ticks: DIMTICK_ARCH, DIMTICK_DOT, DIMTICK_ARROW - layers: DIMENSIONS """ # default pen assignment: # 1 : 1.40mm - red # 2 : 0.35mm - yellow # 3 : 0.70mm - green # 4 : 0.50mm - cyan # 5 : 0.13mm - blue # 6 : 1.00mm - magenta # 7 : 0.25mm - white/black # 8, 9 : 2.00mm # >=10 : 1.40mm def block(name, elements): """ Create the block entity """ tick = Block(name=name, basepoint=(0., 0.)) for element in elements: tick.add(element) return tick dimcolor = dimstyles.default.dimextlinecolor byblock = const.BYBLOCK elements = [ Line(start=(0., +.5), end=(0., -.5), color=dimcolor, layer=byblock), Line(start=(-.2, -.2), end=(.2, +.2), color=4, layer=byblock) ] drawing.blocks.add(block('DIMTICK_ARCH', elements)) elements = [ Line(start=(0., .5), end=(0., -.5), color=dimcolor, layer=byblock), Circle(radius=.1, color=4, layer=byblock) ] drawing.blocks.add(block('DIMTICK_DOT', elements)) elements = [ Line(start=(0., .5), end=(0., -.50), color=dimcolor, layer=byblock), Solid([(0, 0), (.3, .05), (.3, -.05)], color=7, layer=byblock) ] drawing.blocks.add(block('DIMTICK_ARROW', elements)) elements = [ # special tick for RadialDimension Solid([(0, 0), (.3, .05), (0.25, 0.), (.3, -.05)], color=7, layer=byblock) ] drawing.blocks.add(block('DIMTICK_RADIUS', elements))
def test_circle_2d_center(self): circle = Circle(center=(0, 0), radius=1) expected = " 0\nCIRCLE\n 8\n0\n 10\n0.0\n 20\n0.0\n 30\n0.0\n 40\n1.0\n" self.assertEqual(dxfstr(circle), expected)
def test_circle_no_attributes(self): circle = Circle() expected = " 0\nCIRCLE\n 8\n0\n 10\n0.0\n 20\n0.0\n 30\n0.0\n 40\n1.0\n" self.assertEqual(dxfstr(circle), expected)