Re: Repeated sequence
- To: mathgroup at smc.vnet.net
- Subject: [mg63977] Re: Repeated sequence
- From: "Jens-Peer Kuska" <kuska at informatik.uni-leipzig.de>
- Date: Thu, 26 Jan 2006 03:42:59 -0500 (EST)
- Organization: Uni Leipzig
- References: <dr80a3$ph3$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Hi,
hopefully
list1 = (list //. {{a__, 10, xc_, b___} :>
{a, {x -> xc}, b},
{a__, 20, yc_, b___} :>
{a, {y -> yc}, b}} //. {a___, {x -> xc_},
{y -> yc_}, b___} :>
{a, {{x, y} ->
{xc, yc}}, b} /. {a___, q : (Rule[{x, y}, _] ..),
b___} :>
Line[Last /@
{q}] //. {a___, Line[l1_], Line[l2_], b___} :>
{a,
Line[Join[l1, l2]], b});
Show[Graphics[Cases[list1, _Line, Infinity]]]
include a sufficient number of repeated patterns.
Regards
Jens
"Borut Levart" <BoLe79 at gmail.com> schrieb im
Newsbeitrag news:dr80a3$ph3$1 at smc.vnet.net...
| Dear users,
|
| I have a list of DXF Polylines data, and I would
like to extract the
| coordinates {x,y}_i out of each sublist (code 10
followed by x1, 20 by
| y1, and again 10 by x2, and so forth), but the
length of the 10-20 run
| is general. I've read about Repeated pattern,
but still can't extract
| the whole run.
| I would like to solve this with patterns.
|
| list={{5,8
B,330,F,100,AcDbEntity,8,0,100,AcDbPolyline,90,2,70,0,43,0.,
|
10,12.1426,20,18.2932,10,10.3823,20,15.2443,0},{5,8
F,330,F,
|
100,AcDbEntity,8,0,100,AcDbPolyline,90,2,70,0,43,0.,10,
| 10.3823,20,15.2443,10,8.62206,20,12.1954,0},{
|
5,92,330,F,100,AcDbEntity,8,0,100,AcDbPolyline,90,2,70,0,43,0.,
|
10,8.62206,20,12.1954,10,12.1426,20,12.1954,0},{5,
|
93,330,F,100,AcDbEntity,8,0,100,AcDbPolyline,90,2,70,0,43,0.,
|
10,12.1426,20,12.1954,10,15.6631,20,12.1954,0},{5,
|
94,330,F,100,AcDbEntity,8,0,100,AcDbPolyline,90,2,70,0,43,0.,
|
10,15.6631,20,12.1954,10,13.9028,20,15.2443,0},{5,
|
95,330,F,100,AcDbEntity,8,0,100,AcDbPolyline,90,2,70,0,43,0.,
|
10,13.9028,20,15.2443,10,12.1426,20,18.2932,0},{5,
|
B9,330,F,100,AcDbEntity,8,0,100,AcDbPolyline,90,14,70,0,43,0.,
|
10,3.7764,20,18.0222,10,6.87499,20,17.7511,10,3.42781,20,16.6671,
|
10,6.10034,20,16.0477,10,4.70598,20,15.5831,10,5.51936,20,15.0798,
| 10,4.47358,20,14.5377,
|
|
10,5.44189,20,13.686,10,4.62851,20,12.7181,10,5.44189,20,11.3631,10,
|
4.35739,20,10.0467,10,4.82217,20,9.0014,10,4.20246,20,
| 7.33662,10,5.79048,20,6.83332,0}}
|