Hello,
I have one thing that i cannot do and did not found anywhere and would help me a lot if it will be possible.
The thing is to make code which do exactly the thing like knife tool.
I found, that there are cdrtools, but dont have idea of how to use them
cdrToolBezierKnifecdrToolKnife
For example i have some shape crossed with 2point line and i would like to knife the shape according to 2 point line, so that the shapes will not be closed like if i do this with trim - it will be just divided to two shapes.
If you can do this or point me to solution, i will be very gratefull.
Thank you
you can use Segment.GetIntersections to find intersect points (shape with line), after this use Segment.AddNodeAt at this points and Node.BreakApart to split node to 2 nodes. Finally you can use Shape.BreakApart to get separated unclosed shapes
Just thinking - maybe can be easier when i combine line and shape, than i get the interception nodes, but still - how to achieve that the shape will be divided by the line?...
For example this "P" made original font - changed to curve - splitted by line to top and bottom part
sorry - last time i wrote append - but i confused with append - i just append square and then run partialdelete on appended square like this code bellow (sorry if i make some confusion about what i type
Dim crv As Curve Set crv = ActiveDocument.CreateCurve With crv.CreateSubPath(sX - 80, sY) .AppendLineSegment sX + len, sY - 1 .AppendLineSegment sX + len, sY - 2 .AppendLineSegment sX - len, sY - 2 .AppendLineSegment sX - len, sY - 1 .Closed = True End With ActivePage.CustomCommand "PartialDelete", "DeleteFromPath", crv
Hi Shark,
this code works me, but it is not 100% accurate and dont know why.. (at this time i know the 2point line is 90mm length, so i use it absolute..
And also i work with absolute values, so at this point of time it is sadly not so plastic
sX = s2.PositionXsY = s2.PositionY
MsgBox sX & "" & sY s2.Delete s1.Copy s1.Outline.SetProperties Color:=CreateCMYKColor(0, 100, 100, 0) End If
'MsgBox sX'MsgBox sY Dim crv As Curve Set crv = ActiveDocument.CreateCurve With crv.CreateSubPath(sX, sY - 0.1) .AppendLineSegment sX + 90, sY - 0.1 .AppendLineSegment sX + 90, sY - 200 .AppendLineSegment sX, sY - 200 .AppendLineSegment sX, sY - 0.1 .Closed = True End With ActivePage.CustomCommand "PartialDelete", "DeleteFromPath", crv
ActiveDocument.ActiveLayer.Paste
Set sr = ActivePage.Layers("Layer 1").Shapes.All
For Each s In sr If s.Outline.Color.IsSame(CreateCMYKColor(0, 100, 100, 0)) Then s.Copy End If Next s
Set crv = ActiveDocument.CreateCurve With crv.CreateSubPath(sX, sY + 0.1) .AppendLineSegment sX + 90, sY + 0.1 .AppendLineSegment sX + 90, sY + 200 .AppendLineSegment sX, sY + 200 .AppendLineSegment sX, sY + 0.1 .Closed = True End With ActivePage.CustomCommand "PartialDelete", "DeleteFromPath", crv
all intersections are ok, but only this one is strangly at top
Hi
Do you need such a final result?
Hi Shark - Sorry for asking here, but could you contact me privately - I might have an opportunity for you. Thx!