TheSwamp
Code Red => VB(A) => Topic started by: jp_lujan 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
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
-
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.
-
Hello Kerry and thank you:
It is possible attach a file in the forum?
-
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.
-
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