How to get PlanComponent from Plug-in ?

This topic has been viewed 7364 times and has 1 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
wilk2002
Posts: 1
Joined: Thu Aug 13, 2015 11:08 am

How to get PlanComponent from Plug-in ?

Post by wilk2002 »

Dear SweetHome community,

I'm trying to extract home plan top view into PNG files but knowing what is the scale. So knowing that for instance 1cm is 1px etc. I searched API and found that I could try somehow got to my aim through SVG extract. So I could extract SVG in plug-in and then try to convert to PNG file knowing rooms dimensions etc.
BUT, to get SVN extract I have to get PlanComponent object first and according to JavaDoc it is only returned from MultipleLevelsPlanPanel.createPlanComponent method. Which doesn't look like the right one to use once the view is already created.
Could you please help me and advice how may I export SVG file from inside the plug-in ?
User avatar
Puybaret
Posts: 9440
Joined: Mon Nov 07, 2005 12:00 pm
Country: Paris, France
Contact:

Re: How to get PlanComponent from Plug-in ?

Post by Puybaret »

You can access to MultipleLevelsPlanPanel instance with:

Code: Select all

getHomeController().getPlanController().getView()
but this won't help you because there's no way to export to SVG from this component.
I would suggest to create a PlanComponent instance and call exportToSVG or getClipboardImage on it like actual implementation of the matching menu.
Emmanuel Puybaret, Sweet Home 3D creator
Post Reply New Topic

Who is online

Users browsing this forum: No registered users and 2 guests