Re: IPE7: select all objects which contain a certain code in XML?

Otfried Cheong <[email protected]>
Newsgroups gmane.comp.graphics.ipe.general
Message-ID <[email protected]>
On 11/23/2011 09:09 PM, elwood151 wrote:
> (I have imported graphs of functions from another application as PDF and I
> want to format them in a consistent way:
> example: all have normal dash style ay\nd pen, but different colors.
> To display them unambigously in greyscale, the blue line shall e. g. be
> dotted and the red one shall have a different dash style and pen, etc...

It seems to me that you could save a lot of time by automating the 
process, instead of doing it manually inside Ipe.  Attached is a small 
Ipe script that changes the stroke and dash style of all objects with a 
given stroke color - you could adapt this to your needs (and also 
recognize several cases in one pass).

Cheers,
  Otfried

_______________________________________________
Ipe-discuss mailing list
Ipe-discuss-rGrgPyRx506NN8uzcEdRPYRWq/[email protected]
http://lists.science.uu.nl/mailman/listinfo/ipe-discuss
convert1.lua (text/x-lua, 615 B)
-- convert1.lua
-- For all objects with stroke = "0.188 0.49 0.949",
-- change stroke to black and dashstyle to dashed

if #argv ~= 2 then
  io.stderr:write("Usage: ipescript convert1 <inputfile> <outputfile>\n")
  return
end

inname = argv[1]
outname = argv[2]

doc = assert(ipe.Document(inname))

-- run Latex for saving later
assert(doc:runLatex())

for i,p in doc:pages() do
  for j = 1,#p do
    local obj = p[j]
    local s = obj:get("stroke")
    if s.r == 0.188 and s.g == 0.49 and s.b == 0.949 then
      obj:set("stroke", "black")
      obj:set("dashstyle", "dashed")
    end
  end
end
doc:save(outname)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.