It is possible modify export to SVG format ?

This topic has been viewed 7609 times and has 4 replies
Thread status: Active
Questions about extending features and developing plug-ins [img]http://www.sweethome3d.com/images/flags/en_small.gif[/img]
Post Reply New Topic
trojanrob
Posts: 6
Joined: Wed Apr 17, 2013 1:23 pm
Country: Szczecin, Zachodniopomorskie, Poland

It is possible modify export to SVG format ?

Post by trojanrob »

Hello,

I want to add <rect class="btn" ... /> in SVG file after each <image ... />

This change is needed to image was clickable.

Any solutions , please.

Robert
User avatar
Puybaret
Posts: 9440
Joined: Mon Nov 07, 2005 12:00 pm
Country: Paris, France
Contact:

Re: It is possible modify export to SVG format ?

Post by Puybaret »

If you want to change SVG export, you should change the implementation of exportToSVG method in the PlanComponent class. In your case, maybe you could simply modify the end of paintFurniture method, to draw your rectangle when the paintMode is equal to PaintMode.EXPORT (you'll see there are already some similar tests for PAINT mode).
Emmanuel Puybaret, Sweet Home 3D creator
trojanrob
Posts: 6
Joined: Wed Apr 17, 2013 1:23 pm
Country: Szczecin, Zachodniopomorskie, Poland

Re: It is possible modify export to SVG format ?

Post by trojanrob »

I think I described it wrong. [:(]

See my example
(transparent rectangle added manually) When click on image appears message box

Code: Select all

<svg
...
...
>
...
<g ... >
<g ... >
<g ... >
<image x="0" y="0" width="256" height="256"... />
<rect class="btn" x="0" y="0" width="256" height="256"  stroke="#fff" fill="#fff" fill-opacity="0" stroke-opacity="0"  onclick="action" />
</g> <!-- transform -->
</g> <!-- transform -->
</g> <!-- default stroke -->
</svg> <!-- bounding box -->
This rectangle is transparent and clickable.

I don't want draw separate rectangle.
User avatar
Puybaret
Posts: 9440
Joined: Mon Nov 07, 2005 12:00 pm
Country: Paris, France
Contact:

Re: It is possible modify export to SVG format ?

Post by Puybaret »

Look at exportToSVG code, you'll see that SVGGraphics2D class coming from FreeHep library is used to generate SVG code. No idea what you can override there.
Emmanuel Puybaret, Sweet Home 3D creator
trojanrob
Posts: 6
Joined: Wed Apr 17, 2013 1:23 pm
Country: Szczecin, Zachodniopomorskie, Poland

Re: It is possible modify export to SVG format ?

Post by trojanrob »

Problem solved. [:)]

Added "freehep-graphicsio-svg-2.2.1-sources" to SH3D source and modifiy class "SVGGraphics2D"

Thanks for the tip.
Robert
Post Reply New Topic

Who is online

Users browsing this forum: No registered users and 2 guests