On Wed, Jul 14, 2010 at 7:16 AM, Stefan Müller <warrence.stm@gmx.de> wrote:
On 13.07.2010 21:03, Hans Hagen wrote:
On 13-7-2010 6:01, Stefan Müller wrote:
Hi,

I just tried to build my own object in metaobj but for some reason I
cannot figure out it does not work. I tried the example from the metaobj
manual in a tex document (it works in a metapost file):

\startuseMPgraphic{objecttest}
vardef newSegment@#=
assignObj(@#,"Segment");
ObjPoint a,b;
ObjCode "@#b-@#a=(1cm,2cm)";
enddef;
\stopuseMPgraphic

Can you post a complete metapost file that gives some output.I tried the following mp file:
input metaobj;
vardef newSegment@#=
assignObj(@#,"Segment");
ObjPoint a,b;
ObjCode "@#b-@#a=(1cm,2cm)";
enddef;
beginfig(1) ;
newSegment.s; % create an instance
endfig ;
end;

but running it through metapost gives me an empty file:
%!PS
%%BoundingBox: 0 0 0 0
%%HiResBoundingBox: 0 0 0 0
%%Creator: MetaPost 1.208
%%CreationDate: 2010.07.15:0119
%%Pages: 1
%%BeginProlog
%%EndProlog
%%Page: 1 1
showpage
%%EOF

Aditya