Python to create some entities, create a block and insert

As a newby in Python I have made a function to create a so called BaseLine (for use in Ship designs). I want to create a block directly from the new entities and insert it. I can’t find a example script to help me create a block from generated entities. The examples I found are all based on user selection first and that is not what I want. Can anybody show how to do it with a couple of different entities like a line,a circle and a text?

Thanks in advance, Erik

as far as i understand block insert in rhino, following steps are involved.

  1. create a geometry
  2. add this geometry to the rhino document to get a object (ID)
  3. create a link to this object (GeometryBase)
  4. create a BlockInstanceDefenition from the link
  5. find this BlockInstanceDefenition in your rhino document
  6. add a BlockInstanceObject (its the geometry link object)
import Rhino

# create your geometry
act_doc = Rhino.RhinoDoc.ActiveDoc
point_A = Rhino.Geometry.Point3d(0,0,0)
point_B = Rhino.Geometry.Point3d(30,0,0)
geo_line = Rhino.Geometry.Line(point_A,point_B)

# add the geometry to the rhino doc to get a rhino object
obj_Id = Rhino.RhinoDoc.ActiveDoc.Objects.AddLine(geo_line)
geo_base = Rhino.DocObjects.ObjRef(obj_Id).Geometry()

# define attributes
attr = Rhino.DocObjects.ObjectAttributes()

# create a block (InstanceDefenition) from your rhino doc object 
Rhino.RhinoDoc.ActiveDoc.InstanceDefinitions.Add('Block_test','Nothing to descripe',point_A,geo_base,attr)

# insert block object geometry to the rhino doc
trans = Rhino.Geometry.Transform.Translation(0,0,0)
for i in Rhino.RhinoDoc.ActiveDoc.InstanceDefinitions:
    if i.Name == 'Block_test':

I have no idea if this is the right way to create and insert a block but hopefully it gives you a idea how to start.