Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
Request for an App
-
@ihf , ok a little bit more exotic than the normal floor plan. But if the red rectangle around the floor plan below is the sqm then minus all the yellow rectangles. If all was to scale in the ui, would be very close. Look, just trying to help. Normally floor plans are just a series of rectangles more often than not. Just about getting the scale right. I can't remember clearly, but I think for kitchens (1 room) we did 25:1. I think for a house it was more like 250:1
-
I appreciate your help but I really need the square footage of the full outline as that is what real estate listing show. Also some of the floor plans I am dealing with would not be amenable to this approach as they have some less than right angles in them.
-
@ihf , ok no problems. I understand. Was just trying to make the problem similar to solve. But I had fun contributing 😎
-
Another approach - one used to estimate Pi - is to generate random points and see if they're inside or outside the building.
The proportion that are to those that aren't can be used with the overall scene's area.
-
Thanks, that's interesting but given that the jpg may contain other extraneous items, I think it would be better to outline the area of interest. The calculation part of the script is in the git. What I need is help with the UI.
-
Could you colour flood fill from the outside and then test pixels? You might need to eliminate e.g. the compass in your example. Though I doubt it adds much to the inaccuracy.
-
Is there something wrong with the approach of entering vertices by touching them?
-
@ihf , I think you are getting frustrated now. I understand why 🤐
But I am sure guys here can help with what you need. If you look at the path demo in the examples folder, pretty sure it's what you are looking for with a ui. Not something I can do competently, so I will we another one answer. But I think that's on the right track
-
I was concerned that the creative alternative suggestions might be because what I am envisioning is somehow more difficult than it seems. I am pretty sure that collecting the polygon's vertices' coordinates and the scale line can't be difficult (at least for someone who is adept at using the Pythonista UI). Figuring out if the polygon has been closed without actually touching (precisely) the initial vertex ought to be doable by looking at the distance and simply prompting for whether this closes the outline. Adding the ability to move the vertices to fine tune is something that could be added later.
-
@ihf , I don't know about the native graphic support on iOS. But in 1984 it was pretty easy to program with polygons in c. It was what set the Mac apart. Was all in the Mac toolbox. The Mac toolbox from memory was just an exception call to the 68000 Motorola series processors. That exception was caught and looked up to see if it was a toolbox call.
Anyway enough reminiscing, if it was easy to do in 1984, should be very easy today. But the functions did not just work on a singular polygon, worked on multiple polygons. Was so cool for its time -
@MartinPacker 's method would still allow for the same input, and it would work nicely. See the Monte Carlo method.
-
I added a very simple ui as a pull req.
https://github.com/jsbain/RoomAreaFinderDraw the first line, then set the scale in the upper Left corner until the line length matches whatever the real length is, in whatever units you want. Then add vertices (click, or drag then release). Area is shown, though won't be accurate until the path is almost closed.
Some obvious improvements need to be made: magnifying zoom type effect when dragging, ability to grab and move existing points, slider for scale, perhaps pan/zoom for small devices.
-
@JonB My hat is off to you! It is already useful. With the improvements, I think this would be a publishable app. Many thanks!
-
@JonB I see you initially set scale to 0.08. What is the origin of that value? My thought was to set scale by initially touching 2 points that define a known length and then entering that length.
-
@ihf , sorry if I frustrated your efforts. But very happy to see you got a solution , or a least on the road to one.
-
I set the scale based on what looked about right on my ipad in landscape. it was slightly easier to implement this way, as it did not require an additional mode -- just draw, then set scale whenever it is convienent. for instance, you might find the initial points were not that accurate, so you can tweak and see the effect. A slider would be more intuitive i think.
-
@jonB The reason I had thought to measure scale independent of the area to be traced was that I thought it would be best to set scale using the longest known measurement on the plan and that might not be on the perimeter.
-
@jonb I am interested in modifying the script you were kind enough to write but I fear that my knowledge of the UI module (and perhaps Python more generally) is somewhat limited. I am trying to go through the script line by line and I have a few questions. Lines 27-28 and 36 seem to be setting a text label which never appears when the script is executed. Am I missing something? The script is already useful but it would benefit greatly by the features you mentioned (e.g., magnifying zoom effect when dragging, ability to grab and move existing points, slider for scale, pan/zoom) as well as a way to select the jpg of the floor plan (I can probably figure that one out :-). Any help you can provide is most appreciated.
-
i will make some comments on your github so we don't clutter the forums
-
@JonB I added floorplanarea-4 to the git repository with a file picker to select an image from the photo gallery and a slider for the scale setting. I tried to get the code to work in the RoomAreaView function but resorted to using a temporary file and calling the script with that file. In using the script, I also realize that a slider is fine except that the initial setting of the scale must be done with a known distance (e.g., a room width) but that measurement may not be part of the area calculation (e.g., it may be an interior room). So, a better way to set scale might be to do that explicitly (tap a button, select 2 pts with a known distance and enter that measurement in feet/inches) and then go on to mark the area to be computed.
I will say that this is already a useful script as I can now simply save a floor plan to the photo gallery and open it with the script and measure areas. Thank you for your expert assistance.