Download

Online

Gallery

Blog

  Index  | Recent Threads  | List Attachments  | Search
 Welcome Guest  |  Register  |  Login
Login Name  Password
 

Sweet Home 3D Forum



No member browsing this thread
Thread Status: Active
Total posts in this thread: 7
[ Jump to Last Post ]
Post new Thread
Author
Previous Thread This topic has been viewed 5184 times and has 6 replies Next Thread
skunk
Newbie




Joined: Aug 23, 2017
Post Count: 4
Status: Offline
Reply to this Post  Reply with Quote 
Editing a group of vertices

Hello,

I'm starting to play around with SH3D, to see what I can do with it.

One thing that I'm missing, and that others here may find useful, is being able to edit the home not by moving a group of objects, but by moving a group of vertices belonging to one or more objects.

(I tried the Advanced Editing plug-in, by the way, but did not find it particularly helpful.)

This would address the case of moving a wall and associated room definitions simultaneously, as well as more complex cases like extending an entire side of a house. If anyone here is familiar with AutoCAD, the idea is basically that program's STRETCH command.

I poked through the source code a bit to see how feasible it would be for me to implement this (the feature-request list is very long!) and I did seem to get an answer as to why SH3D's current behavior is as it is.

I see that vertices, like wall endpoints and room corners, are not first-class objects, but are instead simple fields within the associated objects. Thus walls and rooms are selectable, but vertices are not.

So what would be the best approach to make individual vertices selectable and editable/movable?

My first take would be to define a new object, let's call it VertexSubset, that implements Selectable. It would contain a reference to a normal home object (e.g. Wall, Room), and a variable-length array/vector of integers that indicate which vertices of the referenced object are "selected."

This would express the notion of (for example) vertex 0 of Wall A, vertices 2, 3, 4 of Room B, and so on. (A VertexSubset that denotes all or none of an object's vertices would be a degenerate case, and should probably be avoided in favor of no object or selecting the object in the normal way.)

Moving the VertexSubset would then modify the referenced object by moving only the indicated subset of vertices. (Obviously, moving multiple VertexSubset objects would affect multiple referenced objects.)

The GUI selection logic would need tweaking to make it possible to select vertices in this way, creating VertexSubset objects on-the-fly as needed.

Does this sound sane, or would a different approach be a better fit?
[Aug 25, 2017, 10:22:00 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Puybaret
Expert
Member's Avatar

France
Joined: Nov 7, 2005
Post Count: 9141
Status: Offline
Reply to this Post  Reply with Quote 
Re: Editing a group of vertices

Sorry for the late answer, but I think editing individual vertices of objets, walls or rooms would be very complicated to program with the existing user interface and too complicated for the targeted audience of Sweet Home 3D. By the way, as walls and rooms are automatically cut out by the windows and staircases they intersect with, modifying their vertices might break their consistency.
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D developer
[Sep 11, 2017, 1:16:03 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
skunk
Newbie




Joined: Aug 23, 2017
Post Count: 4
Status: Offline
Reply to this Post  Reply with Quote 
Re: Editing a group of vertices

But right now, you have the limitation of not being able to make the same modification to multiple objects at once---people asking e.g. how to move a wall, and have the room boundary move with it. I don't think that scenario rises to the level of advanced usage.

Yes, modifying vertices can break the consistency, but most of the time the adjustments would be straight X- or Y-axis aligned. And the time to use a tool like this would ideally be before walls are cut anyway.

The main reason that I want this is so I can lay down walls using rough measurements, and then be able to adjust everything easily later on when I get more precise dimensions. Right now, I have to have all the exact numbers up front, because changing things after the fact is way harder than it should be.
[Sep 11, 2017, 10:17:20 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Puybaret
Expert
Member's Avatar

France
Joined: Nov 7, 2005
Post Count: 9141
Status: Offline
Reply to this Post  Reply with Quote 
Re: Editing a group of vertices

After reading Autocad name, I thought you wanted to propose users to edit vertices in 3D!
If you look further in source code you'll see that walls and rooms are not bound to each other. This makes undo / redo easier to program, and less consistency tests to add. Note also that at the moment, walls are defined by their two end points and not their corners, and that rooms can be used for other things like drawing paths or only a part of real world room. Good luck to introduce common vertices in a kind of model not foreseen for that!
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D developer
----------------------------------------
[Edit 1 times, last edit by Puybaret at Sep 12, 2017, 12:06:23 AM]
[Sep 11, 2017, 11:37:24 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
skunk
Newbie




Joined: Aug 23, 2017
Post Count: 4
Status: Offline
Reply to this Post  Reply with Quote 
Re: Editing a group of vertices

Oh, right, this would be 2D only of course. SH3D is already built on a sort of 2.5D premise, so general 3D editing wouldn't even really work.

I saw in the source how walls and rooms are defined: walls being essentially a line segment + thickness, and rooms being a polygon. The general idea I'd like to propose is a temporary object that specifically exists to be able to refer to a subset of a (real) object's vertices.

To give a concrete example, let's say you have a simple square quartet of walls and a room as shown below:

N
0 *-----* 1 Wall N (0-1)
| | Wall E (1-2)
W | R | E Wall S (2-3)
| | Wall W (3-0)
3 *-----* 2 Room R (0-1-2-3)
S

You want to extend the east wall out a bit. So you would make a selection that ends up as follows:

  • Wall E
  • VertexSubset (vertex 1 of Wall N)
  • VertexSubset (vertex 2 of Wall S)
  • VertexSubset (vertices 1 and 2 of Room R)


(I'm playing fast and loose with how vertices are referenced here; of course each of these four vertices is not shared between objects. I'm also ignoring the existing mechanism that allows you to move Wall E while automatically updating Wall N and S, because as long as it doesn't also update Room R, it's an incomplete solution.)

Then when you move that selection, Wall E moves as usual, but each VertexSubset object passes on the adjustment to only the appropriate vertices of the referenced object. So the referenced objects "stretch" accordingly.

That's the basic idea. This wouldn't involve adding any new references/linkages to existing objects, just a new handle-object type by which to reference and manipulate parts of objects.

I have two main questions, then:

1) Would this approach work for you? You're much more familiar with the architecture than I am, to say the least, so maybe a better way is apparent?

2) I'll need to dive in deeper into the code to figure out all the MVC linkages and such. Any pointers? :) Just a hand-waved explanation of how you'd go about implementing this would be very helpful to an outsider...
[Sep 12, 2017, 9:04:30 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
philjord
Newbie



New Zealand
Joined: Oct 10, 2016
Post Count: 9
Status: Offline
Reply to this Post  Reply with Quote 
Re: Editing a group of vertices

Skunk,
I've also noticed this particular feature would be nice.

I like the fact you've got into the code and actually understood why it is as it is now, put forward some good ideas and suggested you're willing to do the work to create a plugin, nice one.

From my perspective, I find the wall editing is just about sufficient for changing room sizes by vertex, but the issue I face is that the room doesn't expand/follow the changes.

Perhaps you could think about this in terms of a plugin that creates a tool called "refit room" (or something), such that when a room is clicked (or double clicked perhaps) the room automatically recalculates the perimeter based off enclosing walls and resets it points.

This code for room point calculation already exists, so it would be a very straight forward plugin to write.

An additional feature might be to ensure it doesn't overlap any other rooms, such that a area broken into two rooms with one set of enclosing walls remains consistent. For example a kitchen/dining room room plan with no wall between.

I'd find this tool very useful, and perhaps once bedded down a room could be tagged as "auto-fit" such that any touching wall adjustment causes it to re-calculate.
[Sep 13, 2017, 6:03:50 AM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
skunk
Newbie




Joined: Aug 23, 2017
Post Count: 4
Status: Offline
Reply to this Post  Reply with Quote 
Re: Editing a group of vertices

Hi philjord!

Having the room follow wall edits is only one example of what general vertex-based editing would allow. I'm only focusing on that because it's a pain point many users are familiar with. (I'd hope this can go into base functionality, because of the generality---doing this as a plug-in would be akin to making copy-and-paste a plug-in.)

Consistency checking would be out of scope for this work :-] This is purely about being able to manipulate object vertices in a way that's not possible now. Someone else will have to add the safety railings...

Auto-fit rooms are a thought, but they would require more cross-linking between objects. Emmanuel said that this makes consistency checks and undo/redo harder, so I can at least see why he hasn't gone that route.
[Sep 13, 2017, 8:30:44 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
[ Jump to Last Post ]
Show Printable Version of Thread  Post new Thread

    Get Sweet Home 3D at SourceForge.net. Fast, secure and Free Open Source software downloads
   
© Copyright 2006-2024 eTeks - All rights reserved