I have checked various examples and it appears that my problem is a bit more complex than what I have been able to find. So I'd greatly appreciate your help. I'm a stress engineer and I like to present my results as VRML (WRL) files. I recently discovered how to animate the images which takes it to a whole other level in value for me. However when the animations are created it puts unwanted edges in the wrl file. I have discovered where in the file these lines are coming from but the line number will differ from model to model. So what I need to do is search for a particular string and then delete the following line and keep deleting lines until another string is found. So an example would be the following:

look for this line
delete this line
delete this line
etc.
etc.
until this line is found

The number of lines to delete will differ for each file (mesh dependent).

Recommended Answers

All 2 Replies

You read the lines until you find 'look for this line', then you discard lines until you find 'until this line is found' (you read them, but do not save them), then loop again to look for 'look for this line'. At end you write out all lines you saved, for example in another directory with original file name, so you do not delete the files by mistake in your code.

OK thanks for your response.

I have checked various examples and it appears that my problem is a bit more complex than what I have been able to find. So I'd greatly appreciate your help. I'm a stress engineer and I like to present my results as VRML (WRL) files. I recently discovered how to animate the images which takes it to a whole other level in value for me. However when the animations are created it puts unwanted edges in the wrl file. I have discovered where in the file these lines are coming from but the line number will differ from model to model. So what I need to do is search for a particular string and then delete the following line and keep deleting lines until another string is found. So an example would be the following:

look for this line
delete this line
delete this line
etc.
etc.
until this line is found

The number of lines to delete will differ for each file (mesh dependent).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.