Announcements

Starting in December, we will archive content from the community that is 10 years and older. This FAQ provides more information.

Inventor Api 2023 Leader with parameter from subassembly

alex_vela10
Observer
Observer

Inventor Api 2023 Leader with parameter from subassembly

alex_vela10
Observer
Observer

Hi everyone,

 

Recently, I was trying to create a leader note including a parameter by the Inventor API. I found out that the way of doing this is using the formatted text and it works fine for the bottom level of the assembly (single part). I can add a parameter (e.g. the description iproperty) for every individual part of one assembly/subassembly.

alex_vela10_0-1687849644447.png

 

However, when trying to add the parameter by formatted text for the subassembly source (one level above) it seems not to work and it adds the parameter of the bottom level (single part) of the leader associate occurrence.

alex_vela10_1-1687849717675.png

 

Is it possible to carry our what i am trying by the Inventor API?

 

Any help is well appreciated.

 

Thank you

0 Likes
Reply
299 Views
3 Replies
Replies (3)

A.Acheson
Mentor
Mentor

Hi @alex_vela10 

One method is to attach a leader at the level you need and then read the formatted text. This will give the various documents required to created the text. 

 

At the code level the curve you pick will be at the parts level but you will need to get to the parent occurrence of the part occurrence. See API help here for parentoccurrence

 

Attach any code attempt that you have. 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
0 Likes

alex_vela10
Observer
Observer

Thank you for the reply Alan

 

I have tried to get the formatted text from two different leaders created manually: one with the description iproperty of the bottom level member (single part) and the other with the description iproperty of the level above (the subassembly source). However, the formatted text that i get is the same in both cases so I am stuck at that point. How could I attach the leader to the desired level?

 

Thank for your help. it is really appreciated.

0 Likes

A.Acheson
Mentor
Mentor

Hi @alex_vela10 

It looks like your using a newer version than 2020 so I cannot test your methods. Can you attach the sample of the formatted text your seeing. There may be a pattern than can be exposed. 

 

If your not worried about having formatted text you can just put the text of the iproperty directly into the leader.

Again if you can explain how much you want to automate and also attach the code your using that will help you get to your end goal. 

 

This is what I used for a quick test. 

Dim drawDoc As DrawingDocument = ThisDoc.Document
For Each LeadNte As LeaderNote In drawDoc.ActiveSheet.DrawingNotes.LeaderNotes
   Logger.Info(LeadNte.FormattedText)
Next

 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
0 Likes