Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I have to parse some STEP-files (ISO-10303-21) from different CAD-Systems and they are always structured differently. This are the forms that might appear:

#95=STYLED_ITEM('',(#94),#92);
#12 = CARTESIAN_POINT ( 'NONE',  ( 1.213489432997839200,
5.617300827691964000, -7.500000000000001800 ) ) ;
#263 = TEST ( 'Spaces must not be ignored here' ) ;

I thought that a regular expression would help me, so I created this one (http://rubular.com/r/EtJ25Hfg77):

(#d+)s*=s*([A-Z_]+)s*(s*(.*)*s*)s*;

This gives me:

Match 1:
1: #95
2: STYLED_ITEM
3:

Match 2:
1: #12
2: CARTESIAN_POINT
3:

Match 3:
1: #263
2: TEST
3:

So the first two groups are working as supposed. But I also need the attributes inside the parantheses like this:

Match 1:
1: #95
2: STYLED_ITEM
3: ''
4: (#94)
5: #92

Match 2:
1: #12
2: CARTESIAN_POINT
3: 'NONE'
4: ( 1.213489432997839200, 5.617300827691964000, -7.500000000000001800 )

Match 3:
1: #263
2: TEST
3: 'Spaces must not be ignored here'

Please help me finding the correct expression for the last group ((.*) at the moment).

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
290 views
Welcome To Ask or Share your Answers For Others

1 Answer

With an AGPL license for non-commercial use JSDAI is free and open source java toolkit for working with STEP files

http://www.jsdai.net/

BSD license, so always free and open source is the STEPcode project which generates C++ and python API's and example STEP file reader/writer, which is used by other open source projects such as BRL-CAD, SCView and OpenVSP.

www.stepcode.org

OpenCasCade has C++, pythonOCC has python, and node-occ has javascript API's for working with data that is translated from STEP, and are also free and open source. OCE works across more platforms and has more bug fixes

https://github.com/tpaviot/oce


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...