I was inspired to make a little tool to explore this. The model has a cube and a glider stuck together that can be attached to a pair of skew-lines, joined at a vertex. You get to choose the AttachMode in the Dynamic Data enumeration. (OXY, OXZ, OYX, OYZ, OZX, OZY).
In the file, I used Vertex, Vertex, Vertex - but other choices work. Selection1 is the Apex, Selection2 is the end of the blue lIne and Selection3 is the end of the yellow line.
After playing with it, the net result is that for mode OAB (A, B are X, Y, Z). The origin is at the Apex. The A-direction of the glider goes along the blue line towards Selection2. The B-direction of the glider lies in the blue/yellow plane, orthogonal to the A-direction with the yellow direction having a positive projection.
If you play with it you'll quickly get the idea. There doesn't appear to be FeaturePython points and lines, so I used the following to create them:
Code: Select all
class Line:
def __init__(self, obj, start, end):
''' Add two point properties '''
obj.addProperty("App::PropertyVector","Start","Line","Start point")
obj.addProperty("App::PropertyVector","End","Line","End point")
obj.Start = start
obj.End = end
obj.Proxy = self
def execute(self, obj):
''' Print a short message when doing a recomputation, this method is mandatory '''
obj.Shape = Part.makeLine(obj.Start,obj.End)
class ViewProviderLine:
def __init__(self, obj):
''' Set this object to the proxy object of the actual view provider '''
obj.Proxy = self
def getDefaultDisplayMode(self):
''' Return the name of the default display mode. It must be defined in getDisplayModes. '''
return "Flat Lines"
def makeLine(start = FreeCAD.Vector(0, 0, 0), end = FreeCAD.Vector(10, 10, 10)):
doc=FreeCAD.ActiveDocument
a=FreeCAD.ActiveDocument.addObject("Part::FeaturePython","Line")
Line(a, start, end)
ViewProviderLine(a.ViewObject)
#a.ViewObject.Proxy=0 # just set it to something different from None
doc.recompute()
return a
class Point:
def __init__(self, obj, loc):
''' Point location '''
obj.addProperty("App::PropertyVector","Location","Point","Location")
obj.Location = loc
obj.addExtension('Part::AttachExtensionPython')
obj.Proxy = self
def execute(self, obj):
obj.Shape = Part.Point(obj.Location).toShape()
obj.positionBySupport() #add attachment
class ViewProviderPoint:
def __init__(self, obj):
''' Set this object to the proxy object of the actual view provider '''
obj.Proxy = self
def getDefaultDisplayMode(self):
''' Return the name of the default display mode. It must be defined in getDisplayModes. '''
return "Points"
def makePoint(loc = FreeCAD.Vector(0, 0, 0)):
doc=FreeCAD.ActiveDocument
a=FreeCAD.ActiveDocument.addObject("Part::FeaturePython","Point")
Point(a, loc)
ViewProviderPoint(a.ViewObject)
#a.ViewObject.Proxy=0 # just set it to something different from None
doc.recompute()
return a
doc = App.ActiveDocument
p = makePoint(FreeCAD.Vector(10,10,10))
p.ViewObject.PointSize = 6
l1 = makeLine(FreeCAD.Vector(10,10,10), FreeCAD.Vector(20,20,20))
l1.ViewObject.LineColor = (0.0, 0.333, 1.0, 0.0)
l2 = makeLine(FreeCAD.Vector(10,10,10), FreeCAD.Vector(20,20,0))
l2.ViewObject.LineColor = (1.0, 1.0, 0.0, 0.0)