Placing Leader notes on a drawing

Placing Leader notes on a drawing

emilda.chiuye
Enthusiast Enthusiast
835 Views
2 Replies
Message 1 of 3

Placing Leader notes on a drawing

emilda.chiuye
Enthusiast
Enthusiast

Hello there. 

1) I am trying to automate placing a leader note in a drawing sheet (idw) I copied this from Inventor's helpful API but I need guidance on how to tweak it to suit my environment. 

It is just one view, the note should point to a horizontal line and there is more than one leader note required.

2) The final outcome is to place the notes in Excel which places the leader note in the idw environment at specific points on the part.

Is this achievable?

 

Many Thanks

Emilda

 

    Dim oDrawDoc As DrawingDocument
     oDrawDoc = ThisApplication.ActiveDocument.Add("C:\Working_Directory_File\iLogic\STANDARD DWG",True)

    Dim oActiveSheet As Sheet
     oActiveSheet = oDrawDoc.ActiveSheet

    Dim oDrawingCurveSegment As DrawingCurveSegment
     oDrawingCurveSegment = oDrawDoc.SelectSet.Item(1)

    Dim oDrawingCurve As DrawingCurve
     oDrawingCurve = oDrawingCurveSegment.Parent

    Dim oMidPoint As Point2d
     oMidPoint = oDrawingCurve.MidPoint

    Dim oTG As TransientGeometry
     oTG = ThisApplication.TransientGeometry

    Dim oLeaderPoints As ObjectCollection
     oLeaderPoints = ThisApplication.TransientObjects.CreateObjectCollection

     oLeaderPoints.Add(oTG.CreatePoint2d(oMidPoint.X + 10, oMidPoint.Y + 10))
     oLeaderPoints.Add(oTG.CreatePoint2d(oMidPoint.X + 10, oMidPoint.Y + 5))

 
     oGeometryIntent As GeometryIntent
     oGeometryIntent = oActiveSheet.CreateGeometryIntent(oDrawingCurve)

     oLeaderPoints.Add(oGeometryIntent)

    Dim sText As String
    sText = "API Leader Note"

    Dim oLeaderNote As LeaderNote
     oLeaderNote = oActiveSheet.DrawingNotes.LeaderNotes.Add(oLeaderPoints, sText)

    Dim oFirstNode As LeaderNode
     oFirstNode = oLeaderNote.Leader.RootNode.ChildNodes.Item(1)

    Dim oSecondNode As LeaderNode
     oSecondNode = oFirstNode.ChildNodes.Item(1)

    Call oFirstNode.InsertNode(oSecondNode, oTG.CreatePoint2d(oMidPoint.X + 5, oMidPoint.Y + 5))
End Sub

 

0 Likes
836 Views
2 Replies
Replies (2)
Message 2 of 3

Ralf_Krieg
Advisor
Advisor

Hello

 

How to know which lines should get a leader note? How to identify which line for which Excel note?

A horizontal line is simpliest where Startpoint Y-value and Endpoint Y-Value are the same, as long as no one rotates the view.

You need to explain in your own words step by step how to find the correct line and if more than one line fits all criteria which one to choose. We can only help to "translate" this into code. 😉

Looping for more than one line maybe depents on your selection criteria too.


R. Krieg
RKW Solutions
www.rkw-solutions.com
0 Likes
Message 3 of 3

emilda.chiuye
Enthusiast
Enthusiast

Hello, Thanks for the response

Yes good question, silly of me to be so vague about such vital information.

So the leader notes are on a Revolved feature, I need a number of leader notes to be placed on Revolved Feature1, Revolved Feature2,Revolved Feature3 etc.

As far as driving it with an excel spreadsheet is concerned, my thoughts were referring to a particular sheet eg Sheet1, from a particular cell  eg B9.

I have managed to achieve this with suppressing these features now to apply the same principle with leader notes.

I mean if it can be done manually surely we can automate it?

0 Likes