Measurement input to CAD

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Measurement input to CAD

fortran
It's been a while since I learned drafting (1979).  To start defining an 8 foot 2x4 with either a mouse or trackball always seemed too clunky compared to CLI for me.  Consequently I've only dabbled in CAD, as data input is too slow.

2D CAD maps to SVG okay as I understand.  I normally write SVG files in emacs as text, or calculate them in Perl using SVG.pm.

This summer, we are renovating the house at the family farm.  At one time there were blueprints, they've evaporated.  I spent a day measuring all the rooms on ground and basement.  I still need to go up into the attic to measure things (hip roof).

Working from my measurements of "rooms", I have a Perl structure with counter-clockwise definition of absolute/local coordinates, starting from the upper left (more or less) as SVG uses that perverted coordinate system.  My Perl script does traverse each room, calculating perimeter and area, and does so for all rooms on a floor, and all floors in a house (assumed to be 3: ground, basement, attic).  It does spit out SVG for each room, the plan is to have it spit out SVG for each floor, and an overlayed SVG of the house.  And I have a process in mind to make the connection of "rooms" on a floor that works in a batch oriented process.

I have never run across any FOSS program which claimed to allow someone to use measurements to produce a CAD drawing (2D).  Hence, I wrote one.  Some places hate Perl, I've no idea your feelings.  Is this of use to you?  I think a person could mangle the ini type config file to work for data input.

I just want to figure out my house, if this isn't useful to others, that's okay.

Reply | Threaded
Open this post in threaded view
|

Re: Measurement input to CAD

dxli
it's fascinating to me.

If you can make a plugin (see LibreCAD source code folder plugins/ ) for LibreCAD to read in your perl command to load your drawings into LibreCAD. LibreCAD doesn't support SVG natively yet, but you can save and share as DXF.

We are currently creating a new version of LibreCAD from scratch, with lua script support, you may want to have a look at: https://github.com/LibreCAD/LibreCAD_3

We would love to support SVG as a native CAD format, so LibreCAD can read and save SVGs.
Reply | Threaded
Open this post in threaded view
|

Re: Measurement input to CAD

dxli
This post was updated on .
In reply to this post by fortran
BTW, LibreCAD supports area and length calculating.

Area calculation limited to Polygons yet. Looking forward to including ellipse/circle/arcs.

Length calculation supports all primitives.

Reply | Threaded
Open this post in threaded view
|

Re: Measurement input to CAD

fortran
In reply to this post by dxli
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.
Reply | Threaded
Open this post in threaded view
|

Re: Measurement input to CAD

dxli
I think length works for spline in LibreCAD, by approximating spline with line segments.

Need to figure out an algorithm for arbitrary contour. Current polygon area is by summation of:

( - y dx + x dy)/2

we can keep this for straight line edges, but add analytical solution for arc/elliptical arcs. This should be after some robust contour detection.
Reply | Threaded
Open this post in threaded view
|

Re: Measurement input to CAD

fortran
Sorry, I should never have brought it up.  A long time ago I was involved with simulating grain growth in solids (like steel).  If a person polishes the surface up properly, you can usually find where the grain boundaries are, and map them out.  How grain boundaries migrate when exposed to elevated temperatures, is to move towards the local center of curvature at a speed dependent on the local curvature.  Doing this might work better if the boundary is parameterised in terms of arc length.

Not really applicable to CAD.  Sorry.

Just in case you wanted to know.
Reply | Threaded
Open this post in threaded view
|

Re: Measurement input to CAD

dxli
Interesting enough.

We thought about adding Voronoi analysis to LibreCAD, and metallography might benefit from Voronoi cells.

Looks like we need to implement area first.
Reply | Threaded
Open this post in threaded view
|

Re: Measurement input to CAD

fortran
Try to mention that Voronoi polygons and Dirchelet polygons (sp?) are dual constructions.  Dirchelet might be seen under the term tesselation, not polygon.