To create object with the code of existing object you should select existing object first and then directly create a new one.
Refer to Create line object, Create point object, Create polygon (area) object).