Author Topic: Find center pt of bulge of a filleted rectangle?  (Read 2099 times)

0 Members and 1 Guest are viewing this topic.

Hangman

  • Guest
Find center pt of bulge of a filleted rectangle?
« on: March 29, 2006, 10:45:29 AM »
Hey all,
I have a question &/or possibly a challenge for you all.
I have a rectangle created with the 'rectang' command with a fillet of  X units multiplied by the dimscale.  For sake of argument, we'll use ... 5 in. rad on the corners in this example.
I am searching for the center of these corners.  I want to find the center of a filleted corner closest to a random pick.  So, I am assuming I would first need to designate each center cpt1, cpt2, cpt3, cpt4, starting from the lower left and going clockwise.  Then, with a random pick on the outside of the rectangle, whichever cpt point is closest to that pick would become my designated corner.
What would be the best way to go about finding this???
Do you have any suggestions / ideas on this ... program???
What would be the coding sequence for finding the center, i.e.: (setq cpt1 (caddr cdr cddr yada yada ...  I don't know)
Thanks for your input.
« Last Edit: March 29, 2006, 04:05:29 PM by CAB »

Jeff_M

  • King Gator
  • Posts: 4099
  • C3D user & customizer
Re: Closest pick wins ...
« Reply #1 on: March 29, 2006, 12:43:40 PM »
Select rectangle
Use the (vlax-curve-*) functions to:
getclosestpointto the pick point ...(cdr (entsel))
PT=getparamatpoint
PARAM=get the nearest param (if PT is < X.5 then (fix(PT)) else (1+ (fix(PT))))
if PARAM < PT
  if PARAM = 0 then BULGE#=LASTBULGE
  else BULGE#=PARAM - 1
else BULGE#=PARAM

calculate CtrPt from bulge