Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use wire instead of bspline #14

Open
looooo opened this issue Oct 21, 2019 · 2 comments
Open

use wire instead of bspline #14

looooo opened this issue Oct 21, 2019 · 2 comments

Comments

@looooo
Copy link

looooo commented Oct 21, 2019

It would be nice to use a wire (list of edges) instead of one bspline as the profile. This way exact geometry can be created where possible (eg cylindrical faces are created from a arc) and edges are created on sharp corners. An example can be found in the gear-workbench:
looooo/freecad.gears#1 (comment)

Btw.: Helical projection is a great idea!

@mwganson
Copy link
Owner

Sorry to be so late replying. I just noticed this today. Thanks for the feedback.

@mwganson
Copy link
Owner

I looked at your code. Replacing the bspline edges with arcs, where possible, would likely improve the look of the final sweep object, but my method of creating the threadprofile objects might make that a bit tricky. I'll have to think on it some more.

Basically, I make the traditional 2d profile (scaled to 1mm pitch) and place it on the xz plane, then take a straight edge and begin at the bottom of the profile and move it up to the top in 720 increments, taking the intersection to find the x-coordinate at that z-position each step along the way. This is done in a separate macro to create the lists of data for each thread profile ahead of time. Probably there are more elegant ways of doing it, but I'm really just a hack. The data then gets translated into the bspline profile once the minor diameter and pitch are known at runtime. Where the original profile is a simple vertical line the bspline basically becomes a standard arc (but still is a bspline). I could replace those sections with arcs to improve the quality (and likely performance) at least there. In this image the vertical section of the 2d profile circled in red is what could become a standard arc.

Snip macro screenshot-99928d

But I don't think even that is actually a straight vertical edge, but rather has a very subtle angle to it.

One recent change I made seems to have improved the quality of the sweep object:

                #spline.interpolate(obj.Points, PeriodicFlag = True, Parameters = self.knotSeq)
                spline.approximate(Points = obj.Points, DegMin = 3, DegMax = 5, Tolerance = .003692, Continuity = 'C3', ParamType = 'ChordLength')
                spline.setPeriodic()

The threadprofile objects are now C3 continuity instead of C2. Still not perfect, but much improved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants