123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120 |
- Attribute VB_Name = "裁切线"
- Sub start()
- If 0 = ActiveSelectionRange.Count Then Exit Sub
-
- Application.Optimization = True
- ActiveDocument.BeginCommandGroup
-
- ActiveDocument.Unit = cdrMillimeter
- Bleed = API.GetSet("Bleed")
- Line_len = API.GetSet("Line_len")
- Outline_Width = API.GetSet("Outline_Width")
- Dim OrigSelection As ShapeRange
- Set OrigSelection = ActiveSelectionRange
-
-
- Dim s1 As Shape
- For Each Target In OrigSelection
- Set s1 = Target
- lx = s1.LeftX: rx = s1.RightX
- By = s1.BottomY: ty = s1.TopY
- cx = s1.CenterX: cy = s1.CenterY
- sw = s1.SizeWidth: sh = s1.SizeHeight
-
-
- Dim s2, s3, s4, s5, s6, s7, s8, s9 As Shape
- Set s2 = ActiveLayer.CreateLineSegment(lx - Bleed, By, lx - (Bleed + Line_len), By)
- Set s3 = ActiveLayer.CreateLineSegment(lx, By - Bleed, lx, By - (Bleed + Line_len))
- Set s4 = ActiveLayer.CreateLineSegment(rx + Bleed, By, rx + (Bleed + Line_len), By)
- Set s5 = ActiveLayer.CreateLineSegment(rx, By - Bleed, rx, By - (Bleed + Line_len))
- Set s6 = ActiveLayer.CreateLineSegment(lx - Bleed, ty, lx - (Bleed + Line_len), ty)
- Set s7 = ActiveLayer.CreateLineSegment(lx, ty + Bleed, lx, ty + (Bleed + Line_len))
- Set s8 = ActiveLayer.CreateLineSegment(rx + Bleed, ty, rx + (Bleed + Line_len), ty)
- Set s9 = ActiveLayer.CreateLineSegment(rx, ty + Bleed, rx, ty + (Bleed + Line_len))
-
- ActiveDocument.AddToSelection s2, s3, s4, s5, s6, s7, s8, s9
- ActiveSelection.Group
- ActiveSelection.Outline.SetProperties Outline_Width
- ActiveSelection.Outline.SetProperties Color:=CreateRegistrationColor
-
- Next Target
- ActiveDocument.EndCommandGroup
-
- Application.Optimization = False
- ActiveWindow.Refresh
- Application.Refresh
- End Sub
- Sub SelectLine_to_Cropline()
- If 0 = ActiveSelectionRange.Count Then Exit Sub
-
- Application.Optimization = True
- ActiveDocument.Unit = cdrMillimeter
-
- ActiveDocument.BeginCommandGroup
-
-
- px = ActiveDocument.Pages.First.CenterX
- py = ActiveDocument.Pages.First.CenterY
- Bleed = API.GetSet("Bleed")
- Line_len = API.GetSet("Line_len")
- Outline_Width = API.GetSet("Outline_Width")
-
- Dim s As Shape
- Dim line As Shape
-
-
- For Each s In ActiveSelection.Shapes
-
- lx = s.LeftX
- rx = s.RightX
- By = s.BottomY
- ty = s.TopY
-
- cx = s.CenterX
- cy = s.CenterY
- sw = s.SizeWidth
- sh = s.SizeHeight
-
-
- If sh <= sw Then
- s.Delete
- If cx < px Then
- Set line = ActiveLayer.CreateLineSegment(0, cy, 0 + Line_len, cy)
- Else
- Set line = ActiveLayer.CreateLineSegment(px * 2, cy, px * 2 - Line_len, cy)
- End If
- End If
-
-
- If sh > sw Then
- s.Delete
- If cy < py Then
- Set line = ActiveLayer.CreateLineSegment(cx, 0, cx, 0 + Line_len)
- Else
- Set line = ActiveLayer.CreateLineSegment(cx, py * 2, cx, py * 2 - Line_len)
- End If
- End If
- line.Outline.SetProperties Outline_Width
- line.Outline.SetProperties Color:=CreateRegistrationColor
- Next s
-
- ActiveDocument.EndCommandGroup
-
- Application.Optimization = False
- ActiveWindow.Refresh
- Application.Refresh
- End Sub
|