Shaping operations and "bogus" Symmetrical nodes

It has been noted/discussed in at least two other threads that shaping operations (Weld, Trim, Boundary, etc.) can sometime produce content that will initially have correct geometry, but that can unexpectedly become distorted when some types of node editing operations are performed.

Annoying bug when working with curvers!

Nodes convert on weld, objects distort when nodes moved

My observations are that this has to do with nodes that were Symmetrical nodes before the shaping operation, but should have been changed to Smooth nodes as a result of the shaping operation. These nodes cannot be Symmetrical and produce the correct geometry, but they are still identified as being Symmetrical. Note in this screenshot that the node is identified as being Symmetrical, but the control points are not equal distances away from the node (as they should be if a node is Symmetrical).

If certain node editing operations are performed, such nodes appear to "wake up" and assert their Symmetrical identity - which distorts the geometry.

One way to work around this is to perform the shaping operation, then manually find every such node and change it from Symmetrical to Smooth. Depending on the complexity of the shape, that might be very tedious.

As a less-tedious workaround, here is a VBA macro I wrote that checks each node in a Curve that is identified as Symmetrical. If the control points are not equal distances from the node, then that node is considered to be a "bogus" Symmetrical node, and is changed to Smooth.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
Option Explicit

Sub fix_bogus_symmetrical_nodes()
Dim sr As ShapeRange
Dim s As Shape
Dim nodeThis As Node
Const dblLengthToleranceTenthMicrons As Double = 50
Dim lngNodesChangedCounter As Long
Const strMacroName As String = "Fix Bogus Symmetrical Nodes"


    On Error GoTo ErrHandler
    
    EventsEnabled = False
    Optimization = True
    ActiveDocument.BeginCommandGroup "Fix Bogus Symmetrical Nodes"
    
    Set sr = ActiveSelectionRange
    
    If sr.Count = 1 Then
        If sr(1).Type = cdrCurveShape Then
            Set s = sr(1)
            For Each nodeThis In s.Curve.Nodes
                If nodeThis.Type = cdrSymmetricalNode Then
                    If Abs(nodeThis.PrevSegment.EndingControlPointLength - nodeThis.NextSegment.StartingControlPointLength) > ActiveDocument.ToUnits(dblLengthToleranceTenthMicrons, cdrTenthMicron) Then
                        nodeThis.Type = cdrSmoothNode
                        lngNodesChangedCounter = lngNodesChangedCounter + 1
                    End If
                End If
            Next nodeThis
            MsgBox "Number of nodes changed: " & lngNodesChangedCounter, vbInformation, strMacroName
        Else
            MsgBox "Selection is not a Curve.", vbInformation, strMacroName
        End If
    Else
        MsgBox "Exactly one Curve shape must be selected.", vbInformation, strMacroName
    End If

ExitSub:
    ActiveDocument.EndCommandGroup
    Optimization = False
    EventsEnabled = True
    Exit Sub
    
ErrHandler:
    MsgBox "Error occured: " & Err.Description
    Resume ExitSub
End Sub

That same code is in the .GMS file in this.ZIP archive:

JQ_Fix_Bogus_Symmetrical_Nodes - GMS in ZIP

Here is a short video showing an example of a situation where this bug shows up, and how changing those "bogus" Symmetrical nodes to Smooth can be used to correct the problem:

VIDEO: Fix Bogus Symmetrical Nodes

.

Parents Reply Children