Text name only in 2D view

This topic has been viewed 6908 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
Ferraro
Posts: 22
Joined: Wed Apr 16, 2014 6:25 pm

Text name only in 2D view

Post by Ferraro »

Is there a way to display the catalog name only in the plan view? I have run into a situation where the top down view is undesirable, and just the catalog name of the object is more appropriate. I thought about using a plan icon image, but this does not produce the desired vector text output I need in the SVG. Any ideas?
Ferraro
Posts: 22
Joined: Wed Apr 16, 2014 6:25 pm

Re: Text name only in 2D view

Post by Ferraro »

If anyone is interested, I tried using an SVG file as the planIcon, but it does not work. I get that little red X. I guess there is no quick fix inside SH :(
User avatar
clanmills
Posts: 33
Joined: Fri May 16, 2014 4:50 am
Country: Camberley, Surrey, England
Contact:

Re: Text name only in 2D view

Post by clanmills »

I don't know the answer, however here are a couple of ideas:

Changing SH3D code
The method paintIcon() in PlanComponent.java appears to generate an image which is used as a "proxy" for an item of furniture. Perhaps you could rewrite that method to create a little text label which displays the name of the item

PostProcessing the SVG
I've exported an SVG file and it consists of vector graphics and <image .../> tags which I believe are "proxy" images. I removed the images with this:

$ cat SGx.svg | xmllint --format --recover - | sed 's#<image.*/>##g' > SGy.svg

I suspect the <image ../> tag is identical for every instance of the same item of furniture. A script could be devised to identify every <image ../> and replace it with a graphical/SVG text label unique for that <image ../>
User avatar
clanmills
Posts: 33
Joined: Fri May 16, 2014 4:50 am
Country: Camberley, Surrey, England
Contact:

Re: Text name only in 2D view

Post by clanmills »

I've solved this! I've been updating the model of my home and noticed in the "Modify Furniture" Dialog that there's a check box "Display name in Plan". You should enable that on every item of furniture, the use my xmllint magic to remove the furniture "proxy". Et voila!

It would be easy to create a plugin to automate this and set/reset the state of "Display name in Plan". Windows can install xmllint from https://code.google.com/p/xmllint/downl ... e&can=2&q=
Ferraro
Posts: 22
Joined: Wed Apr 16, 2014 6:25 pm

Re: Text name only in 2D view

Post by Ferraro »

Thanks for your suggestions clanmills, you gave me some good ideas. I am thinking "Display name in plan" should be enabled from the furniture library properties file. Going to see how hard that is to rework. Then I can just load a transparent png for the planIcon.
Post Reply New Topic

Who is online

Users browsing this forum: No registered users and 1 guest