Bug?: home plan doesn't update when plugin resizes furniture

This topic has been viewed 3765 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
adoberito
Posts: 1
Joined: Wed May 04, 2022 12:36 am

Bug?: home plan doesn't update when plugin resizes furniture

Post by adoberito »

I've encountered what seems to be a bug, where when I have a plugin modify the size of a HomePieceOfFurniture, it correctly updates everywhere except in the home plan view.

For example, if my plugin says:

Code: Select all

HomePieceOfFurniture projector = // ...
projector.setDepth(1000);
home.addPieceOfFurniture(projector);
The projector seems very stretched in the home 3D view, but appears as its default dimensions in the home plan view.

If I then double-click it and go to the "Modify furniture" window, the correct (large) depth is visible. If I make some other change to the dimensions (for example changing the height), when I click "OK" the depth is now correct in the home plan view.

---

If this is a bug, I assume you'll fix it in a later version. I'm using a version provided by Debian, so it'll probably be a long time for a fix. Is there some workaround I can use in the meantime to force the home plan view to recalculate the dimensions?

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

Re: Bug?: home plan doesn't update when plugin resizes furniture

Post by Puybaret »

The size used to display a piece of furniture in the plan is actually coming from the values returned by the methods [font=courier new]getWidthInPlan[/font] and [font=courier new]getDeprhInPlan[/font] which may return values different from [font=courier new]getWidth[/font] and [font=courier new]getDeprh[/font] if the piece is rotated around a horizontal axis.
As this size in the plan is automatically updated by the plan controller on any piece added to the edited home, you could simply call [font=courier new]addPieceOfFurniture[/font] before [font=courier new]setDepth[/font]. If you prefer not to change the order of these calls, you’ll have to call [font=courier new]projector.setDepthInPlan(1000)[/font] after calling [font=courier new]setDepth[/font].

If possible, it would be nice to explain what you want to achieve [:)]
Emmanuel Puybaret, Sweet Home 3D creator
Post Reply New Topic

Who is online

Users browsing this forum: No registered users and 1 guest