Hickoz_bro Posted December 5, 2008 Posted December 5, 2008 Hi guys, trying to do some work with selecting objects in drawings, and retrieving information. so far i've managed to be able to select an object, in this case a leader note, but i need to retrieve information about it's nodes etc. however, i can't seem to access this information using the code i've got, so i've had to retrieve the reference key for the object, and i was hoping to access the information through drawingnotes.leadernotes which i can get if i reference the objects using leadernotes.item(1) etc... but the problem is that the item number will change as the drawing is edited... SO, the question is, having the reference key for an object, how do i then refer to that object, and access it's properties? code i have so far is: Public Sub TestSelection() ' Create a new clsSelect object. Dim oSelect As New clsLeaderGhost Dim odoc As DrawingDocument Dim oleader As DrawingNote Dim oNotes As LeaderNotes Dim Lrefkey() As Byte Dim lrefkeystr As String Dim Leaderinfo As New Collection Set odoc = ThisApplication.ActiveDocument Set oNotes = odoc.ActiveSheet.DrawingNotes.LeaderNotes ' Call the pick method of the clsSelect object and set ' the filter to pick any Drawing Note. Set oleader = oSelect.Pick(kDrawingNoteFilter) ' Check to make sure an object was selected. If Not oleader Is Nothing Then Call oleader.GetReferenceKey(Lrefkey) lrefkeystr = odoc.ReferenceKeyManager.KeyToString(Lrefkey) For n = 1 To oNotes.Item(Lrefkey).Leader.AllNodes.Count Leaderinfo.Add (oNotes.Item(1).Leader.AllNodes.Item(n).Position.X) Next End If End Sub Quote
borgunit Posted December 5, 2008 Posted December 5, 2008 Knowing nothing about the Inventor API, have you tried adding a breakpoint in the code and seeing what methods or properties are available to the object you are referring to while it is running? Quote
Hickoz_bro Posted December 5, 2008 Author Posted December 5, 2008 Just figured it out while trying to type an explaination for why it wasn't working... i have oLeader declared as a drawingnote, and oNotes declared as leadernotes.... so by declaring oLeader as leadernote (note that oNotes is leadernoteS i.e. plural) i can access all the information i want... thanks for making me look harder :-D Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.