News:

Please note new Forum URL: forum.designcad.com

Main Menu
DesignCAD 3D Max 2027 box
Now available

DesignCAD 2027

Hatches that follow their boundaries, an on-screen dial to turn your model, and a way to find any command by name, in a clean Windows 11 look.

Tangent to 2 Ellipses

Started by bdeck, January 21, 2007, 05:15:36 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

bdeck

This macro is based on an algorithm provided by Crckrjck.

It uses an iterative method to draw tangents between any two arcs, circles, ellipses, or elliptical arcs.

It is initially set to 7 iterations.

Thanks, CJ.

BD



'tan2e.d3m      bdeck   1/07
'Draws tangent between arcs, circles, ellipses, or elliptical arcs
'Based on algorithm provided by Crckrjck.

Alias ENT_POINT               &H010E 
dim xx(20),yy(20),zz(20)

ilim = 7   '***************  how many iterations ? ****************

sys9=sys(9)   ' no of ents in drawing'
if sys(1)>2 then  'no of pts set'
      message "too many points"
      end
endif     

>SetPoints
{
      <UsePresetPoints
      <Maxpoints 2
      <CmdPrompt "set 2 points near circles, arcs, or elipses"
      <Incomplete 1     
}
if sys(1)<2 then
      sys(1)=0
      end
endif

sys(49) = 1  'Disable cursor move on POINTXYZ   
sys(36) = 1  'silent mode
For j = 1 To Sys(1)
  Pointval xx(j), yy(j), zz(j), j
Next j

for i=1 to ilim
      if i>1 then
            >eraselast
            {
            }
      endif
      >TangentTo
      {
             
            <Pointxyz [xx(1), yy(1),zz(1)]
            <Pointxyz [xx(2), yy(2),zz(2)]
      }
     
      if i < ilim then
            xx(2)=xx(1)
            yy(2)=yy(1)
            zz(2)=zz(1)
            entity sys(9)
            query ENT_POINT, 2,xx(1),yy(1),zz(1)
      endif
next i   
 
sys(1)=0
end