Delete unwanted paths

Discuss SVG code, accessible via the XML Editor.
nithinrao
Posts: 4
Joined: Thu Jan 22, 2015 3:02 am

Delete unwanted paths

Postby nithinrao » Thu Jan 22, 2015 3:22 am

Hi Guys,

I have a large Image of Polygons generated in Matlab in SVG Format. I need to delete some paths which look like lines. have almost or 0 area. Any ideas how to do it. I have been struggling with it for a couple of days now. For the curious, the lines are Polygons which were perpendicular to the viewing direction, they have more than 2 Points, and i dont want them in my Image.

Also there are two Polygons one over the other. How do I handle them to make them one single one.

I have attached the file along. This is a small part of the larger Image. So deleting them manually is impossible.

Thanks a lot

--Nithin
Attachments
Polygon problem.svg
(9.53 KiB) Downloaded 338 times

hulf2012
Posts: 716
Joined: Sat Nov 24, 2012 12:37 pm

Re: Delete unwanted paths

Postby hulf2012 » Thu Jan 22, 2015 4:34 am

Hello

Is there a chance for you that those polygons which are perpendicular to the view, assign them, in Mathlab, a different style (a different color or thickness of line)?
That in order to use the search command (Ctrl + F). When you search, for example the same color of objects, those are selected, and then erased.

After that, those duplicated paths can be proccesed (I believe). Just select them all and apply a boolean operation (maybe union, or intersection)... mmm ... well, they could disapear... so save before.

Greetings
If you have problems:
1.- Post a sample (or samples) of your file please.
2.- Please check here:
http://tavmjong.free.fr/INKSCAPE/MANUAL/html/index.html
3.- If you manage to solve your problem, please post here your solution.

Lazur
Posts: 4717
Joined: Tue Jun 14, 2016 10:38 am

Re: Delete unwanted paths

Postby Lazur » Thu Jan 22, 2015 6:28 am

Hi.

With such same attributes I can only think of a manual way.
You want to keep the closed paths on top and delete the rest, so
why not to select those first (Shift+Click on each, or if anything unselected, hold Alt and draw a line crossing the paths),
add a different fill to them, then use the find tab (Ctrl+F) and search style: "fill:#66c3ea" and delete those after.
Not sure how large the original file is, a few thousand paths can be selected in a day's time.

But if possible, I would also suggest Hulf's solution.

User avatar
ragstian
Posts: 1181
Joined: Thu Oct 11, 2012 2:44 am
Location: Stavanger-Norway

Re: Delete unwanted paths

Postby ragstian » Thu Jan 22, 2015 8:49 am

Hi.

One method to "delete" all overlapping objects;

Make sure you are in object mode - ( F1 )
Select all ( Ctrl A );
Note the number of objects in the status field at the bottom of the Inkscape main window. (In your example file; 32 objects)

a. Perform Path union ( Ctrl + )
(Use the plus key on your numerical keypad)
( The objects is reduced to 1 in your file.)

b. Perform Path Break Apart ( Shift Ctrl K )
( The number of objects are now 14 )

To delete all the paths with (near) zero area a small python script in the form of an Extension would do the job.
Chime back if you want/need such a script.

RGDS
Ragnar
Good Luck!
( ͡° ͜ʖ ͡°)
RGDS
Ragnar

nithinrao
Posts: 4
Joined: Thu Jan 22, 2015 3:02 am

Re: Delete unwanted paths

Postby nithinrao » Thu Jan 22, 2015 8:41 pm

Hi Ragnar

Thanks for the Suggestion, and yes it would be of great help if you could write a python script for it. Also is it later possible to assign random colours to the Polygons after that.

What I observed is that is we unstroke then the area measured is Zero.

--Nithin

nithinrao
Posts: 4
Joined: Thu Jan 22, 2015 3:02 am

Re: Delete unwanted paths

Postby nithinrao » Thu Jan 22, 2015 8:52 pm

Hi Ragnar,

I found another way to solve the same. I put a Black background and create a 300dpi bmp file. Then run a BMP trace on it which create the Polygons. Thats good enough for me atleast for now.

But will have to do it on the large Image and check how it comes up. But still no clue with assigning random colours to the Polygons.

--Nithin

nithinrao
Posts: 4
Joined: Thu Jan 22, 2015 3:02 am

Re: Delete unwanted paths

Postby nithinrao » Thu Jan 22, 2015 9:06 pm

Hi Ragnar,

In the large Image the edges are still creating the Problem. Is there a way to Export BMP without Antialiasing.

Thanks

--Nithin

User avatar
ragstian
Posts: 1181
Joined: Thu Oct 11, 2012 2:44 am
Location: Stavanger-Norway

Re: Delete unwanted paths

Postby ragstian » Fri Jan 23, 2015 2:12 am

Hi Nithin.

Clever way of deleting the unwanted black parts!

To assign random colors to the polygons, Select all the objects - use Extension - Color - Randomize.

If this solves all your problems no need for an Extension?

RGDS
Ragnar
Good Luck!
( ͡° ͜ʖ ͡°)
RGDS
Ragnar

Lazur
Posts: 4717
Joined: Tue Jun 14, 2016 10:38 am

Re: Delete unwanted paths

Postby Lazur » Fri Jan 23, 2015 3:37 am

Hi Ragnar!

ragstian wrote:If this solves all your problems no need for an Extension?


Like, selecting all objects, that have "d without a z"?

Might be handy for some cases.


Let me add an extension idea just recently came to my mind -when thinking of how to visualize descriptive geometry construction, like for a tutorial in perspective:
an extension that would chew the z-order of all the objects, and put the objects into a jessyink bullet-point accordingly.
That way a construction could be followed literally step by step through a browser.

User avatar
ragstian
Posts: 1181
Joined: Thu Oct 11, 2012 2:44 am
Location: Stavanger-Norway

Re: Delete unwanted paths

Postby ragstian » Fri Jan 23, 2015 3:56 am

Hi

Lazur;
an extension that would chew the z-order of all the objects, and put the objects into a jessyink bullet-point accordingly.
That way a construction could be followed literally step by step through a browser.


The z-order of objects are determined by the position of the object in the SVG file where the first object in the file are of the bottom of the "z-stack"
No need to "strip" the order off as the object does not have a separate "z-order" property. I have not used Jessyink - could you copy & paste from Inkscape to Jessyink?

RGDS
Ragnar
Good Luck!
( ͡° ͜ʖ ͡°)
RGDS
Ragnar

Lazur
Posts: 4717
Joined: Tue Jun 14, 2016 10:38 am

Re: Delete unwanted paths

Postby Lazur » Fri Jan 23, 2015 4:02 am

Jessyink is part of the regular inkscape extensions. Works quite ok and self explanatory but the "amateurish looking" bullet-points needs to be set one by one.
http://www.timteatro.net/2010/08/12/a-tutorial-introduction-to-jessyink-presentations-in-inkscape/.


Return to “SVG / XML Code”