Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Ellipse End Point As Dxf File

1 REPLY 1
Reply
Message 1 of 2
isocam
456 Views, 1 Reply

Ellipse End Point As Dxf File

Can anybody help?

 

I am trying to get the start and end point of an elliptical arc to be the same as an AutoCAD dxf file.

 

I am using the following code.....

 

 Case kSketchEllipseObject, kSketchEllipticalArcObject
                    CentreX = sketchEnt.CenterSketchPoint.Geometry.x * 10

                    CentreY = sketchEnt.CenterSketchPoint.Geometry.y * 10

 

                    X1 = sketchEnt.MajorAxisVector.x * 10

                    Y1 = sketchEnt.MajorAxisVector.y * 10
                                     
                    MajorRadius = sketchEnt.MajorRadius * 10
                    MinorRadius = sketchEnt.MinorRadius * 10
                
                    AxisRatio = MinorRadius / MajorRadius
                   
                    EllipseAngle = Atn(Y1 / X1) * Rad
                    
                    X1 = 0 - (MajorRadius * Cos(EllipseAngle * Pi / 180))
                   
                    Y1 = 0 - (MajorRadius * Sin(EllipseAngle * Pi / 180))
                   
                    Select Case sketchEnt.Type
                      Case kSketchEllipseObject
                           aStart = 0

                           aEnd = 2 * Pi
                      Case kSketchEllipticalArcObject
                           Angle = sketchEnt.StartAngle
                          
                           aStart = Atn(Sin(Angle) / (AxisRatio * Cos(Angle)))

 

                           If aStart > (Angle + Pi) Then aStart = aStart - (2 * Pi)
   
                           If aStart < (Angle - Pi) Then aStart = aStart + (2 * Pi)
                        
                           Angle = Angle + sketchEnt.SweepAngle
                         
                           aEnd = Atn(Sin(Angle) / (AxisRatio * Cos(Angle)))

                           If aEnd > (Angle + Pi) Then aEnd = aEnd - (2 * Pi)
   
                           If aEnd < (Angle - Pi) Then aEnd = aEnd + (2 * Pi)
                    End Select

 

I can get the start point OK but I am having problems with the end point.

 

Does anybody know what I am doing wrong?

1 REPLY 1
Message 2 of 2
Vladimir.Ananyev
in reply to: isocam

The following VBA sample illustrates access to end points of the sketch elliptical arc:

Sub SketchEllipticalArc_Ends()

  Dim oSketch As PlanarSketch
  Set oSketch = ThisApplication.ActiveEditObject

  Dim oArc As SketchEllipticalArc
  Set oArc = oSketch.SketchEllipticalArcs.Item(1)
  
  Dim StartPoint As SketchPoint
  Set StartPoint = oArc.StartSketchPoint
  
  Dim EndPoint As SketchPoint
  Set EndPoint = oArc.EndSketchPoint
  
  With StartPoint.Geometry
    Debug.Print "Start point  x = "; .X
    Debug.Print "Start point  y = "; .Y
  End With
  
  With EndPoint.Geometry
    Debug.Print "End point    x = "; .X
    Debug.Print "End point    y = "; .Y
  End With
  
End Sub 

 


Vladimir Ananyev
Developer Technical Services
Autodesk Developer Network

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report