Subscribe to this thread
Home - General / All posts - Save and reapply theme fill colours
Louise Semaj67 post(s)
#19-Mar-15 02:07

I have a number of geological maps with many many geological units shown. I want to allocate specific colours to each geological unit (rock code) (ie group of polygons), and then be able to take those specific colours by rock code to other drawings and manifold files. So I have 2 questions.

1. Can I have a field in a table that relates to fill colour - eg RGB? other?

2. Can I save and export a theme and reapply to another drawing / project?

This forum never fails to delight.. Many thanks one and all

Kind Regards

adamw


10,447 post(s)
#19-Mar-15 06:13

You can color by field value, and you can export a theme and apply it to another drawing / project, yes.

See this Help topic: Thematic Formatting

KlausDE

6,410 post(s)
online
#19-Mar-15 21:59

I have written a Format Organizer for this common task that copies the complete set of formatting properties (drawings, themes, labels and their layers) in one step. The difference to Tims tool basically is that it stores formatting in XML files in a folder.

Short english howto at the bottum of the page. Click "<download starten>"


Do you really want to ruin economy only to save the planet?

Louise Semaj67 post(s)
#21-Mar-15 22:03

Thanks Klaus. This looks great. I have had a go at downloading, but without any joy at this time. This is what I have done, please see if you can see where I can gone wrong....

I went to the bottom of your screen to <download starten>, and downloaded a folder 'Format Organizer' and unzipped and copied that folder to my ManifoldSystem\config\Format Organizer. I went into each of the files and Unblocked them - 3 files in the root area, and one in a sub folder 'de'. (Are the files right in the folder FormatOrganizer, or do I need to copy the files into the root area? - I tried this also but no luck)

I then started Manifold and navigated to Tools/AddIns/Format Organizer - This opens up a blank dialog box entitled Format Organiser - but the box is empty.

Can you see where I have gone wrong please? I am running 32 bit - I didn't see anywhere I could select 32 or 64bit options?

Many thanks again for your assistance

KlausDE

6,410 post(s)
online
#21-Mar-15 22:27

sorry. I have to update the installation notice. The complete filesystem in the zipfile should be extracted in the config folder. Put all the files in a subfolder add-ins\.

-> ...\config\add-ins\Format Organizer\..


Do you really want to ruin economy only to save the planet?

Louise Semaj67 post(s)
#21-Mar-15 23:10

Yes, that works now - From what I can see it takes all formatting (Lines, colours, patterns etc), at once which is great, rather than a single xml export for each feature.., So, please confirm for me, I can go from one drawing direct to another drawing, or from a drawing to a library, or from library to a drawing... Drawing and text are separate exports.. What about Map files and Parent? How do they work? What does disinherit theme do? Many thanks again Klaus, Great Add in , Kind regards.

KlausDE

6,410 post(s)
online
#22-Mar-15 08:42

So, please confirm for me, I can go from one drawing direct to another drawing,

Yes

or from a drawing to a library, or from library to a drawing...

Yes

Drawing and text are separate exports..

Yes, Drawings and Labels are seperate exports. We work on single Components....

What about Map files and Parent? How do they work?

A map only shows formating properties of the layers and these are transfered. Use themes like drawings. Inherited formats are copied but not as inherited from a possible parent of the target theme.

What does disinherit theme do?

Nothing. I didn't find a way to implemt it. Themes by default inherit formatings of the parent marked by the small corners in the format toolbar. You can change this and assign a destinct format. But I didn't find a way to reestablish the default state of inherited formatings. Hints welcome, low priority.

Btw the Format library is just a collection of manifold formating export files. You are free to use only some of the styles or use them for a different property (area background->point foreground,...) manually.

Copy 'extended formats' not only copies the format styles in strict sense but zoom ranges as well which are essential for a similar appearance.


Do you really want to ruin economy only to save the planet?

Louise Semaj67 post(s)
#22-Mar-15 20:55

OK, Got it thanks Klaus...

However, please also see my issue below - I still have an issue even with your method of exporting / applying saved themes.. see thread below and attachments - colours don't apply - only default colour.. Any comments most welcome here please. Kind regards

Louise Semaj67 post(s)
#09-Apr-15 07:11

Just wanted to let you know how much I am using and enjoying your format organiser - what a great tool... Many thanks again, Kind regards...

Louise Semaj67 post(s)
#21-Mar-15 21:45

Many thanks Adam. I have tried this option but still not quite doing what I am chasing... See attached. I have a drawing Ten1 showing polygons. I have coloured them and saved a theme file Theme.xml. (attached). I then have drawing Ten2 (larger subset of polygons, some of which are contained in Ten1) . I try to load the saved theme.xml, but it does not colour the areas as expected - colours all as default colour pink. Am I doing something wrong here, or do the values in the fields I am colouring need to be the same? (I wouldn't have thought so). (ie Ten1 is a subset of Ten2). Any further comments most welcome.

Attachments:
ThematicColour.map
Theme.xml

tjhb
10,094 post(s)
#21-Mar-15 22:19

or do the values in the fields I am colouring need to be the same?

A value needs to be the same, for its object to receive the same formatting. Yes.

But this is partly the case in your data, between drawings [Ten1] and [Ten 2].

The range of values in [Ten2] is a superset of the values in [Ten1]. 17 values are shared, and 23 are novel.

So I think we would expect that for [Ten2], loading the theme saved for [Ten1] would give the saved colours for the 17 shared values, and the default colour for the remaining 23 different values.

That doesn't happen. All get the default colour. In the Format dialog, all values get a tally of 0, even the 17 shared values.

I don't think that's intended behaviour, though I might be wrong.

Louise Semaj67 post(s)
#21-Mar-15 23:11

Many thanks Tim, So you have confirmed that you get the same behaviour that I see. Like I thought, not as expected..

tjhb
10,094 post(s)
#22-Mar-15 00:04

Yes I think I repeated exactly what you had said in different words.

tjhb
10,094 post(s)
#19-Mar-15 07:38

Do you still have IronPython installed?

I have IronPython add-ins to save formatting from active drawings and themes to comments in XML format, and to restore formatting from comments to drawings and themes.

Can share this if useful.

Louise Semaj67 post(s)
#21-Mar-15 22:04

Hi Tim, Yes I still have IP - Would love to try if you are able to post. Many thanks

tjhb
10,094 post(s)
#21-Mar-15 22:44

Not as sophisticated as Klaus's tool, but convenient for me.

This is designed for the situation where you format drawing or theme components in one project, and want a quick way to replicate the same formatting (for each component) in a different project, or later.

Restoring formatting relies on a matching name + " formatting". If you want to load formatting to a component with a different name, adjust the name of the comments component.

For saving and loading:

If a drawing or theme is open in the current window, then only that component is processed.

If a map is open in the current window, then all drawings and themes in the map are processed.

Otherwise, if a folder, drawing or theme is selected in the Project pane, then that component, and any child components and dependent components, are processed.

Otherwise, the script asks if you want to process all drawing and theme components in the project.

(See the function current_drawings_themes() for a possibly better explanation.)

These files should go into Config\Format. Unblock them before you copy them there.

[This won't solve your current issue.]

Attachments:
Format.xml
Restore format attributes.py
Save format attributes.py

Louise Semaj67 post(s)
#21-Mar-15 23:12

I will give it a go too, Many thanks

Louise Semaj67 post(s)
#22-Mar-15 21:02

Hi Tim,

How do I ...

(See the function current_drawings_themes() for a possibly better explanation.).

I think I got it to work.. However I have the same issue as above, even with the identical drawing (100% overlap). Save format for Ten 1, then reformat Ten 1 and try to reapply, but just get the default colour? Any help please? May be something to do with my Ten 1 data?

tjhb
10,094 post(s)
#23-Mar-15 00:12

Yes, the issue persists. Still thinking about this (and testing).

Easier question:

How do I ...

(See the function current_drawings_themes() for a possibly better explanation.).

Open one of the Python files in a text editor. There are some comments in that function which might help:

def current_drawings_themes():

    # List of current drawing(s) and theme(s)

    # The first of these to be satisfied:

    #    (1) the drawing or theme open in the active window,

    #        or if the active component is a map,

    #        all drawings and themes in the map

    #        (without other child themes)

    #    (2) the drawing or theme selected in the Project pane

    #        and any child themes

    #        or the drawings and themes in the folder selected in the Project pane

    #        and any child themes

    #        with recursion into subfolders and child themes

    #    (3) all drawings and themes in the project

    #        (with user confirmation)

tjhb
10,094 post(s)
#23-Mar-15 00:17

Louise,

even with the identical drawing (100% overlap). Save format for Ten 1, then reformat Ten 1 and try to reapply, but just get the default colour? Any help please? May be something to do with my Ten 1 data?

That's a very good test. What could be clearer? I get exactly the same thing.

This *must* be a bug. Will you report it?

If I find a workaround I'll let you know.

Tim

tjhb
10,094 post(s)
#23-Mar-15 00:29

There is a workaround--for the trivial case where you want to restore formatting to the same component (or a component with the same data).

After restoring formatting, open the appropriate Format dialog (here Area Background | Theme). Activate the Method drop-down list, and re-select "Unique Values", then OK. [Actually I'm not sure that colours are applied in the original order.]

That's not a resolution though.

I think the issue has to do with the double spaces in the field values. E.g. "E 2800470". These don't seem to survive into the XML. Could it be part of the XML spec that double spaces are not allowed? (Does anyone know?)

You might have a proper workaround if you can rename all fields containing double spaces to include just one space? Not tested.

tjhb
10,094 post(s)
#23-Mar-15 00:36

Yep, that's it.

Replace double spaces in values with single spaces.

I'd still like to know the cause. Is it an essential feature of XML that all whitespace is collapsed to a single character?

Louise Semaj67 post(s)
#23-Mar-15 00:56

Good detective work Tim - I got to thinking it must have been to do with my data. Couple of questions:

1. How can I do a find and replace in Manifold to replace "E "(2 spaces) with "E " (1 space) in the TenID field? Can I use the transform toolbar somehow? (Would still like to know how to find/replace but I just edited manually and YES - It now works!! - Wonderful)

2. I am happy to report an issue - How do go about it please - Best I learn how I think..

Big thanks again

Graeme

990 post(s)
#23-Mar-15 01:17

Just use "edit / replace" two spaces for one and confine to field of interest. Agreed about the detective work!

Louise Semaj67 post(s)
#23-Mar-15 01:38

That worked... thanks Graeme

tjhb
10,094 post(s)
#23-Mar-15 02:46

I definitely think you should report it. Tech would want to know I'm sure.

Just send an email to tech@manifold.net with a suitable subject line, and start the email off with the line "Bug report. No reply necessary." Sample data is useful.

I'm not sure it's a bug. It's inconvenient behaviour, but it might be inherent in the translation to XML and somehow "correct". Even if it's unexpected, it might be attributable to Microsoft framework code rather than Manifold's own code.

I'm relieved we got a resolution. But do tell Tech.

Louise Semaj67 post(s)
#23-Mar-15 09:01

Thanks Tim, I have posted an issue as you recommended to tech. Now I know what the issue is, I can work around it. All sorted now.

The tools created by Klaus and Tim operate in slightly different ways... however, both work a treat...Many thanks again to the forum team for all the bits and pieces contributed... Kind regards

Manifold User Community Use Agreement Copyright (C) 2007-2021 Manifold Software Limited. All rights reserved.