Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Get the Center Point of Selected Arc

1 REPLY 1
SOLVED
Reply
Message 1 of 2
Anonymous
1150 Views, 1 Reply

Get the Center Point of Selected Arc

Hello All,

 

I'm writing a script to mirror a line off of an arc. I'm having troubles finding a way to automatically identify a mirror line, (presumably one that would go from the arc's edge to its center point). The way the code works right now is that a user must select the center point to define the line over which the line will be mirrored.

 

 

Sub PLINEMIRROR()

    Dim rayLine As AcadLWPolyline
    Dim perpLine As AcadLWPolyline
    Dim Points(0 To 3) As Double
    Dim pt1 As Variant
    Dim pt2 As Variant
    Dim mirrorObj As AcadLWPolyline
    
    'Allows user to define ray points
    pt1 = ThisDrawing.Utility.GetPoint(, "Pick Point to Begin Line:")
    pt2 = ThisDrawing.Utility.GetPoint(pt1, "Pick Trace Start Point:")
    
    'Stores pt Variant values to Points Double values.
    Points(0) = pt1(0)
    Points(1) = pt1(1)
    Points(2) = pt2(0)
    Points(3) = pt2(1)
    
    'Creates PLine object "rayLine"
    Set rayLine = ThisDrawing.ModelSpace.AddLightWeightPolyline(Points)
    
    focCtr = ThisDrawing.Utility.GetPoint(, "Choose Focal Center of Curve")
    
    Set mirrorObj = rayLine.Mirror(pt2, focCtr)

End Sub

Essentially what I want to happen is for focCtr to be found automatically upon selection of pt2.

 

 

I've been playing around with some solutions that I've found on other forums, but have had no luck. The most promising piece of code that I've found is this: 

Sub ss()
Dim ss As AcadSelectionSet
Dim obj As AcadObject
Dim oArc As AcadArc

Set ss = ThisDrawing.SelectionSets.Add("ss1")
ss.SelectOnScreen
For Each obj In ss
If TypeOf obj Is AcadArc Then
Set oArc = obj
Debug.Print oLine.StartPoint(0)
End If
Next
ss.Delete
End Sub

However, the AcadArc object doesn't have a GetCenter property like the AcadCircle object.

1 REPLY 1
Message 2 of 2
dlanorh
in reply to: Anonymous

https://knowledge.autodesk.com/search-result/caas/CloudHelp/cloudhelp/2016/ENU/AutoCAD-ActiveX/files...

 

As an arc is just a part of a circle it has a center property

I am not one of the robots you're looking for

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

Post to forums  

Technology Administrators


Autodesk Design & Make Report