Re: [PD] Print a big patch

2016-03-24 Thread Jack
Salut Olivier,

I guess you work with linux.
I think is doable with 'xvfb' (with which you can create a virtual
screen of any size) and the imagemagick 'import' tool (with which you
can take a snapshot of your virtual screen).
++

Jack



Le 24/03/2016 23:57, Olivier Baudu a écrit :
> Hi list,
> 
> I try to find a way to edit graphically and print a big patch (which is
> in a single window)
> I know it's possible to save it in post-script file and open it in
> vector graphic editor but this way only save the part visible on the
> screen (a part of this part to be exact).
> 
> Is there a way to get the whole patch in one file to be graphically edit ?
> 
> Thank you.
> 
> °1ivier
> 
> 
> 
> ___
> Pd-list@lists.iem.at mailing list
> UNSUBSCRIBE and account-management -> 
> http://lists.puredata.info/listinfo/pd-list
> 




signature.asc
Description: OpenPGP digital signature
___
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] Edit Pd file to change coordinates. pdlua or other language?

2016-03-24 Thread João Pais

Hi,

I tinkered around with tcl, until I think I found a version that suits my  
needs exactly:


- I reversed the selection - if {[lsearch $lineList $lineCount] < 0} {
- I commented out line  puts "lines to patch: $lineList", so that the list  
of patched lines doesn't get saved with the patch output.



It seems that the patch counts each line that begins with # as a real  
line. But since the pd txt format splits lines, it turns out that there  
are many lines that don't begin with #N. For example with the 2 objects


#N canvas 1066 230 670 662 gui 0;
#X obj 0 0 cnv 12 400 260 empty \$0-colorh-i empty 20 12 0 14 -220796
-1 0;

there are 3 lines in the text file, but the patch will only count 2.  
Adding an incr lineCount after the last "puts $patchLine" does the job of  
matching the number of lines in the text file with the line count.


Thanks very much, I think this is quite good already. I'll tinker a bit  
more to see if I find out how to also process subpatches and messages. I  
imagine that adding other if lines it could work.


Best,

Joao

changeCoords.tcl
Description: Tcl script
___
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> 
http://lists.puredata.info/listinfo/pd-list


[PD] Print a big patch

2016-03-24 Thread Olivier Baudu
Hi list,

I try to find a way to edit graphically and print a big patch (which is
in a single window)
I know it's possible to save it in post-script file and open it in
vector graphic editor but this way only save the part visible on the
screen (a part of this part to be exact).

Is there a way to get the whole patch in one file to be graphically edit ?

Thank you.

°1ivier

-- 
"On ne peut pas vivre dans un monde où l'on croit que l'élégance exquise
du plumage de la pintade est inutile. Ceci est tout à fait à part. J'ai
eu envie de le dire, je l'ai dit." Jean Giono, Un roi sans divertissement.



signature.asc
Description: OpenPGP digital signature
___
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] Edit Pd file to change coordinates. pdlua or other language?

2016-03-24 Thread João Pais

HI Fred Jan,

that sounds good. But I think you sent me the same file as before? They
are exactly alike.

I don't want to push it, but I noticed 2 details that I could mention. But
ignore them if you have better things to do:
- since I'm recording the console output of the tcl patch, only now I
noticed that it adds a first line with "lines to patch: 9 36 37 38 39..."
etc. Anyway it is ignored by Pd when loading the file, I only noticed it
by chance when I opened the pd file in a text editor
- I didn't look at the structure of the pd files clearly enough, the lines
starting with "#X restore" and "#X msg" could also be processed, for a
more coherent result.

But anyway, ignore all these if you have more interesting things to do. I
can do any testing anytime for anything - since I can't program on
anything else than Pd, at least it's my way of paying back the price of
free software.

Afaik, there isn't any rasterizer or grid alignment option - you might ask  
Jonathan Wilkes, since he's putting lots of new things into Pd2lork. Or  
maybe the community might be interested in supporting your code to improve  
patching quality - at least it could have an interesting result for you.


Best,

Joao


Hi João,

Changed the behaviour and also added some code that prevents #A and #N
lines from being changed. Make sure you proper test it, because I
didn't. Consider this the price of free software :-).

@Dan: It is Tcl, but I should look into the gui plugin interface to make
it work. And another way of selecting objects as there aren't any line
numbers within Pd. It could be converted to some kind of rasterizer or
align-to-grid option, but that may already exist...

Greetings & success,

Fred Jan


Hi Fred,

I did some testing today when I had some more time. It works great, and
if I use it in a command like  > new.pd, I get the new patch out of  
it.


If I may, I would ask for a small improvement: it would be great if the
processing would be done in the opposite way; that is, all lines with #X
obj are processed, *except* the ones given as arguments. I can also work
with the version you sent me, but for the exercises I'm thinking about,
only an exception of lines will be kept in the original way.

I tried to do it myself, but quickly I came to the conclusion that my
lack of experience with scripting languages doesn't really help me.

Thanks a lot,

Joao



Hi João,

It appeared to be a simple program in Tcl, which you should have, as it
comes with Pd.
The usage is: tclsh changeCoords.tcl patchName xcoord ycoord line1
?line2? ...
lineN arguments may be a number or a range, like 12-15.

The patch is currently dumped to the console. Only minimal checking is
done.

If you remove the #'s for the puts "..." lines, you can see some  
interim

results (which will ruin the patch format).

Greetings,

Fred Jan


___
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] Edit Pd file to change coordinates. pdlua or other language?

2016-03-24 Thread Fred Jan Kraan

Hi João,

Changed the behaviour and also added some code that prevents #A and #N 
lines from being changed. Make sure you proper test it, because I 
didn't. Consider this the price of free software :-).


@Dan: It is Tcl, but I should look into the gui plugin interface to make 
it work. And another way of selecting objects as there aren't any line 
numbers within Pd. It could be converted to some kind of rasterizer or 
align-to-grid option, but that may already exist...


Greetings & success,

Fred Jan


Hi Fred,

I did some testing today when I had some more time. It works great, and
if I use it in a command like  > new.pd, I get the new patch out of it.

If I may, I would ask for a small improvement: it would be great if the
processing would be done in the opposite way; that is, all lines with #X
obj are processed, *except* the ones given as arguments. I can also work
with the version you sent me, but for the exercises I'm thinking about,
only an exception of lines will be kept in the original way.

I tried to do it myself, but quickly I came to the conclusion that my
lack of experience with scripting languages doesn't really help me.

Thanks a lot,

Joao



Hi João,

It appeared to be a simple program in Tcl, which you should have, as it
comes with Pd.
The usage is: tclsh changeCoords.tcl patchName xcoord ycoord line1
?line2? ...
lineN arguments may be a number or a range, like 12-15.

The patch is currently dumped to the console. Only minimal checking is
done.

If you remove the #'s for the puts "..." lines, you can see some interim
results (which will ruin the patch format).

Greetings,

Fred Jan


#!/usr/bin/env tclsh
#
# changeCoords.tcl v0.2
# fjkr...@xs4all.nl

if {$argc < 4} {
error "Usage: tclsh changeCoords.tcl patchName xcoord ycoord line1 ?line2? ..."
}

set patchName [lindex $argv 0]
set xcoord[lindex $argv 1]
set ycoord[lindex $argv 2]
set lineArgCount $argc
set lineList {}

#puts "patchName $patchName; xcoord $xcoord; ycoord $ycoord lineArgCount; $lineArgCount"
# line arguments may be numeric or a numeric range "nn-mm" (inclusive)

for {set start 3} {$lineArgCount > $start} {incr start} {
set arg [lindex $argv $start]
#puts "$start: $arg"
if [regexp {(\d+)-(\d+)} $arg lineRange startLine endLine] {
if {$startLine < $endLine} {
#puts "startLine $startLine; endLine $endLine;;  $lineRange"
for {set line $startLine} {$line <= $endLine} {incr line} {
lappend lineList $line
}
}
} else {
#puts "line $arg"
lappend lineList $arg
}
}

#puts "lines not to patch: $lineList"

set lineCount 1
set f [open $patchName]
while {[gets $f patchLine] >= 0} {
if [regexp {\#[AN] } $patchLine] {
#puts -nonewline "$lineCount: "
puts $patchLine
incr lineCount
continue
}
if [regexp {\#[X] } $patchLine] {
if {[lsearch $lineList $lineCount] == -1} { # >= 0 for matching lines, == -1 for non-matching lines
if [regexp {\#X obj (\d+) (\d+) (.+)} $patchLine allOfLine orgX orgY restOfLine] {
#puts -nonewline "$lineCount: "
puts "#X obj $xcoord $ycoord $restOfLine"
} else {
#puts -nonewline "$lineCount: "
puts $patchLine
}
} else {
#puts -nonewline "$lineCount: "
puts $patchLine
}
incr lineCount
} else {
puts $patchLine
}
}
close $f
___
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] Edit Pd file to change coordinates. pdlua or other language?

2016-03-24 Thread Dan Wilcox
If it’s a tcl script, maybe it can be run from a tcl gui plugin form within pd?


Dan Wilcox
@danomatika 
danomatika.com 
robotcowboy.com 
> On Mar 24, 2016, at 5:00 AM, pd-list-requ...@lists.iem.at wrote:
> 
> Hi Fred,
> 
> I did some testing today when I had some more time. It works great, and if  
> I use it in a command like  > new.pd, I get the new patch out of it.
> 
> If I may, I would ask for a small improvement: it would be great if the  
> processing would be done in the opposite way; that is, all lines with #X  
> obj are processed, *except* the ones given as arguments. I can also work  
> with the version you sent me, but for the exercises I'm thinking about,  
> only an exception of lines will be kept in the original way.
> 
> I tried to do it myself, but quickly I came to the conclusion that my lack  
> of experience with scripting languages doesn't really help me.
> 
> Thanks a lot,
> 
> Joao
> 
> 
>> Hi João,
>> 
>> It appeared to be a simple program in Tcl, which you should have, as it
>> comes with Pd.
>> The usage is: tclsh changeCoords.tcl patchName xcoord ycoord line1
>> ?line2? ...
>> lineN arguments may be a number or a range, like 12-15.
>> 
>> The patch is currently dumped to the console. Only minimal checking is  
>> done.
>> 
>> If you remove the #'s for the puts "..." lines, you can see some interim
>> results (which will ruin the patch format).
>> 
>> Greetings,
>> 
>> Fred Jan

___
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> 
http://lists.puredata.info/listinfo/pd-list