Add shapes and points to a group entity and operate as one

Load main tikzpy class as follow and create points and shapes and add it to a group:

 1import tikzpy
 2
 3### Load main object
 4tikZ = tikzpy.pytikz()
 5
 6### Add point at x=0, y=0, z=0
 7p0 = tikZ.pto.pto(0,0,0)
 8
 9### Add point at x=1, y=1, z=1
10p1 = tikZ.pto.pto(1,1,1)
11
12### Create a group
13grp = tikZ.grp.addgroup("grp1")
14
15### Add shapes or points to a group
16grp.add = tikZ.shp.line(p0, p1, color = "custom_color")
17grp.add = p0
18grp.add = p1

and start bulding your drawing. More examples on how to use the group object can be found in groups examples.

Groups functions. Class -> tikzpy.grp

class cls_canavas._canavas(parent)[source]

Groups object:

Platform

Unix, Windows

Synopsis

For a given list of points and shapes, treat them as a group and defines the canavas cube that contain them.

Properties
  • Get a group by unique id. (grp = tikzpy.grp[id])

  • Set values to a group by the unique id. (tikzpy.grp[id]=pto). The shape or point will be added.

addgroup(key)[source]
Synopsis:
  • Creates a new group with a give name

Args:
  • key: unique name of the group

Returns:
  • A group object (see group)

Note

class cls_canavas._group(parent, key)[source]

Group object:

Platform

Unix, Windows

Synopsis

Group object that contains the ids of points and shapes previously added. Allows to operate with them as a group.

Properties

ivar id

get the unique key identificator

ivar add

add a point, shape or list of them

ivar ptos

return a list of the added points

ivar shps

return a list of the added shapes

ivar ptos_of_shapes

return a list of unique points forming the shapes

ivar all_ptos

return a list of unique points forming the shapes and added points

canvas(ptos=None)[source]
Synopsis:
  • Return the canavas plane positions that contain the list of points

Args:
  • ptos = None: list of points. If none given use all_ptos.

Returns:
  • [[min_x,max_x],[min_y,max_y],[min_z,max_z]] absolute position of the canavas coordinates