Sunday, 17 March 2013

First step of having DImensions in Drawing Module


Spent today working on adding dimension support. The first results are in and are quite pleasing. The dimension lines aren't correct but do indeed move interactively and the values for the dimensions update with changes basic changes in geometry. Obviously this is no where near being done, but is a step in the right direction once again.

-----
One area that does become problematic is making large changes in the geometry, and will be quite troublesome to deal with, even with robust naming. This should be a problem with vertices. because they cannot be decomposed further. 

Currently dimensions refer to the individual projected edge, or vertex because in theory multiple projected curves could exist. This needs further thought, but perhaps the best solution is consider merging projected edges together which share the original reference to the object and then having dimensions refer to these instead. Any ideas? 


Friday, 15 March 2013

Projecting Points - Drawing Module


Having started on dimensioning support I stumbled across quite an obvious problem, how would I do point to point  Dimensioning. Obviously I could extrapolate the points from the edges and use these, but any changes in the Base FreeCAD model and your dimensions would very easily mess-up. 

I started thinking about this last night and indeed to support such dimensioning modes with parametric relations, the points would have to be projected from the base FreeCAD model. I hit a brick wall trying to figure this out last night, but suddenly it came to me this morning. Sleep is a powerful thing. 

All I had to do is use the Projector algorithm to project points from project curves and then check if these can be referenced to the original object by checking if the topology exactly matches. 

The result is the above, all the points are recognised from the original object and now means we can in theory reference these. It is slightly dumb at the minute, because it projects points from all the edges (even if they are hidden). However, it should be trivial to fix this. 

Obviously in the GUI, the points will be hidden until an appropriate tool is used but is a step in the right direction indeed!

Easter break officially begins today and hopefully will have a helper who can assist me on the Drawing Module too *fingers crossed. 

Thursday, 14 March 2013

Further work on Measurements Framework

I've spent a bit more time and adding more measurement tools that should be quite useful now for querying geometric properties of FreeCAD objects. This now includes measuring the
  • total length of selected edges
  • shortest distance between point and edge
  • shortest distance between point and face
  • radius of an arc or circle

Also now we can calculate the centre of mass for a selection of objects in a straightforward manner:



Fundamentally these were quite easy to calculate as they are provided by Open Cascade essentially for free and therefore it hasn't been very difficult to implement this.


Since the essential functionality is already there, the next step is to integrate this with the Drawing Module. This should hopefully be the start a dimensioning tool!

Hopefully I can push this onto Git for people to try during the weekend.


In slightly unrelated news to FreeCAD: I have finally received some funding for an interesting expedition that I will be attempting once finished University in June. Under this premise I do hope to continue working on FreeCAD as I will still be in civilisation and should have enough time to make smaller contributions and experiments that may be useful. It would be interesting to see if it would be possible to develop this on the go. Anyway we will have to see!




Saturday, 9 March 2013

First signs of measuring

I spent last night putting something rudimentary together for this Measurement module to see how it will work. Surprisingly, I was up till 1:30AM probably because of a sugar high brought on by making chocolate cake last night. Nevertheless I was up bright and early to finish off my work from last night, and already we are bearing results:



Below 'Import Measure' are the commands used for making a measurement, hopefully it seems quite logical:

The output works correctly and fortunately when the geometry in the FreeCAD object does change, taking a new measurement does indeed return the correct result.

My only concern at the minute is whether it seems a good idea to bundle so many different measurements together in one package, even if the correct mode can be chosen and when the selection is incorrect an error is politely thrown to the user.

I guess in reality, this is more of a convenience solution to provide parametric measurement for most important measurements that both the user and in the case of Drawing Module may need.

What are people's thoughts?

Thursday, 7 March 2013

Measurements Framework: (Plan of Action)

Having some further thought on making the measurement framework, my overall idea is that this should be very accessible to a novice user either using the command line or the GUI. Simplicity is key. Specifically the user should be able to specify a set of geometric features: edge or points and the measurement framework figures the rest out - that's the plan atleast!



This could be extended to gather more complex information such as surface area when specifying a face for the measurement or perhaps retrieving the moment of inertia or mass, for a given FreeCAD part. 

Querying Information:

This builds up a quite complex cases, but what I think would be eventually be a good idea is to create an extensible approach, so that plugins could be called to provide extra methods when querying a set of features. This is over-kill at the minute, but could be interesting. 

If a particular query cannot be made - e.g. querying the surface area of an edge an Exception will be thrown. Potentially this means we could introduce annotations that can reference the measurements and appropriately display output: e.g. 'Volume of My FreeCAD object: myMeasurement.volume()'

Building Annotations and Dimensions

Making use of measurements can be temporary, (whether in the command line or GUI). Using an object to store this information with reference properties means that these can be parametric hence update automatically. This means we should be able to pass this Measurement Object to a Dimension Feature and it can automatically create this and be absorbed into the Document. 

The Dimension Feature will be an Annotation Feature which will provide a more extensive coverage of options such as tolerances, dimension line type etc. These Dimension Features could in theory be used in the Drawing Module or in any other area of FreeCAD or atleast I would hope. 

Hopefully this sounds good!

Now it's time to shut up and time to start coding!




Tuesday, 5 March 2013

Thoughts on making Measurements

After having some troubles with projected faces (dealing with correct wire orders)  for the mean time I have considered looking at measurements or the ability to add parametric dimensions to drawings. These are dimensions which will update with geometry accordingly.

With some discussion on the forums about this: further discussion encouraged the idea for a generic measurement framework which would be useful throughout FreeCAD to make useful parametric dimensions and 'temporary' measurements which are common place inside most CAD packages.

Temporary measurement is a tool that provides a quick and convenient method to check the length of an edge or the distance (including components) between two points. These points use geometric references to provide a more accurate measurement unlike previously.

Parametric dimensions are more permanent and would be stored inside the Document as a feature or an annotation in the Drawing Module.

The Measurement framework aims to take a set of geometric entries such as line edge or two points and calculate the distance between them using a given vector. This is fairly simple stuff, but having a centralised framework would allow it to be adopted in other areas in FreeCAD, namely the Drawing Module for providing dimensioning support. it is in fact possible to calculate this from the projected shapes inside Drawing but using the previous reference geometry provides a means of obtaining the 'true' value for the geometric feature and will adapt to changes to the 3D Part more sensibly. However, in the future there could be an option for using projected lengths. 

Eventually, I would imagine this can be extended for displaying and calculating more complex properties such as moment or inertia, centre of mass etc. For the time being the measurement framework will only provide a c++ and python framework. The focus for the interface is simplicity - where it will specify the geometric features used and should then be able to determine measurement. There will be most likely ambiguous cases so giving an option to override this seems sensible.

In the Drawing Module  my aim is to apply a similar philosophy of creating dimensions using one tool; some people don't prefer this understandably, so there will tool bar and menu options for creating specific dimension types. In most cases this will allow convenient dimensioning.

I still need to figure out including point contacts since these are not explicitly projected by OCC and are contained inside the edge data.

This was slight regurgitation of thoughts I had on this before I attempt to start so apologies if this wasn't written well.

+ Checking out the current state of the Drawing Module:

I figured that it would be good idea to share my progress so far and allow people to contribute. The module is no where near ready for any testing - so please don't point out the obvious if something's broke. If there are any users interested in helping develop I would be more happy to take feedback and contributions to help with development!

Please checkout the github repo:
https://github.com/mrlukeparry/FreeCAD_sf_master/tree/drawing