1
1

cropline.bas 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. Attribute VB_Name = "裁切线"
  2. Sub start()
  3. '// 设置当前文档 尺寸单位mm 出血和线长
  4. ActiveDocument.Unit = cdrMillimeter
  5. Bleed = 2
  6. line_len = 3
  7. '// 定义当前选择物件 分别获得 左右下上中心坐标(x,y)和尺寸信息
  8. Dim s1 As Shape
  9. Set s1 = ActiveSelection
  10. lx = s1.LeftX
  11. rx = s1.RightX
  12. by = s1.BottomY
  13. ty = s1.TopY
  14. cx = s1.CenterX
  15. cy = s1.CenterY
  16. sw = s1.SizeWidth
  17. sh = s1.SizeHeight
  18. '// 添加裁切线,分别左下-右下-左上-右上
  19. Dim s2, s3, s4, s5, s6, s7, s8, s9 As Shape
  20. Set s2 = ActiveLayer.CreateLineSegment(lx - Bleed, by, lx - (Bleed + line_len), by)
  21. Set s3 = ActiveLayer.CreateLineSegment(lx, by - Bleed, lx, by - (Bleed + line_len))
  22. Set s4 = ActiveLayer.CreateLineSegment(rx + Bleed, by, rx + (Bleed + line_len), by)
  23. Set s5 = ActiveLayer.CreateLineSegment(rx, by - Bleed, rx, by - (Bleed + line_len))
  24. Set s6 = ActiveLayer.CreateLineSegment(lx - Bleed, ty, lx - (Bleed + line_len), ty)
  25. Set s7 = ActiveLayer.CreateLineSegment(lx, ty + Bleed, lx, ty + (Bleed + line_len))
  26. Set s8 = ActiveLayer.CreateLineSegment(rx + Bleed, ty, rx + (Bleed + line_len), ty)
  27. Set s9 = ActiveLayer.CreateLineSegment(rx, ty + Bleed, rx, ty + (Bleed + line_len))
  28. '// 选中裁切线 群组 设置线宽和注册色
  29. ActiveDocument.AddToSelection s2, s3, s4, s5, s6, s7, s8, s9
  30. ActiveSelection.Group
  31. ActiveSelection.Outline.SetProperties 0.1
  32. ActiveSelection.Outline.SetProperties Color:=CreateRegistrationColor
  33. End Sub