#1




Angle of adjacent segments
Starting and Ending Control Point Angels are available for the nodes of a curve but they are rather confusing.
I would like to write a script which would highlight the angle of adjacent segments which are greater than X degrees. For example the image below one angle of the square has been changed to have a very drastic angle. I have tried to use Starting and Ending Control Point Angels of the segments but didn't manage to understand anything. Code:
Sub Tes323rt2() Dim n As Node Dim x As Double, y As Double Dim s As Shape For Each n In ActiveShape.Curve.Nodes If n.Type = cdrCuspNode Then n.GetPosition x, y Set s = ActiveLayer.CreateEllipse2(x, y, 0.01) s.Outline.Color.RGBAssign 255, 255, 0 'MsgBox n.PrevSegment.StartingControlPointAngle & "  " & n.Segment.EndingControlPointAngle & "  " & n.Segment.StartingControlPointAngle & "  " & n.NextSegment.EndingControlPointAngle MsgBox n.Segment.StartingControlPointAngle & "  " & n.Segment.EndingControlPointAngle End If Next n End Sub Private Sub MarkPoint33(seg As Segment, t As Double) Dim x As Double, y As Double Dim s As Shape seg.GetPointPositionAt x, y, t Set s = ActiveLayer.CreateEllipse2(x, y, 0.03) s.Outline.Color.RGBAssign 255, 255, 0 End Sub Thanks in advance for any help! 
#2




It it just a hard request or that nobody wants to help me

#3




I think that narrowing it down to only cusp type nodes should help but I am still stumped with the adjacent angles.
Is everyone stumped aswell? 
#4




Maybe...
This is as close as I have time for....it does pretty well but it not perfect. Hopefully it will give you a hint or two...
Code:
Sub WhatsMyAngle() Dim s As Shape Dim nr As New NodeRange Dim segBefore As Segment Dim segAfter As Segment Dim da As Double Dim n As Node Set s = ActiveShape For Each n In s.Curve.Nodes Set segBefore = n.PrevSegment Set segAfter = n.NextSegment If Not segBefore Is Nothing And Not segAfter Is Nothing Then da = segBefore.EndingControlPointAngle  segAfter.StartingControlPointAngle ActiveLayer.CreateArtisticText n.PositionX, n.PositionY, Round(da, 0) & " degrees", , , "Ariel", 10, , , , cdrCenterAlignment End If Next n End Sub Shelby 
#5




You Rock!
This is exactly what I needed to get me started. I will test it out and post back. Thank You! 
#6




hi Shelbym
in this example can you please help me in a shape like lets say capital A or a square. I am trying to find the angles but the problem is to find if the angle if it is looking inside the object or outside. It is important when I try to extrude the object with a strip. When I try something and think that ? find the result and change the direction of the object that I see I am not successful 
#7




Angle
The following modified code will show a positive angle inside the shape:
Code:
Sub WhatIsMyAngle() Dim n As Node Dim sShape As Shape Dim segBefore As Segment Dim segAfter As Segment Dim da As Double Set sShape = ActiveShape If sShape Is Nothing Then MsgBox "Nothing selected", vbCritical Exit Sub End If If sShape.Type <> cdrCurveShape Then MsgBox "A curve object must be selected", vbCritical Exit Sub End If For Each n In sShape.Curve.Nodes Set segBefore = n.PrevSegment Set segAfter = n.NextSegment If Not segBefore Is Nothing And Not segAfter Is Nothing Then da = segBefore.EndingControlPointAngle  segAfter.StartingControlPointAngle If da < 0 Then da = 360 + da ActiveLayer.CreateArtisticText n.PositionX, n.PositionY, Round(da, 0) & " degrees", , , "Ariel", 8, , , , cdrCenterAlignment End If Next n End Sub Shelby 
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)  
Thread Tools  Search this Thread 
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
Subpaths, Segments, and Nodes  m31uk3  CorelDRAW/Corel DESIGNER VBA  7  20062008 11:28 
Resizing Line Segments  norbert_ds  CorelDRAW/Corel DESIGNER VBA  8  24042007 01:08 
Rotation Angle  norbert_ds  CorelDRAW/Corel DESIGNER VBA  1  20042007 02:39 
Creating lines using angle, dimension and position  Bobbejaan  Code Critique  3  05042007 07:22 
[DrawX3 bug] interface display of fractional angle/size  wOxxOm  General  0  18022006 14:00 