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. 

4 comments:

  1. Interesting! Wouldn't it have the risk of having more than one point at he same position (think of a top-down projection) and then confuse the topology matching?

    ReplyDelete
  2. That is true, however, I believe edges which are projected parallel to the view direction can be isolated and made hidden. If this is indeed true then we should be able to hide any vertices that lie directly behind the other.

    If this isn't true, then I guess we would have to sort the vertices in distance from the view point and if there is tolerance between them.

    Hopefully it will be the easier first option!

    ReplyDelete
  3. Hey Luke!

    Does your drawing module use Webkit to render the svg, or still on QtSVG?

    I wrote some stuff in Python to make dimensions out of svg snippets, but haven't tested it so it probably doesn't work or it looks wrong. I could dust that off and get it more ready if you think it would be useless.

    As for a helper, I would love to but I have so far been horrendously unreliable and slow moving when it comes to programming for FreeCAD, also my C++ is a little dismal. If you would like to chat on IRC or somewhere else, you could delegate small or tedious tasks to me.

    ReplyDelete
  4. I have switched to using Qt's QGraphicsView bypassing SVG and this would be used for interaction. I am still slightly sceptical of using webkit for direct interaction.

    However, I would be interested in keeping compatibility and allowing Drawings to be exported to SVG and other formats - this should be relativly simple to achieve because the geometry provides properties that can be easily represented into other formats. I will be on IRC today, so let me know if you would like to get involved.

    ReplyDelete