News:

Please remember to do a search before you ask a question!

Main Menu
TurboCAD 2026 Platinum box
Now available

TurboCAD 2026.2

The latest update for TurboCAD 2026. It installs over any 2026 build and keeps your activation, drawings and settings. Get it from the Start Page or Help > Check for Update.

Default Spline 'type' when Inserted as PPM

Started by Alvin Gregorio, September 11, 2020, 05:06:13 PM

Previous topic - Next topic

0 Members and 0 Guests are viewing this topic.

Henry Hubich

In a programming language that can draw a Spline through an array of points, I should think an approach like this is feasible: Stepping through discrete values of (say) "u," populate a 3D array using the same expressions for X,Y, and Z that you'd use in the Curve from Law tool. Then step through the array itself to define the points for drawing the curve.

Henry H

murray dickinson

TC Mac and PunchCAD have an import format called .spl, spline, that's a simple script version of curve and surface by law, as well as explicit line, polyline, arc, curve, mesh and nurb surface.  You just declare the object and list its parameters as a text file, give the file .spl attachment and import it into the CAD app, the objects are created.  It used to be in every level of 3D PunchCAD, but it might be ACIS-related so not in the base models any more.  However, every app should do it that simply.  Now that PunchCAD and TC are stablemates and given that TC's mesh handling's been ported to PunchCAD, let's have some quid pro quo, hmm?   

Henry Hubich

Quote from: murray dickinson on September 27, 2020, 03:18:48 PM
TC Mac and PunchCAD have an import format called .spl, spline, that's a simple script version of curve and surface by law, as well as explicit line, polyline, arc, curve, mesh and nurb surface.  You just declare the object and list its parameters as a text file, give the file .spl attachment and import it into the CAD app, the objects are created.  It used to be in every level of 3D PunchCAD, but it might be ACIS-related so not in the base models any more.  However, every app should do it that simply.  Now that PunchCAD and TC are stablemates and given that TC's mesh handling's been ported to PunchCAD, let's have some quid pro quo, hmm?

Listing its parameters is the tricky part.

Henry H

murray dickinson

Yes, but thanks to you particularly, Henry, and to posters on the PunchCAD site and the FreeCAD site (FreeCAD has Python plugins written by contributors that do parametric curves and surfaces too) for bringing me on with that.  I've used your contributions, and theirs, as starting points for experimentation, nothing falls apart if I'm not successful, start again.   I've even taken on some certificate-level study of maths and programming because my state government's (New South Wales in Australia) tertiary and further education institutions offered them for free as a response to COVID lockdowns, a couple of thousand dollars value, so kudos to them for some personally directly useful tax offset.  Calculus is still mostly black arts to me, I'm like an infant learning to talk, but less so than it used to be and improving.  Thanks to you, Henry, and others.   

murray dickinson

If you are
Quote from: Henry Hubich on September 27, 2020, 08:42:17 AM
In a programming language that can draw a Spline through an array of points, I should think an approach like this is feasible: Stepping through discrete values of (say) "u," populate a 3D array using the same expressions for X,Y, and Z that you'd use in the Curve from Law tool. Then step through the array itself to define the points for drawing the curve.

Henry H

Henry, it occurs to me that a curve by law with limits will be different from a curve that's interpolated through points in the way you describe.  I think this is because an interpolated curve has no information beyond the start and end points, so the curve's slope through the end points is governed by the adjacent point on one side only, while the slope of a law curve must still be implicitly governed by the law even outside the limits.  Is that right? 

nikkipollard

#55
It does seem like the computer would be doing double the work. Calculating curves for curve by law then recalculating for the spline.
It is a pity polylines show all the nodes

I thought you might be able to use a polyline and then convert to curve - but it does strange things.
Nikki
TC20 platinum, TC 2015 platinum
TC 2017 with lightworks
TC 2021 platinum
Windows 11 Home 22h

Henry Hubich

Quote from: nikkipollard on September 29, 2020, 12:24:42 AM
It does seem like the computer would be doing double the work. Calculating curves for curve by law then recalculating for the spline.
It is a pity polylines show all the nodes

I thought you might be able to use a polyline and then convert to curve - but it does strange things.

If Curve by Law is available, Nikki, then there's no need for my suggested approach.

Henry H

Henry Hubich

Quote from: murray dickinson on September 28, 2020, 08:34:52 PM
If you are
Quote from: Henry Hubich on September 27, 2020, 08:42:17 AM
In a programming language that can draw a Spline through an array of points, I should think an approach like this is feasible: Stepping through discrete values of (say) "u," populate a 3D array using the same expressions for X,Y, and Z that you'd use in the Curve from Law tool. Then step through the array itself to define the points for drawing the curve.

Henry H

Henry, it occurs to me that a curve by law with limits will be different from a curve that's interpolated through points in the way you describe.  I think this is because an interpolated curve has no information beyond the start and end points, so the curve's slope through the end points is governed by the adjacent point on one side only, while the slope of a law curve must still be implicitly governed by the law even outside the limits.  Is that right?

Good point, Murray, and I think You're right. A comparison of Alvin's "tornado" Spline with my Curve from Law substitute shows a slope difference of about 2.3° at the end even though the endpoints coincide.

Henry H

nikkipollard

#58
Quote from: Henry Hubich on September 29, 2020, 10:10:23 AM
Quote from: nikkipollard on September 29, 2020, 12:24:42 AM
It does seem like the computer would be doing double the work. Calculating curves for curve by law then recalculating for the spline.
It is a pity polylines show all the nodes

I thought you might be able to use a polyline and then convert to curve - but it does strange things.



If Curve by Law is available, Nikki, then there's no need for my suggested approach.

Henry H

Yes sorry I didn't mean TC curve by law I was referring to your suggested method as an alternative to curve by law for Alvin.
I did a quick test with your approach and a simple 2d polyline with straight segments and very small intervals
Converting that polyline to a curve seemed to work . but I don't think convert to curve works  with a 3d polyline.




Nikki
TC20 platinum, TC 2015 platinum
TC 2017 with lightworks
TC 2021 platinum
Windows 11 Home 22h