Hi all,
There is an object similar to regexp from maxmsp?
I would line to substitute characters into spaces. For Example:
from: X:0,15Y:0,15
to X 0;15 y 0;15
Looking fordward for your suggestions
regexp
Hi all,
There is an object similar to regexp from maxmsp?
I would line to substitute characters into spaces. For Example:
from: X:0,15Y:0,15
to X 0;15 y 0;15
Looking fordward for your suggestions
If you are fine with using externals I would use a Lua script with Ofelia:
https://www.lua.org/pil/20.1.html
replace character.pd
Otherwise you can achieve that with vanilla too, this could be a starting point:
https://forum.pdpatchrepo.info/topic/10556/vanilla-list2symbol-abstraction-pd-0-47
@Pimp_me A long time ago....... upset about the future demise of Extended..... this was an incomplete attempt at string editing in Vanilla........ edit.zip
[edit : 2] should work....... but not if your "Y" is really stuck to the "15" that precedes it.
e.g. substitute.pd ....... semi-colon being <cr> in Pd.
David.
Thank you @Jona I am trying with the lsit2symbol abstraction.
@whale-av actually Y is stuck to the 15...
I connected a 3D Printer using comport and need to track the position of the extruder.
Directly from Comport I get this info:
comport: X : 0 . 0 0 Y : 0 . 0 0 Z : 0 . 0 0 E : 0 . 0 0 C o u n t X : 0 . 0 0 Y : 0 . 0 0 Z : 0 . 0 0
comport: o k
Trying with your patch I am able to remove spaces (using vl2s and edit):
vl2s: symbol X_:0.0_0_Y:0.0_0_Z:0.0_0_E:0.0_0 C_o_u_n_t X:_ 0.0_0_Y:0.0_0_Z:0.0_0
vl2s: **symbol o_k_
edit: symbol X:0.00Y:0.00Z:0.00E:0.00 Count X: 0.00Y:0.00Z:0.00
edit: symbol ok
Actually I just need the integral number after the axis (X,Y,Z). The second group of axes would be great (current position) but the first group (to go Position) is also OK.
I tried using cylone/nth. But the problem is that the list sometimes is longer so looking for the nth is not a good Idea:
comport: X : 0 . 0 0 Y : 0 . 0 0 Z : 0 . 0 0 E : 0 . 0 0 C o u n t X : 0 . 0 0 Y : 0 . 0 0 Z : 0 . 0 0
comport: X : 10 . 0 0 Y : 0 . 0 0 Z : 0 . 0 0 E : 0 . 0 0 C o u n t X : 10 . 0 0 Y : 0 . 0 0 Z : 0 . 0 0
Looking forward for your replies
@Pimp_me i'm pretty sure, that someone already built an abstraction, that solves such tasks in an elegant way - however, i don#t exactly know! i just tinkered around by trial and error and i have to confess, i feel a bit ashamed about such an akward patch. but maybe it could be a starting point. i'm sure, this can be refined or build another way. at the moment, it only works, as long the integrals a below than 10.
find_list_val.pd
basically, i convert the symbol into a list, break it up into it's single elements and look for the indicies of the colons. then i route these indicies to [list split] units, wich extract the first element after each colon.
@toxonic thank you! the integrals needs are actually above 10
but I am getting closer to my goal.
this works perhaps:
charrepl.pd
or
charrepl_comma.pd
@Pimp_me This uses the string that comes out of comport and outputs the two sets of coordinates as lists: string.pd
The same without the decimals: string2.pd
@ingox you are my hero!!!! Thank you and have a nice weekend
@Pimp_me
just, because couldn't let it be...
and here the patch: find_list_val.pd
@toxonic
Vielen Daaaaank!!!!!!! Grüße aus Hamburg!
@Pimp_me Now that we see the data we can all have fun......... parse vanilla.zip
Vanilla (old style).
David.
@whale-av Great idea! Works even with [fudiparse]: string3.pd
@ingox Yes! That's tighter.....
But what is this Vanilla thing you speak of?....
David.
@whale-av My patch is 100% vanilla
Oops! Looks like something went wrong!