Author Topic: Making a curve smooth  (Read 4772 times)

0 Members and 1 Guest are viewing this topic.

Vikram

  • Newt
  • Posts: 50
Making a curve smooth
« on: November 02, 2019, 08:55:52 AM »
I have made a VC program which takes a text file with points and make a dxf file out of it. So I have a drawing with many small line segments. You can see the curve here https://www.photobox.co.uk/my/photo/full?photo_id=502293294980

There are many bumps in this curve. I want this drawing to be smooth and in appropriate shape.I tried using spline it does not help. I tried pldiet.lsp,it helped me at some extent but it didn't clear all bumps. I want a method or lisp program which can quickly form a smooth curve maintaing the original shape.
I have uploaded the drawing test.dxf in attachment. You can use it to see whole drawing.
« Last Edit: November 04, 2019, 02:10:25 AM by vikrambest1@gmail.com »

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: Making a curve smooth
« Reply #1 on: November 02, 2019, 12:22:11 PM »
It is a bit unclear what you want. But maybe creating a 2D polyline through the points and changing Fit/Smooth to Cubic is what you are looking for.

Vikram

  • Newt
  • Posts: 50
Re: Making a curve smooth
« Reply #2 on: November 04, 2019, 01:09:36 AM »
Did you see the drawing? there are bulges in the curve which are not getting cleared even by using PEDIT-Spline and Fit. Its a 2d polyline. I want that curve to be continuous and smooth. I have to use it for cutting of wheel. If there are small bulges in that 2d polyline it results in imperfect cutting

BIGAL

  • Swamp Rat
  • Posts: 1398
  • 40 + years of using Autocad
Re: Making a curve smooth
« Reply #3 on: November 04, 2019, 01:14:43 AM »
Don't whinge about what was offered !

The only way to fix is to increase the step size if you have a 100 points make it 400. The more the smoother, a cnc has a stepper motor called that it rotates a small amount to do a curve there are two, one each in X & Y the smaller the step the better the curve.

You want a "best fit arc" curve program, that shape was very ugly. They are out there. The fit curve would be where I would start. At the simplest every 3 points are turned into arcs then compare radius replace and continue. I had a go manually and got something much better. Where did the co-ords come from.

Ps Autocad will not open the dxf Briscad does.

Ps post an image not add for some company.
« Last Edit: November 04, 2019, 01:34:29 AM by BIGAL »
A man who never made a mistake never made anything

Vikram

  • Newt
  • Posts: 50
Re: Making a curve smooth
« Reply #4 on: November 04, 2019, 01:53:11 AM »
I have tried segmenting that line in points more than 400. There is a scanner which uses laser to scan the cords from center of the wheel to the edge.It collects these cords and write it in a txt/tap file. Which I later convert in dxf. I have used the option of Fit and Spline. It just converts the sharp corners in a bump. Is there are lisp which will approximate the line and ignore the points which are out of the smooth curve? Approximation or Interpolation can help. Actually I also tried another way by reducing the points in the line by using PLDiet.lsp It even helped me till some extent like 80% but there are still some bumps.You can see it in second pic. I actually used PLDiet and the used spline to smooth the line. You can see the result in attached PLDtest.dxf

The user who is going to use this is rookie CAD user. So I want to make things simple for him. Just some option which will smoothen this line same like the Spline option which just converts blocks in curves.
That line is the surface of the wheel spokes of a car. if the line is smooth the cutting will be also smooth.
Ps: I'm new to this forum and don't know how to post image here so shared a url of the uploaded pic! Sorry for inconvenience. I have attached the image to the message
« Last Edit: November 04, 2019, 02:49:22 AM by vikrambest1@gmail.com »

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: Making a curve smooth
« Reply #5 on: November 04, 2019, 06:14:23 AM »
Please do not start multiple topics addressing the same problem.

BIGAL

  • Swamp Rat
  • Posts: 1398
  • 40 + years of using Autocad
Re: Making a curve smooth
« Reply #6 on: November 04, 2019, 07:50:23 PM »
Again Vikram you need to look into least squares curve fitting, there is no quick and dirty answer. When I did some manual curves I started to get some reasonable arc radius values that fitted close. Having an idea of where straight sections are also helps. Its trial and error.

What is the part ? If the curve must match a shape then you need original dwgs.

Ps CIV3d has curve fitting.
« Last Edit: November 04, 2019, 08:13:53 PM by BIGAL »
A man who never made a mistake never made anything

hak_vz

  • Mosquito
  • Posts: 2
Re: Making a curve smooth
« Reply #7 on: November 09, 2019, 06:34:22 AM »
Here is my first post on TheSwamp.org.

To make lwpolyline smooth you may use my code posted on
https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/catmull-rom-spline-from-lwpolyline/m-p/9053098/highlight/true#M390376

It creates Catmul-Rom spline from lwpolyline that consists only from line segments. C-R splines are created as a new lwpolyline that passes through
vertecs of original.