Re: Measurement input to CAD
Posted by fortran on Jul 09, 2014; 12:56am
URL: https://forum.librecad.org/Measurement-input-to-CAD-tp5710133p5710137.html
I kind of expected most CAD programs to support length and area calculating. Once upon a time I had thought about how to reparameterize spline data in terms of arc length, but never did implement anything.
Getting the program to draw a single isolated room didn't require much work. The list of points input to SVG to produce a closed polyline in many circumstances consists of straight line segments divided into sub-segments. For example, an entrance has a segment between the hinge side of the door and the corner, the door itself, possibly a window next to the door, and then a wall segment leading into the other corner. That one line segment is actually 4 sub-segments.
Turning the collection of rooms into a floor plan of rooms, was mostly manual. I suppose a person could add structure to the data, to allow a doorway to be indicated, and if one numbers the 2 rooms on either side of the doorway, it could lead to some kind of automatic assembly. In most of the doorways, the thickness of the wall was about 4.75 inches, which leads to unfilled gaps between rooms. There were circumstances where two rooms joined with no gap.
Looking at the Wikipedia article on Lua, I don't see any reason why the code couldn't work. Other than I don't see anything like CPAN for Lua. Looking at CPAN, I see they have facilities (Lua::API and Inline::Lua) which allow Perl to be called from Lua. I have very limited experience in using these XS facilities, it still seems like a fair amount of magic to me.
I believe Inkscape can convert SVG to DXF, if a plugin is added. There seems to be other tools as well.
Sitting here, looking at the overlay of the ground floor and basement, there are some problems. There are errors in my measurements. Some of the corners may not be square, and hence you lose inches. Making diagonal measurements would help. But while I think most people can measure a flat wall to 1/4 or maybe 1/8 inch with a measuring tape, what accuracy can they get measuring a diagonal? If nothing else, I expect there to be a bias (to undermeasure) diagonals based on the size of the measuring tape. In some circumstances a person can measure from a back wall through a doorway to a far wall, possibly a back wall in an opposite room. To automatically assemble all the room images, it would probably be nice to adjust coordinates to "smooth" the floor plan. Anyone have pointers to ideas on how to do this? :-)
I could upload a copy of the SVG if that would be of use.
If people wanted to play with the Perl version, I could send copies (typical Perl license, your choice of Artistic License or GPL). There seems to be some old support for DXF in CPAN, but it may be obsolete. Or at least I can't find any leads that show source code.