Author Topic: Excentric  (Read 3066 times)

0 Members and 1 Guest are viewing this topic.

jp_lujan

  • Guest
Excentric
« on: July 19, 2005, 02:14:53 AM »
I need aid:

Do not know how be able draw the tangent lines, I have the coord. of the point but these are absolute and I wants relative to the puntoInsercion.

Thank you

Code: [Select]

Private Sub cmbOK_Click()
Dim activeDoc As AcadDocument


Dim PtoInsercion As Variant
Dim longitud As Double
Dim EjeMenor As Double
Dim EjeMayor As Double
Dim Prompt1 As String
Dim RadioMenor As Double
Dim RadioMayor As Double
Dim DiferenciaRadios As Double
Dim LongRadios As Double
Dim Pto1X1 As Variant
Dim Pto1Y1 As Variant
Dim Pto2X2 As Variant
Dim Pto2Y2 As Variant



Dim Moffset As Double
Dim ArcObjOffset As Variant



Dim ArcObjMayor As AcadCircle
Dim ArcObjMenor As AcadCircle
Dim ArcExtMayor As AcadCircle
Dim ArcExtMenor As AcadCircle
Dim pt1 As Variant


Dim LinTang1 As AcadLine


Dim pt2(0 To 2) As Double
Dim pt3(0 To 2) As Double
Dim pt4(0 To 2) As Double
Dim pt5(0 To 2) As Double


Set activeDoc = ThisDrawing.Application.ActiveDocument
EjeMenor = txtEjemenor.Value
EjeMayor = txtEjeMayor.Value
longitud = txtLongitud.Value
RadioMayor = txtRadioMayor.Value
RadioMenor = txtRadioMenor.Value


'Oculta el formulario para obtencion de datos
UserForm1.Hide


    'Pide Pto insercion
    Prompt1 = vbCrLf & " Insertion Point: "
    PtoInsercion = activeDoc.Utility.GetPoint(, Prompt1)
    pt1 = activeDoc.Utility.PolarPoint(PtoInsercion, dtr(0#), longitud)
   
    'Dibuja circulos internos
    Set ArcObjMenor = activeDoc.ModelSpace.AddCircle(PtoInsercion, EjeMenor / 2)
    Set ArcObjMayor = activeDoc.ModelSpace.AddCircle(pt1, EjeMayor / 2)
   
    'dibuja circulo externo
    Set ArcObjMenor = activeDoc.ModelSpace.AddCircle(PtoInsercion, RadioMenor)
    Set ArcObjMayor = activeDoc.ModelSpace.AddCircle(pt1, RadioMayor)
 
    'Calculo de puntos
    DiferenciaRadios = RadioMayor - RadioMenor
    LongRadios = (longitud ^ 2 - DiferenciaRadios ^ 2) ^ 0.5
    Pto1X1 = longitud - RadioMayor * (DiferenciaRadios / longitud)
    Pto1Y1 = longitud + RadioMayor * (LongRadios / longitud)
    Pto2X2 = longitud - RadioMenor * (DiferenciaRadios / longitud)
    Pto2Y2 = longitud + RadioMenor * (LongRadios / longitud)
    pt2(0) = Pto1X1
    pt2(1) = Pto1Y1
    pt2(2) = 0
   
    pt3(0) = Pto2X2
    pt3(1) = Pto2Y2
    pt3(2) = 0
   
    'Linea tangente
   
    Set LinTang1 = activeDoc.ModelSpace.AddLine(pt2, pt3)
' pt2 a pt3 are absolute coord I need with respect to a PtoInsercion
End Sub

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Excentric
« Reply #1 on: July 19, 2005, 04:02:59 AM »
I am language challenged, and your code will not compile in isolation, but ...

by example ... it seems to me that if you know the absolute base point < 0, 0, 0>
and you know the object reference point, say < 10, 20, 5 >
and the co-ordinate is say < 11, 33, 4 >
then the relative distance is
11 - 10 = 1
33 - 20 = 13
4 - 5    =  -1

.. but I may be mis-understanding your dilema.

If you need to include translations between UCS's the algorithm becomes a little more complicated, but is essentially the same.
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

jp_lujan

  • Guest
Excentric
« Reply #2 on: July 19, 2005, 05:21:43 AM »
Hello Kerry and thank you:

It is possible attach a file in the forum?

Mark

  • Custom Title
  • Seagull
  • Posts: 28753
Excentric
« Reply #3 on: July 19, 2005, 05:31:33 AM »
Quote from: jp_lujan
It is possible attach a file in the forum?

From the "Swamp links" select "Lilly Pond". Enter your user name "jp_lujan" and password. Create a new directory "jp_lujan" once in the new directory hit the "upload" link.
TheSwamp.org  (serving the CAD community since 2003)

jp_lujan

  • Guest
Excentric
« Reply #4 on: July 20, 2005, 02:08:19 AM »
Thank Mark:

Now the problem is the angle of the greater arch.

Attach the dvb and dwg file.

http://www.theswamp.org/lilly_pond/jp_lujan/Excentrica.dvb?nossi=1

http://www.theswamp.org/lilly_pond/jp_lujan/Excentrica.dwg?nossi=1