Get DrawingCurve from Drawing by Item number (C#)

Get DrawingCurve from Drawing by Item number (C#)

Hubert_Los
Advocate Advocate
422 Views
2 Replies
Message 1 of 3

Get DrawingCurve from Drawing by Item number (C#)

Hubert_Los
Advocate
Advocate

Hello,

 

I'm trying change simple VBA code to C#

 

 

 

Dim oActiveSheet As Sheet

Set oActiveSheet = ThisApplication.ActiveDocument.ActiveSheet
Dim oDrawingCurve As DrawingCurve
Set oDrawingCurve = oActiveSheet.DrawingViews(1).DrawingCurves.Item(1)

 

 

 

 

I tried like this:

 

 

 

DrawingView oDrawingView = oActiveSheet.DrawingViews[1];
DrawingCurvesEnumerator oDrawingCurvesEnumerator = oDrawingView.DrawingCurves;
DrawingCurve oDrawingCurveNew = (DrawingCurve)oDrawingView.DrawingCurves[1];

//or
//DrawingCurve oDrawingCurveNew = oDrawingCurvesEnumerator[1];

 

 

 

 

But it doesn't work.


The same thing happens when he wants to download the Balloon Leader:

 

LeaderNodesEnumerator oLeader = oBalloon.Leader.AllNodes;
LeaderNode ooLeader = oLeader[1];

 

0 Likes
Accepted solutions (1)
423 Views
2 Replies
Replies (2)
Message 2 of 3

JelteDeJong
Mentor
Mentor
Accepted solution

try it like this:

DrawingDocument doc = (DrawingDocument)ThisApplication.ActiveDocument;
Sheet sheet = doc.ActiveSheet;
DrawingView view = sheet.DrawingViews[1];
IEnumerable<DrawingCurve> curves = view.DrawingCurves.Cast<DrawingCurve>();
DrawingCurve curve = curves.First();

var balloon = sheet.Balloons[1];
LeaderNodesEnumerator nodes = balloon.Leader.AllNodes;
LeaderNode node = nodes[1];

Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Blog: hjalte.nl - github.com

0 Likes
Message 3 of 3

Hubert_Los
Advocate
Advocate

@JelteDeJong 

Hello,

 

It works, thank you. I have one more question, how can I get, for example, the 5th curve from the curves?

 

0 Likes