Working on the Shaft…

I had some funky music going through my head when I wrote that title.

Ok.. Some I working my way to modeling my the x-axis ball screw shaft.  One thought at the moment, is there’s going to be all kinds of purchased stuff, that is going to this assembly.  I should be able to align up everything to the axis of rotation and then draw the shaft to this.  So on this shaft assembly, the stuff  that’s going to be aligned to the axis of rotation is going to be:

  • The ball screw shaft itself
  • The x-axis bore of the saddle
  • Two bearings
  • A nut.
  • A washer
  • The ballscrew nut
  • A pulley

PulleyOriginJust for fun, I created a sketch in the x-y plane 0,0,0 and then loaded the step file of the SPD pulley I’m planning on using.  It appears that the local origin of the object is centered in the bore (which you’d expect) and the axis of the pulley runs along the pulley.  The zero point appears to coincide with the face of the pulley.
It seems like I should just be able to click on the local origin of the part and then click on the axis of a part and have it all magically align..  I done think FreeCAD can do that yet..

Posted in Uncategorized | Leave a comment

Step 2 done, need to rethink step 3 on the point transfer macro.

So things are moving along on my macro project.  My original goals below  I have  I’ve come to release where flawed. Step 3 is really not necessary when the transfered point becomes the origin of the new sketch plane.

1 Find a point on the sketch plan that needs to be created and save the values.
2) Create a sketch in the x-z plan and offset it so it intersects the point
3) Create a line whose start point on the sketch that intersects the point in step 1(but is not linked to that point) the endpoint and the line are left constraint free while the starting point has a lock constraint applied.

Step3WorkingSortoffThe basic logic in the widget is functional but it needs to be improved on.  I need to think on this a bit.

In review this is what the widget does in this instance.
I have my freeCAD solid that I programmatically extracted and stored the center point coordinates on the circle that’s used to make the counter bore in the saddle.
I had a blank document (SherlineBallScrewXAxis) that I selected in FreeCAD and I clicked on the “Retrieve Selected Target Doc” with identified where I wanted to create a sketch.   (I’m going to draw a ball screw in cross section and then use revolve to generate the solid).    So basically what I did was take the coordinates in the one document to make that the center of a new sketch in my specified target do with a user specified plan.

Initially I thought Id need a line with a lock dimension on the first point.  What I didn’t  consider is the origin of the sketch is point selectable, so that eliminates the need for step 3.

Next thing that I need to do is place the bearings, to help me draw out the x-axis shaft.

Posted in Uncategorized | Leave a comment

Working on step 2 of my point transfer macro..

Ok.. So I started this macro stuff about 10 days ago.  I had to go to see where I am with my goals.

Regardless of whether I do this through a macro or manually, I think the steps would be basically the same in this instance.

1 Find a point on the sketch plan that needs to be created and save the values.
2) Create a sketch in the x-z plan and offset it so it intersects the point
3) Create a line whose start point on the sketch that intersects the point in step 1(but is not linked to that point) the endpoint and the line are left constraint free while the starting point has a lock constraint applied.

This is taking me a little longer than I would have liked. I sort of would have like to have some chips cut already for the Sherline. Oth I think I have a much better grasp of python, although there is still much to know.   Hm  see how long this one takes.  Hopefully I can just blast through this.

So next I need to programmatically create a sketch in freecad.  I could be able to do this through the Gui and it should reveal some of its secrets to me:
Python 2.6.5 (r265:79063, Oct 1 2012, 22:16:31)
[GCC 4.4.3] on linux2
Type ‘help’, ‘copyright’, ‘credits’ or ‘license’ for more information.

>>> App.newDocument()
>>> App.setActiveDocument(“Unnamed”)
>>> App.ActiveDocument=App.getDocument(“Unnamed”)
>>> Gui.ActiveDocument=Gui.getDocument(“Unnamed”)
>>> App.activeDocument().addObject(‘Sketcher::SketchObject’,’Sketch’)
>>> App.activeDocument().Sketch.Placement = App.Placement(App.Vector(0.000000,0.000000,0.000000),App.Rotation(0.000000,0.000000,0.000000,1.000000))
>>> Gui.activeDocument().activeView().setCamera(‘#Inventor V2.1 ascii \n OrthographicCamera {\n viewportMapping ADJUST_CAMERA \n position 0 0 87 \n orientation 0 0 1 0 \n nearDistance -112.88701 \n farDistance 287.28702 \n aspectRatio 1 \n focalDistance 87 \n height 143.52005 }’)
>>> Gui.activeDocument().setEdit(‘Sketch’)

Ok.. this seems fairly straight forward to me except for the four parameters in App.Rotation…
Ohhh. I just stuck in 4 random numbers and this popped up
>>> FreeCAD.Rotation(9,3,3,32)
Quaternion (0.268567,0.0895223,0.0895223,0.954905)

I think the python wrappper is here:

PyObject *RotationPy::PyMake(struct _typeobject *, PyObject *, PyObject *) // Python wrapper
{
// create a new instance of RotationPy and the Twin object
return new RotationPy(new Rotation);
}

Ok.. I’m not that versed on on the python wrapper stuff.
http://free-cad.sourceforge.net/SrcDocu/d9/db3/classBase_1_1RotationPy.html
But I think it basically we take all the constructors in the C++ rotation class.
http://free-cad.sourceforge.net/SrcDocu/d4/d18/classBase_1_1Rotation.html
At the moment I ok with the back that quaternians are used and it’s been setup correctly, since I’m mimicking what’s done with the create sketch dialog I think track down that code and see what it got.
So I want to track down the code that generates this.
Screenshot-Choose orientation

Did a search for Sketch orientation and this popped up
There it is

Searching on XY_radioButton should give me what I need…

Yeps… and here it is: http://free-cad.sourceforge.net/SrcDocu/d0/d00/SketchOrientationDialog_8cpp_source.html

Hm.. Interesting, It seems that that was a use of vectors and angles as well a quaternians..  It’s a shame that they don’t have some standard rotations defined.  Seems like it would come in handy for people like me.

Ok. I copied the C++ code into mywidget.py and I need to pythonize it. Something for tomorrow..
In the back of my mind, I think I’m going to need another widget tool after I get this one done.

I’m thinking I going to have my sketch plane setup to draw my ball screw shaft… But then I’m going to be snapping points from a punch of different drawings to project on that sketch. That should be an interesting project.

Posted in Uncategorized | Leave a comment

In need of a macro for my Sherline Ball Screw retrofit project Step 1 Finished off) Capture the Target Document.

Starting on Step2Ok… I think I’m starting to make some hay here.  Step one capturing the target point is almost done.

Getting back at what I’m trying to do here.   Basically I have a  new  saddle saddle for the Sherline that I want to modle such that it’s in the correct orientation when I export my saddle and ballscrew to step and re-import them for my assembly.  At this point I need a point on the centerline of the x-axis bore/counter bore and then use those coordinates in a different document sketch.

In my particular situation  I need a point that is normally only visible from the sketcher.   As discussed previously there is a bug in the sketcher with selection indexing.  For the moment, I drew  a line concentric to the center, whose end point is visible  outside of sketcher and gave me the coordinates

Ok.. I think this next step should be easy.   I need to create a new document with this document visible and then the selected it and click the button on my widget to trap the target name.

Yep… Pretty easy..  and here’s a quick shot of the code in eric4.   Ok.. Now that’s enough for coding.   I need to change a burnt light head light in my car..

Step2CompletedEric4ScreenShot.

Posted in Uncategorized | Leave a comment

Step 1 continued. Trapping the point in 3d space.