Private Sub CommandButton1_Click()
ActiveDocument.Unit = cdrMillimeter
On Error Resume Next
Dim nod As Node, nodr As NodeRange, seg As Segment
Dim sl As Shape, x As Double, y As Double, a1 As Double
Dim dx As Double, dy As Double, a2 As Double
Dim i As Long
Set nodr = ActiveShape.Curve.Selection
If nodr.Count > 1 Then MsgBox "请选择一个节点后重试", vbExclamation, "aa": Exit Sub
If nodr.Count < 1 Then MsgBox "请选择一个节点后重试", vbExclamation, "aa": Exit Sub
For Each nod In ActiveShape.Curve.Selection
' nod.Segment.GetPerpendicularAt
nod.GetPosition x, y
a1 = nod.Segment.GetTangentAt(1, cdrRelativeSegmentOffset) * 3.1415926 / 180
Next nod
dx = 50 * Cos(a1)
dy = 50 * Sin(a1)
Set sl = ActiveLayer.CreateLineSegment(x - dx, y - dy, x + dx, y + dy)
ActiveShape.Outline.Color.CMYKAssign 0, 60, 100, 0
End Sub
CorelDRAW vba cdr插件 节点创建切线
于 2024-12-31 13:13:28 首次发布