Refactoring

Today was spent on a few different aspects of the project, with a brief interlude to deal with some external (car) stuff. First thing, I got caught up on emails/forums, then did a bit of shopping*, then on to programming! For better or worse, the changes I made aren’t involved in any new features, and didn’t address any specific bugs that I’m aware of (though, I did find a couple possible sources of bugs). But, I think it was a valid use of time because I learned a bit more about the internals of FreeCAD, and think I’ve also cleaned up those internals to a degree.

In object oriented programming, there’s a distinction between “is a” and “has a” relationships. My project today involved splitting one class into two, to make this particular area a bit more consistent and to allow for the use of one piece of functionality provided by the original class without the other.

Specifically, FreeCAD has several classes descended from a parent class Property, which are used to store various pieces of information to be saved into configuration or project files. These are the things that are modified by the Property Viewer. The refactoring I did today took a descendent of the PropertyInteger class – PropertyEnumeration – and made it instead derive directly from Property and contain a (new) Enumeration object. So, PropertyEnumeration now “is a” Property that “has an” Enumeration.

There are a number of reasons I worked on this, none of them is terribly compelling if taken alone, but to me it fell into a category of “things that I’d want a professional programmer to fix, but that I wouldn’t bother with as a hobbyist”. So, the project for tomorrow is to try out those changes in the Drawing-dev branch (which is where I came across a use case for them), then clean up and submit them for testing if they seem worth the trouble.

Also intend to tie up a couple loose ends in Drawing. I’d like to try a couple different options for constraining the position of the new isometric views, then there’s a bug that causes newly added views to not be scaled appropriately sometimes.

Oh! This evening I went over to the maker space and learned a couple interesting things. First, there’s a possibility that I can get access to some machine tools in town! Second, that it’s possible to print nylon with filament type 3D printers, and that some neat things can be done by designing air bubbles into 3D printed nylon parts. That’s got me thinking about a project that was discussed at South Pole – making a 3D ice printer. I’m sure someone has done it already, but it does seem like a fun party trick regardless.

* As for that shopping; I’ve arranged to buy a monitor (2nd hand local), and bought a 3D mouse (amazon). I’m quite intrigued by these 3D mice, looking forward to having one to play with aside from the obvious need to have one for work purposes.

Aleph Objects Rocks!

For a few days now, I’ve been meaning to post an update here on the general state of this experiment. This afternoon, I received a nudge in that direction in the form of a very generous donation from Aleph Objects, makers of open source LulzBot 3D Printers! Thanks so much!

lulzbot logo

For the last week or so I had been considering reducing the time spent on this stuff, as the numbers just weren’t adding up. Now though, it’s clear that I can keep at it for a while longer!

With that in mind, a few thoughts about the experiment so far, in no particular order:

  • The sense of accomplishment that goes with a commit to an open source project is amazing! Open Source gives a real sense of connection with the customer, and there can be an aspect of instant gratification too since it’s so easy to share changes.
  • Although I really like my somewhat-outdated MacBook Pro, laptops aren’t the best ergonomically for all day work. So, I intend to arrange a better workspace, starting with a regular desktop monitor (which I suppose implies a desk!).
  • Keeping abreast of the FreeCAD forum, and updating this blog, takes quite a lot of time! For some reason though, it still feels a bit weird to admit to spending time on work-related online reading, posting, etc. In a regular job I wouldn’t think twice about accounting for equivalent time spent in meetings or on conference calls, but for some reason the OSS equivalent doesn’t feel the same.
  • Especially considering how little effort I’ve put in to publicity of this project, I think this is a viable way to spend a few weeks/months in a productive and fulfilling way. That said, I do need to find a Real Job, and it’s hard to get motivated to work on that while I’ve got so much other fun stuff to do! Fortunately, things on that front are still moving forward, stay tuned.
  • I’ve mentioned the Dunedin maker space, DSPACE, on here only briefly. It’s a great resource, and I’m hoping to get a bit more involved with that as the Drawing workbench gets a little more wrapped up. There are a few 3D printers available at DSPACE, so I’m hoping to get a bit more hands-on experience with drawing up parts in FreeCAD to be printed on them.
  • Getting back to the Aleph Objects donation – as a former Boulderite, I’m super proud of the Colorado tech scene! Thanks guys!

Update

Today was supposed to be a “weekend” day, but a number of events transpired to keep me in front of the computer for much of the day.

First off, I spent some time cleaning up the changes I’ve been working on in the Drawing workbench, and getting them pushed up to github. The main two items are a re-work of code involved in generating “wires”, which are what OpenCASCADE calls collections of edges, some work on BSplines, and the isometric projections. There had been a couple bugs in the BSpline and wire code, finding and fixing those occupied most of yesterday. Now, the Isometric projections aren’t completely done, but they’re usable and I just need to make a few design decisions to finish them up.

A couple other smallish bug fixes made it in, and a lot of cleaning up/commenting source code. There’s a discussion ongoing on the FreeCAD forum regarding code formatting/reviews/etc, so have been occasionally getting distracted by thinking about that stuff too.

Will probably take tomorrow “off”, as I need to take care of some things out of the house, but stay tuned!

Tax Day summary

Mainly this morning was devoted to things outside of FreeCAD, but I made a bit of progress on a couple bugs too.

It took a while to get started, as some other changes to FreeCAD broke the new Drawing module. I’ve been trying to keep the new Drawing module up-to-date with the rest of FreeCAD, to avoid a giant merge headache at the end, so this morning was one of the temporary smaller headaches that are a consequence of that decision.

Bug hunting/fixing involved implementing a small change I figured out yesterday (to fix the dragging bug), and re-working of some code for handling B-Splines (to prevent some exceptions that I think are related to problems in other areas). More to come, but not today!

Quick git tip – global .gitignore

Another minor annoyance removed by a quick configuration change on my system. First, create a file ~/.gitignore_global and add configuration as normal for .gitignore. Then, do:

git config --global core.excludesfile ~/.gitignore_global

Voila! No need to see those omnipresent .DS_Store files from Finder in git’s output anymore!

Drawing TO-DO

This post is a work-in-progress list of things to fix in the Drawing development branch

More like bugs:

  • Rendering issue – can’t really fix without significant work, also isn’t specific to Drawing
  • Select the right (or left or top…) view so that it turns completely blue. than move the front view. You will notice the wrong movement of the selected view (figure out which is better highlight mode between dragging anchor vs child views, and use that mode consistently for both)
  • Update regions are wrong: seems that only the areas in the dotted view frame get updated, if the text below the view goes outside the view frame this becomes a problem, you see remaining artefacts while moving. this also happens a lot when repositioning dimensions
  • When adding dimensions to one view the frame of this view updates not correctly
  • The dimensions get somehow misaligned, they shift on the pages y axis downwards for some reason
  • If you change from first to third angle the positions of left and right views etc change, but not the isometric views.
  • For the A4 template it seems impossible to make the dimension font small enough, you would go to size 4 or lower to get something reasonable, but than the font looks really weird. Also 4 is small… normal size for A4 writing is 12, but this is really huge in the drawing workbench compared to text tools like word
  • Automatic scaling often doesn’t work properly
  • Repaint around the template to remove artefacts
  • Drawing viewer widget should resize
  • Update icons for isometric and orthographic views in the document tree thing. (asked for drawings in the forum)
  • Save and Save As don’t seem to work while Drawing Viewer is open?
  • Figure out what’s going on with the two properties for the template name (TODO in 8476bab)
  • BSpline problem that results in bad bounding boxes (in progress)

More like features:

  • Update template with appropriate text, First/Third angle symbol, customisable logo, etc.
  • Align isometric views too. From ickby: “Best it to anchor them to the orthographic projections, for example the FrontTopRight would be anchored to the Top view top:top, and the FrontTopRight would be anchored to the right view right:right. This would give always a nice projection grid.”
  • Selecting the view for draging should work on the whole view area, not only the dotted frame. So only omit the areas where you can select the lines/dotes etc.
  • Possibly add spinboxes for the scale selector, this would allow change the value with the mouse wheel
  • Ability to change template of an existing drawing
  • Get rid of the “exception as flow control device” in Geometry

Areas to investigate:

  • SVG/PDF/etc export