Author Topic: 3D Circle Fit LISP - No longer functions after editing unit settings  (Read 345 times)

0 Members and 1 Guest are viewing this topic.

jeremyw

  • Mosquito
  • Posts: 2
Hey everyone, we currently use a 3D Circle Fit LISP in C3D2016 to report on surveyed flange faces, but have noticed that since we modified our template unit settings to read clockwise from north, the circle fit routine no longers functions as expected and draws the circle at the correct size, but at a seemingly random angle.

I'm not sure where this file came from as it's not included in the code, can't be found online anymore and outdates any of the CAD staff working for us. It's quite possible this file was developed in-house, as we've got other older programs there were written in-house.

If someone could please take a look and see if they can see what would be causing it; or even point us to a different circle fit LISP, it would be much appreciated. I can't see what would be casuing it, as I'm not aware of a connection between the angular units settings and UCS, and it seems like this program just draws multiple circles at various UCS to fit each 3 point circle, then averages those circles out to get the best fit circle.

Pad

  • Bull Frog
  • Posts: 330
Re: 3D Circle Fit LISP - No longer functions after editing unit settings
« Reply #1 on: July 29, 2022, 12:13:48 PM »

Easiest fix would be to programmatically change the modified unit setting at the beginning of the lisp and have it revert at the end.


jeremyw

  • Mosquito
  • Posts: 2
Re: 3D Circle Fit LISP - No longer functions after editing unit settings
« Reply #2 on: July 31, 2022, 11:04:01 PM »
Thanks Pad, yeah setting ANGBASE and ANGDIR to default at the start, and resetting to our values at the end works, but I'd like to try and figure out what's going on. I think I've figured out that it's this section that needs to be changed, as changing these values changes the rotation of plane that the best fit circle is drawn on, just not sure what the values need to be as I don't quite understand exactly what it's doing.

Code: [Select]
  ((>= ucs_a3 270)(setq ucs_a3 (- ucs_a3 360)))
          ((and (>= ucs_a3 90)(< ucs_a3 270))(setq ucs_a3 (- ucs_a3 180)))