![]() |
#1
|
|||
|
|||
![]()
Hi
the code below adds nodes to a curve and then breaks the curve apart but I dont know how to then work with the new curves (Im intending to recolour them each in a separate colour). How do you refer to the new objects created when you break a curve apart? nic Code:
Dim s as shape, sr as ShapeRange, sp as SubPath, nr as NodeRange Set sr = ActivePage.Shapes.FindShapes() 'loop thru shapes For Each s In sr s.Curve.SubPaths.First.AddNodeAt 0.333, cdrRelativeSegmentOffset s.Curve.SubPaths.First.AddNodeAt 0.666, cdrRelativeSegmentOffset 'break nodes and curve Set nr = s.Curve.Nodes.All nr.BreakApart nr.RemoveAll s.BreakApart 'bogus code 's.PART1.Outline.Color.RGBAssign 255, 0, 0 's.PART2.Outline.Color.RGBAssign 0, 255, 0 's.PART3.Outline.Color.RGBAssign 0, 0, 255 Next s Last edited by nic; 04-10-2014 at 11:40. |
#2
|
||||
|
||||
![]()
The easiest way to do this is the use BreakApartEx it will return a ShapeRange with all the newly created shapes.
Here is your code modified a bit, it will randomly change the outline color: Code:
Dim s As Shape, sr As ShapeRange, sp As SubPath, nr As NodeRange Set sr = ActivePage.Shapes.FindShapes() Dim srBrokenCurves As New ShapeRange Dim n As Long, num As Long 'loop thru shapes For Each s In sr s.Curve.SubPaths.First.AddNodeAt 0.333, cdrRelativeSegmentOffset s.Curve.SubPaths.First.AddNodeAt 0.666, cdrRelativeSegmentOffset 'break nodes and curve Set nr = s.Curve.Nodes.All nr.BreakApart nr.RemoveAll srBrokenCurves.AddRange s.BreakApartEx Next s num = ActivePalette.ColorCount For Each s In srBrokenCurves n = CLng(Fix(Rnd() * num)) + 1 s.Outline.Color = ActivePalette.Color(n) Next s -Shelby |
#3
|
|||
|
|||
![]()
Hi Shelby
thank you, that does exactly what I was after - BreakApartEx - a new tool to add to my toolbox. Many thanks nic |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Custom Docker to generate parts of 3D box for laser/CNC cut | Plixo | CorelDRAW/Corel DESIGNER VBA | 3 | 19-12-2013 22:07 |
Splict funtction parts retrieval | ddonnahoe | CorelDRAW/Corel DESIGNER VBA | 2 | 06-04-2012 08:30 |
dimensions broken apart | HeauxmBru | General | 3 | 29-04-2011 11:14 |
X4:s1.PlaceTextInside itm1 broken | ddonnahoe | CorelDRAW/Corel DESIGNER VBA | 3 | 29-01-2008 08:31 |
ActiveView.OriginX is broken???? | jemmyell | CorelDRAW/Corel DESIGNER VBA | 2 | 24-01-2005 20:09 |