Plugin: 2D curve(s) to SVG

Legacy tS 6.6
User avatar
Fenerit
Senior Chief Petty Officer
Posts: 173
Joined: 21 Nov 2011, 19:19
Type the number ten into the box: 9

Plugin: 2D curve(s) to SVG

Post by Fenerit »

Originally part of the vertex exporter, because it concerns lines, I've split it from thats.
Below some naive NURBS-to-polyhedrons curves traced in tS have been converted in SVG and imported in Inkscape. Further - yet more naivest - elaborations have been made with it.
The plug-in get the outline profile of the curves (no fill in it) both the curve is got from context's nurbs extrusion and then converted to poly or converted to poly through the appropriate button or sweeped with "size z" > 0 as long as it isn't rotated along xy axis (top view is assumed). To make the "shape within the shape" is enough to set the "location z" freely up or down. The curve are exported grouped and locked; hence the relevant operations to work on each curve point or on every single shape is left to the client SVG program. I've tested OK the SVGs both on Inkscape and on GIMP. I don't know how they behaves on Illustrator; but the SVG is very basic, without any further reference or comment; so it would work. As always feedbacks are appreciated on this matters.
svg_ts.png
svg_ink.png
The zip
tSxSVGExport.zip
(7.82 KiB) Downloaded 479 times
User avatar
bitkar
Captain
Posts: 2089
Joined: 16 Mar 2010, 07:14
Type the number ten into the box: 0
Location: Czech Republic

Re: Plugin: 2D curve(s) to SVG

Post by bitkar »

cool.... love those things. What about import of SVG?
Michal aka bitkar
tS freak since tS2 (1998) and forever (tS7.61 modeler)
User avatar
Draise
Captain
Posts: 3200
Joined: 21 Sep 2009, 19:33
Type the number ten into the box: 0
Location: Bogota, Colombia

Re: Plugin: 2D curve(s) to SVG

Post by Draise »

This is great! Is there a way to import SVG's? I do use Inkscape sometimes!
User avatar
Fenerit
Senior Chief Petty Officer
Posts: 173
Joined: 21 Nov 2011, 19:19
Type the number ten into the box: 9

Re: Plugin: 2D curve(s) to SVG

Post by Fenerit »

I made this plug-in because the way in which curves a got from tS is far more easy respect to whatelse 2D program of its kind. I'm unable to get with the same easyness of tS the curve's control in whatelse 2d program which does the same thing; thus I never thought to do the converse, because was a no-sense from my part. Just an example: do try to get an ISO conformed gears, an HE an IPE in a 2D graphic program; apart AutoCAD, you will find some trouble even with Illustrator. Nobody uses this programs to do so, while from 3D programs you can go in thats. Nonetheless, I will take a look.
User avatar
Draise
Captain
Posts: 3200
Joined: 21 Sep 2009, 19:33
Type the number ten into the box: 0
Location: Bogota, Colombia

Re: Plugin: 2D curve(s) to SVG

Post by Draise »

Yeah, that makes sense. I did always love the curves of TS6.6 over 2d programs for sure. I guess you have a good point there! ;)
User avatar
Fenerit
Senior Chief Petty Officer
Posts: 173
Joined: 21 Nov 2011, 19:19
Type the number ten into the box: 9

Re: Plugin: 2D curve(s) to SVG

Post by Fenerit »

Exporting from pagemakers to 3d program is puzzling; what hell one does export in 3D? :lol: At least one does make an heightfield of the page and then extrude all. :bananacool2:
User avatar
BNG
Chief Warrant Officer
Posts: 684
Joined: 16 Oct 2009, 03:26
Type the number ten into the box: 0
Location: Texas

Re: Plugin: 2D curve(s) to SVG

Post by BNG »

Awesome bro, thanks for posting it for all. :bananahi:
User avatar
Fenerit
Senior Chief Petty Officer
Posts: 173
Joined: 21 Nov 2011, 19:19
Type the number ten into the box: 9

Re: Plugin: 2D curve(s) to SVG

Post by Fenerit »

Inspired by the discussion here about the outstanding clinton' work upon SVG importer, I've decided to enhance the exporter.

The new features allows the export of the material colors and of the filled shapes, either glued/unglued together. Currently, I'm working on settings, pretty easy to do with check-boxes and such, concerning also stroke-color and stroke-width, for this I should like to hear some suggestions about it (Emmanuel?) before to release the new version.
svg_color1.png
svg_color2.png
Last edited by Fenerit on 03 Nov 2015, 19:11, edited 1 time in total.
User avatar
Cellulo
Lieutenant
Posts: 927
Joined: 27 Sep 2012, 07:48
Type the number ten into the box: 9
Location: France

Re: Plugin: 2D curve(s) to SVG

Post by Cellulo »

:bananathumb:
User avatar
clintonman
Captain
Posts: 5659
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California

Re: Plugin: 2D curve(s) to SVG

Post by clintonman »

Maybe you can use the layer color for the stroke color.
Clinton Reese

http://clintons3d.com
User avatar
Fenerit
Senior Chief Petty Officer
Posts: 173
Joined: 21 Nov 2011, 19:19
Type the number ten into the box: 9

Re: Plugin: 2D curve(s) to SVG

Post by Fenerit »

clintonman wrote:Maybe you can use the layer color for the stroke color.
Thanks for the suggestion.

Currently the options are these, no matter how many layers are on the scene:
svg_dlg.png
svg_dlg.png (4.6 KiB) Viewed 7975 times
- uncheched all = black outlines;
- fill color checked = fill the material color but the stroke, which remains black;
- stroke paint as material color = self-explanatory, both checked alone or along with the fill color check-box: outlined stroke color like the material or fill and stroke of the same color, respectively.
- stroke paint as layer color = your suggestion, just the outline, otherwise those wire color could be mixed up with the filled color. To check on this will deactivate the others.
- stroke width = self-explanatory.

TODO (if I'm able):
- to port the tS layers as layers within the SVG. It seem to work, but I'm not sure whether the SVG layer directive is the standard one or it is valid just for Inkscape. I may explore more on this, since I've just it as SVG client...
- to assest the obj/scene units.

EDIT LATER:
Tested up to 10 layers, each one with its color and its curve-to-poly, I got 10 outlined shapes each one with its proper layer's color strokes.
User avatar
clintonman
Captain
Posts: 5659
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California

Re: Plugin: 2D curve(s) to SVG

Post by clintonman »

Looking good.

As far as layers I think that's an Inkscape thing. I don't believe svg format has layers, it only seems to have groups.
Clinton Reese

http://clintons3d.com
User avatar
Fenerit
Senior Chief Petty Officer
Posts: 173
Joined: 21 Nov 2011, 19:19
Type the number ten into the box: 9

Re: Plugin: 2D curve(s) to SVG

Post by Fenerit »

Finally, I can get both open/closed curves along with curve-to-polyh. :bananatyping:
svg_open_1.png
svg_open_2.png
clintonman wrote:Looking good.

As far as layers I think that's an Inkscape thing. I don't believe svg format has layers, it only seems to have groups.
A further option, then.
User avatar
Fenerit
Senior Chief Petty Officer
Posts: 173
Joined: 21 Nov 2011, 19:19
Type the number ten into the box: 9

Re: Plugin: 2D curve(s) to SVG

Post by Fenerit »

Here the new 1.1 version. Feedbacks are appreciated. Remove the previous version and extract with path under the tsx folder.
tSXSVGExport_1.1.zip
(13.29 KiB) Downloaded 420 times
User avatar
Emmanuel
Chief Warrant Officer
Posts: 670
Joined: 14 Jun 2009, 06:47

Re: Plugin: 2D curve(s) to SVG

Post by Emmanuel »

Hum, couldn't test yet : trueSpace is crashing when it start to write the file (I mean after I set a file name in the dialog box).
This occurs even if I restart tS after loading the tsx. I also tried in tS6.6. Same behavior.

I like the stroke and color options. This is a nice improvement :worship:
User avatar
Fenerit
Senior Chief Petty Officer
Posts: 173
Joined: 21 Nov 2011, 19:19
Type the number ten into the box: 9

Re: Plugin: 2D curve(s) to SVG

Post by Fenerit »

Try this:
tSXSVGExport_1.1_tS66.zip
(13.28 KiB) Downloaded 414 times
maybe your system is sensitive to pure 6.6 version. Otherwise you nust have missed some DLLs such as:
- msvcrt.dll
- msvcp60.dll
- mfc42.dll
User avatar
Fenerit
Senior Chief Petty Officer
Posts: 173
Joined: 21 Nov 2011, 19:19
Type the number ten into the box: 9

Re: Plugin: 2D curve(s) to SVG

Post by Fenerit »

tSx SVG Exporter 1.2

FIXES:
- fix a bug with the stroke-width setting;
- fix a fill color issue when the curve(s)-to-polygon and open curve(s) are both on the scene;
- minor fixes.

INSTALLATION:
1) Extract the zip folder within the "..\tsx\" directory.
2) Search for "tSxSVGExport.tsx" through the usual "Install new trueSpace eXtension" icon. tS 6.6 version included.
tSXSVGExport_1.2.zip
(27.34 KiB) Downloaded 392 times
User avatar
Cellulo
Lieutenant
Posts: 927
Joined: 27 Sep 2012, 07:48
Type the number ten into the box: 9
Location: France

Re: Plugin: 2D curve(s) to SVG

Post by Cellulo »

Thanks Fenerit, cool plugin :bananathumb:
User avatar
Fenerit
Senior Chief Petty Officer
Posts: 173
Joined: 21 Nov 2011, 19:19
Type the number ten into the box: 9

Re: Plugin: 2D curve(s) to SVG

Post by Fenerit »

:bananacheers:
User avatar
Fenerit
Senior Chief Petty Officer
Posts: 173
Joined: 21 Nov 2011, 19:19
Type the number ten into the box: 9

Re: Plugin: 2D curve(s) to SVG

Post by Fenerit »

tSx SVG Export 1.3
svg_exp_1.3.png
svg_exp_1.3.png (9.11 KiB) Viewed 7840 times
FIXES:
- svg xml: added mm units to the width/height, this causes Inkscape to highlight
the exported page size within the "Document Properties" menu. Also non-metric units are accounted for;
- svg output: fit the draw as more as possible at the center of the page; its precise vertical/horizontal center alignment is left to the SVG client, being the tS bounding box dependent upon the rationale of the curves,
which enclosed manipulator elements coordinates that could not match those belongings to the SVG client. All this doesn't change the fidelity of the tS draw output.

CHANGES:
- interface;

ADDS:
- page size and orientation;
- draw units output;

KNOWN LIMITATIONS:
- radio buttons "Draw units" doesn't holds the settings on disc. default draw units = cm (A0 fit).

INSTALLATION:
1) Extract the zip folder within the "..\tsx\" directory.
2) Search for "tSxSVGExport.tsx" through the usual "Install new trueSpace eXtension" icon. tS 6.6 version included.
tSXSVGExport_1.3.zip
(37.2 KiB) Downloaded 396 times
Note: this version fixes also some upper/lower case in the names of the files. Please, remove the previous version if any before to install this. For the tS icon it is unimportant to be removed fro the interface, because it is case insensitive.
Last edited by Fenerit on 08 Apr 2016, 19:58, edited 1 time in total.
User avatar
Emmanuel
Chief Warrant Officer
Posts: 670
Joined: 14 Jun 2009, 06:47

Re: Plugin: 2D curve(s) to SVG

Post by Emmanuel »

Sounds great. Thank you Fenerit. The page option is a nice feature.
I coulnd't test though : still crashing when I clic the export button. I've placed the dlls in tS directory but it doesn't help.
User avatar
Cellulo
Lieutenant
Posts: 927
Joined: 27 Sep 2012, 07:48
Type the number ten into the box: 9
Location: France

Re: Plugin: 2D curve(s) to SVG

Post by Cellulo »

Thanks Fenerit
User avatar
Fenerit
Senior Chief Petty Officer
Posts: 173
Joined: 21 Nov 2011, 19:19
Type the number ten into the box: 9

Re: Plugin: 2D curve(s) to SVG

Post by Fenerit »

Do take a look whether also comdlg32.dll is on your system. If the crash is related to the file dialog, that's is the relevant dll. There are several way to call for the file dialog; I follow the basic one for the early time in which tS6.6 was released, say, no extended controls (aka, the comctl32.dll).