Moving bend note attachment point via API (SolidWorks 2025)

Hi all,

I'm developing a VB.NET add-in (SolidWorks 2025 SP5) that generates sheet metal drawings with flat pattern views. On long parts the flat pattern gets a break view, which can cut through a bend line and hide the bend note. I need to move the bend note attachment point to the edge of the bend line so it stays visible.

Manually this works perfectly: click the note, add a leader, drag the attachment point sideways, remove the leader. The new position survives break views, rebuilds, everything.

I'm running into two separate issues trying to automate this:

Issue 1: API selection does not create the right edit context

When I select a bend note via API (IAnnotation.Select3 or SelectByID2 with various name/coordinate combinations), the selection returns True and the note shows up in the SelectionManager. However, calling IAnnotation.SetLeader3(swSTRAIGHT, ...) after that does not actually activate a leader. GetLeaderCount stays 0.

If I manually click the note with the mouse first, and then call the exact same SetLeader3 code, it works: LeaderCount becomes 1 and I can proceed.

So there is clearly an internal "annotation edit state" that a mouse click sets, but Select3 and SelectByID2 do not. Is there an API call that replicates this? Something like entering annotation edit mode programmatically?

Issue 2: API-moved attachment point resets when a break view is placed or modified

Even when I get past Issue 1 (by manually clicking first), the following sequence happens:

  1. ann.SetLeader3(swSTRAIGHT, ...) > works, LeaderCount = 1
  2. ann.SetLeaderAttachmentPointAtIndex(0, x, y, 0) > works, GetAttachPos confirms new position
  3. Remove leader with SetLeader3(swNO_LEADER, ...) > position still looks correct
  4. Place or modify a break view on the same flat pattern view > attachment point snaps back to the default position (center of the bend line)

When I do the exact same operation fully by hand (drag the attachment point with the mouse instead of using SetLeaderAttachmentPointAtIndex), the position survives break views without any problem.

So SetLeaderAttachmentPointAtIndex does not persist the position the same way as a manual drag. Is there an additional call needed to make the position "stick"? Or does the API method simply not write to the same internal storage as the GUI drag?

Summary:

ApproachLeader activates?Moves attachment?Survives break view?
Fully manual (click + drag)YesYesYes
Manual click + API moveYesYesNo (resets)
API select + API moveNo (LC stays 0)NoN/A

 

 

Any ideas or workarounds would be greatly appreciated.