From: Mike Scott on
David Evans wrote:
> My most valuable use of OpenOffice is the drawing package.
>
> The coordinates of the end points of lines are stored in the system but
> not available to the user.
>
> It would be very helpful if the coordinates of such points were made
> available to the user.
>
> Would that be possible ?

R-click on a line and select position and size, then select the tab of
the same name. This shows the position (x,y) of one end of the line plus
the distance (delta_x, delta_y) to the other end. It's not hard to add
them together :-) And arguably the existing way is the more useful.


(BTW, if you start a new topic, please don't just reply to and change
the subject line of an existing email. That causes your message to
appear down in the depths of another thread of conversation, where it
may be unseen by those who might otherwise offer help.)

--
Mike Scott mike <at> <removeme>.scottsonline.org.uk
Harlow Essex England

---------------------------------------------------------------------
To unsubscribe, e-mail: discuss-unsubscribe(a)openoffice.org
For additional commands, e-mail: discuss-help(a)openoffice.org

From: David Evans on
Hi Mark

Thank you for that advice but what I am looking for is a file of all
of the coordinates so that I could do additional things with them
outside openoffice.

I am using this for architectural work as an alternative to
autocad. Clients love the colour coding it enables.

Kind regards
David


>David Evans wrote:
>>My most valuable use of OpenOffice is the drawing package.
>>The coordinates of the end points of lines are stored in the system
>>but not available to the user.
>>It would be very helpful if the coordinates of such points were
>>made available to the user.
>>Would that be possible ?
>
>R-click on a line and select position and size, then select the tab
>of the same name. This shows the position (x,y) of one end of the
>line plus the distance (delta_x, delta_y) to the other end. It's not
>hard to add them together :-) And arguably the existing way is the
>more useful.
>
>
>(BTW, if you start a new topic, please don't just reply to and
>change the subject line of an existing email. That causes your
>message to appear down in the depths of another thread of
>conversation, where it may be unseen by those who might otherwise offer help.)
>
>--
>Mike Scott mike <at> <removeme>.scottsonline.org.uk
>Harlow Essex England
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: discuss-unsubscribe(a)openoffice.org
>For additional commands, e-mail: discuss-help(a)openoffice.org


---------------------------------------------------------------------
To unsubscribe, e-mail: discuss-unsubscribe(a)openoffice.org
For additional commands, e-mail: discuss-help(a)openoffice.org

From: Christian Lippka on
Hi David,

an ODG document is just a zip file. So you can open it with any
zip tool (maybe have to rename it to .zip). In this zip is a
content.xml. For each line you find something like this

<draw:line draw:style-name="gr1" draw:text-style-name="P1"
draw:layer="layout" svg:x1="8cm" svg:y1="9.5cm" svg:x2="16.5cm"
svg:y2="13cm">

Now this line goes from 8cm/9.5cm to 16cm/13cm.

There are many tools to deal with zip and xml. If you know
java you can google for "odf toolkit". Another option is
to write a basic macro or OOo extension to export all lines.

Regards,
Christian

Am 29.06.2010 17:19, schrieb David Evans:
> Hi Mark
>
> Thank you for that advice but what I am looking for is a file of all of
> the coordinates so that I could do additional things with them outside
> openoffice.
>
> I am using this for architectural work as an alternative to autocad.
> Clients love the colour coding it enables.
>
> Kind regards
> David
>
>
>> David Evans wrote:
>>> My most valuable use of OpenOffice is the drawing package.
>>> The coordinates of the end points of lines are stored in the system
>>> but not available to the user.
>>> It would be very helpful if the coordinates of such points were made
>>> available to the user.
>>> Would that be possible ?
>>
>> R-click on a line and select position and size, then select the tab of
>> the same name. This shows the position (x,y) of one end of the line
>> plus the distance (delta_x, delta_y) to the other end. It's not hard
>> to add them together :-) And arguably the existing way is the more
>> useful.
>>
>>
>> (BTW, if you start a new topic, please don't just reply to and change
>> the subject line of an existing email. That causes your message to
>> appear down in the depths of another thread of conversation, where it
>> may be unseen by those who might otherwise offer help.)
>>
>> --
>> Mike Scott mike <at> <removeme>.scottsonline.org.uk
>> Harlow Essex England
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: discuss-unsubscribe(a)openoffice.org
>> For additional commands, e-mail: discuss-help(a)openoffice.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: discuss-unsubscribe(a)openoffice.org
> For additional commands, e-mail: discuss-help(a)openoffice.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: discuss-unsubscribe(a)openoffice.org
For additional commands, e-mail: discuss-help(a)openoffice.org

From: Mike Scott on
David Evans wrote:
> Hi Mark
>
> Thank you for that advice but what I am looking for is a file of all of
> the coordinates so that I could do additional things with them outside
> openoffice.
>
> I am using this for architectural work as an alternative to autocad.
> Clients love the colour coding it enables.

Helps to be 101% clear on what you're after!

The .odg file is just a zip file in disguise. Extract the content.xml
component and parse it. You'll find chunks like

<draw:line draw:style-name="gr1" draw:text-style-name="P2"
draw:layer="layout" svg:x1="5cm" svg:y1="4.5cm" svg:x2="16cm"
svg:y2="12.5cm">
<text:p text:style-name="P1">Line the first</text:p>
</draw:line>

describing the lines in your document. (The text is what you can type
into Draw after double-clicking the line.)


(BTW top posting is also frowned upon in many circles. It might be wise
to 'go with the flow'.)



--
Mike Scott mike <at> <removeme>.scottsonline.org.uk
Harlow Essex England

---------------------------------------------------------------------
To unsubscribe, e-mail: discuss-unsubscribe(a)openoffice.org
For additional commands, e-mail: discuss-help(a)openoffice.org

From: Mike Scott on
David Evans wrote:
> Hi Mark
>
> Thank you for that advice but what I am looking for is a file of all of
> the coordinates so that I could do additional things with them outside
> openoffice.
>
> I am using this for architectural work as an alternative to autocad.
> Clients love the colour coding it enables.

I've just put the appended perl script together. No pretenses about good
coding, and it makes probably unwarranted assumptions about the xml file
structure. It prints a list of the straight lines in a drawing as
x1 y1 x2 y2 text
tab separated.
No concessions to weird characters or xml quirks, but gives a flavour of
what a naive approach to xml parsing can do. May offer ideas at least.


(You may have trouble with line wrap; in particular the text starting
"$xml =~ " is supposed to be a single line). Oh, usual disclaimer -
supplied as-is, no warranty, check it yourself, use at own risk, don't
blame me if your computer blows up or the world comes to an end :-)



#!/usr/bin/perl -w

use Archive::Zip;
use Archive::Zip::MemberRead;

die "no file given\n" unless $ARGV[0];

# load the xml into one long string
$zip = Archive::Zip->new($ARGV[0]) or die "ooops!\n";
$fh = Archive::Zip::MemberRead->new($zip, "content.xml") or die "no
content.xml\n";

my $xml = '';

while (defined(my $line = $fh->getline())) {
$xml .= ' ' . $line;
}

$fh->close();


# parse out the lines and print the coordinate
while(1) {
$xml =~ m~<draw:line[^>]+?svg:x1="([^"]+?)" svg:y1="([^"]+?)"
svg:x2="([^"]+?)"
svg:y2="([^"]+?)"><text:p[^>]+>([^<]*?)</text:p></draw:line>(.*)$~ or last;
##<draw:line draw:style-name="gr1" draw:text-style-name="P2"
draw:layer="layout" svg:x1="7cm" svg:y1="18cm" svg:x2="16cm"
svg:y2="12.5cm"><text:p text:style-name="P1">Line two</text:p></draw:line>

print "$1\t$2\t$3\t$4\t$5\n";

$xml = $6;
}



--
Mike Scott mike <at> <removeme>.scottsonline.org.uk
Harlow Essex England

---------------------------------------------------------------------
To unsubscribe, e-mail: discuss-unsubscribe(a)openoffice.org
For additional commands, e-mail: discuss-help(a)openoffice.org