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

Helix not STEP converted correctly #72

Open
marcocecchiscmgroup opened this issue Jun 7, 2023 · 2 comments
Open

Helix not STEP converted correctly #72

marcocecchiscmgroup opened this issue Jun 7, 2023 · 2 comments

Comments

@marcocecchiscmgroup
Copy link

marcocecchiscmgroup commented Jun 7, 2023

If you create a plain helix with Fusion360, such as this one:

image

its STEP converted version looks like this:

  1. ShareCAD
    image

  2. Autodesk viewer
    image

helix_plain.zip

@marcocecchiscmgroup marcocecchiscmgroup changed the title Plain Fusion360 helix not STEP converted correctly Helix not STEP converted correctly Jun 8, 2023
@marcocecchiscmgroup
Copy link
Author

marcocecchiscmgroup commented Jun 8, 2023

The fix should be something along these lines:

		steps_U = Helix.calcSteps(min_U, max_U, (max_U - min_U) / (2 * pi) * 4)
		steps_V = Helix.calcSteps(min_V, max_V, (max_V - min_V) / (2 * pi) * 6)
		baseCirclePoints = []
		for v in steps_V:
			p = VEC(r * cos(v), 0, r * sin(v))
			baseCirclePoints.append(p)
		for u in steps_U:
			c = Helix.calcPoint(u, min_U, self.facApex, r_maj, r_min, handed, pitch)
			circle = []
			for v in baseCirclePoints:
				rot1 = rotation_matrix(DIR_X, pi / 2)
				backRotated = vecRotateMat(self.vecAxis, rot1)
				rot = rotation_matrix(backRotated, u)
				p = vecRotateMat(v, rot)
				circle.append(p + c)
			points.append(circle)

but I am not sure why this breaks demo-status-0.6.ipt. I didn't have too much time today to look at.
Any hints?

image

@marcocecchiscmgroup
Copy link
Author

marcocecchiscmgroup commented Jun 9, 2023

My suspicions were confirmed by switching to another library, as I knew the aforementioned calculations were correct.
Problem is that, the buggy OCCT interpolate() (as almost anything else in OCCT that it's not a 'hello, world' job) fails to find a decent spline surface from points. The thing is that the number of steps:

steps_U = Helix.calcSteps(min_U, max_U, (max_U - min_U) / (2 * pi) * 4)
steps_V = Helix.calcSteps(min_V, max_V, (max_V - min_V) / (2 * pi) * 6)

cannot be fixed, at least the U, but must depend on the 'pitch' length, as you call it (isn't pitch an angle?). But with a 'big' number my helix was OK, whilst your demo-status-0.6.ipt failed.
In the enclosed patch I implemented a dirty hack to use the geomdl spline interpolation algorithm. From there, to keep it simple, I created a OCCT BSplineSurface from control points and knots, which happens to work. In the future, as we also spoke in the past, the Part.BSpline* can be totally got ridden of.

UPDATED:

patch.zip

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

1 participant