CorelDRAW vba cdr插件 节点创建切线

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值