Community
Inventor Forum
Welcome to Autodesk’s Inventor Forums. Share your knowledge, ask questions, and explore popular Inventor topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Any way to attach item numbers from parts list to drawing view labels?

50 REPLIES 50
SOLVED
Reply
Message 1 of 51
lkrenzler
5827 Views, 50 Replies

Any way to attach item numbers from parts list to drawing view labels?

Is there any way to attach the part number from the parts list to a drawing view?  I've attached a very simple example.  

 

Many parts I have need separate detail drawings.  The part obviously has an item number in the parts list which can change if items are added/sorted etc.

 

In the view label, I'd like to have the item number so that they can change with the parts list and stay attched to the drawing view.

 

Any ideas on how to do this?  Thanks for any help.

 

PLst.jpg

 

Num.jpg

----------------------------------------------------------------------------------

Inventor Pro 2019 - Win. 10 - GeForce GTX 1080 .
50 REPLIES 50
Message 21 of 51
lkrenzler
in reply to: salariua

Adrian and Brendan have very kindly posted an update to this code: http://blog.ads-sol.com/2014/10/item-number-on-drawing-views.html

 

It's been working for me so if you're having similar issues, give it a try 🙂

 

A big thanks to these guys!

----------------------------------------------------------------------------------

Inventor Pro 2019 - Win. 10 - GeForce GTX 1080 .
Message 22 of 51
rhasell
in reply to: lkrenzler

Hi

 

I have been lurking on this post.

 

THANK YOU, I downloaded the code this morning, as I currently have to get ±150 drawings out by Monday, I figured anything to help speed up the process.

 

With a few small tweeks, it has saved me around 10 minutes per Itemised drawing.

 

I have already setup some formatting and label prompts,thanks to Curtis and Autodesk, this has just been added to my arsenal.

 

Thanks heaps.

 

Reg
2024.2
Please Accept as a solution / Kudos
Message 23 of 51
salariua
in reply to: rhasell

Glad you found it usefull. WE are all watching Curtis's blog, most of this code is a copy in one form or another from there.

 

150+ drawings? That sounds like a job for Code Injector, thank you Megajerk for providing it.

 

 

 

 

Adrian S.
blog.ads-sol.com 

AIP2012-2020 i7 6700k AMD R9 370
Did you find this reply helpful ?
If so please use the Accepted Solutions or Like button - Thank you!
Message 24 of 51
Baishihu
in reply to: lkrenzler

Thank all of you.

 

That is great.

 

But it doesn't work when the assembly has virtual parts. Could you please fix this? Some of our models have virtual parts.

 

Regards,

 

Message 25 of 51
salariua
in reply to: Baishihu

What's the error? You don't have views for virtual parts, so I am guessing it's failing when getting the filepath of the virtual component. Is this what you're seeing?

 

 

Adrian S.
blog.ads-sol.com 

AIP2012-2020 i7 6700k AMD R9 370
Did you find this reply helpful ?
If so please use the Accepted Solutions or Like button - Thank you!
Message 26 of 51
Baishihu
in reply to: salariua

When an assembly model has Virtual component, The iLogic doesn't work. After I delete the component, it works perfect;y.

 

I hope somebody could help me fix this.

 

Regards,

Message 27 of 51
Baishihu
in reply to: Baishihu

After more test, I find an assembly can have virtual components as long as they are filtered out from Parts List.

 

Thanks

Message 28 of 51
salariua
in reply to: Baishihu

I fyou replace:

oRowFileName = oRow.ReferencedFiles.Item(1).FullFileName

with

Try ' try and get the full file name of the PL item
   oRowFileName = oRow.ReferencedFiles.Item(1).FullFileName
Catch 'on error go to next item
   Continue For
End Try
 

you should be fine.

Adrian S.
blog.ads-sol.com 

AIP2012-2020 i7 6700k AMD R9 370
Did you find this reply helpful ?
If so please use the Accepted Solutions or Like button - Thank you!
Message 29 of 51
Baishihu
in reply to: salariua

Your way works.

 

It help me a lot. Thank you very much.

 

Have a nice day

Message 30 of 51
Baishihu
in reply to: salariua

I would like to give you more Kudos, but I don't know how.

 

I really appreciate your help.

 

thank you again.

Message 31 of 51
salariua
in reply to: Baishihu

Glad it works

 

We are all here to help each other, design faster, better products.

Adrian S.
blog.ads-sol.com 

AIP2012-2020 i7 6700k AMD R9 370
Did you find this reply helpful ?
If so please use the Accepted Solutions or Like button - Thank you!
Message 32 of 51
Baishihu
in reply to: salariua

Thank you!

 

One more question:

 

I would like the Item number has a circle around it. Could you please give it a try? I have searched on the Internet, but nothing I can get.

 

Regards

Message 33 of 51
salariua
in reply to: Baishihu

You can have whatever format of text you can get while editing the view label. Haven't found how to have it in a circle but you can have it in bold, underline, and you could add "" around it to diferentiate it: ITEM: '1'

 

Here's how to get the format from the label, kudos to Curtis:

 

http://forums.autodesk.com/t5/inventor-general-discussion/help-with-view-label-ilogic-rule/td-p/5001...

Adrian S.
blog.ads-sol.com 

AIP2012-2020 i7 6700k AMD R9 370
Did you find this reply helpful ?
If so please use the Accepted Solutions or Like button - Thank you!
Message 34 of 51
Baishihu
in reply to: salariua

Thank you very much!

 

Have a nice day

Message 35 of 51
Baishihu
in reply to: salariua

Is it possibly to only show base view label with item number when there are more than one view?

 

Thanks

Message 36 of 51
salariua
in reply to: Baishihu

You need to look into identifying the main views.

 

If you replace

 

oStringItem = "<StyleOverride Underline='True' FontSize='0.35'> ITEM " & oItemValue & " </StyleOverride>"

 

with

 

If oView.ViewType = 10501 Then
  oStringItem = "<StyleOverride Underline='True' FontSize='0.35'> ITEM " & oItemValue & " </StyleOverride>"
Else
  oStringItem = "<StyleOverride Underline='True' FontSize='0.35'></StyleOverride>"
End If

 

it will add the label on just the main views. You can also use kProjectedDrawingViewType instead of 10501.

 

Here is a link with the view types.

http://forums.autodesk.com/t5/inventor-general-discussion/ilogic-get-view-type/td-p/4700481

Adrian S.
blog.ads-sol.com 

AIP2012-2020 i7 6700k AMD R9 370
Did you find this reply helpful ?
If so please use the Accepted Solutions or Like button - Thank you!
Message 37 of 51
Baishihu
in reply to: salariua

Many thanks to you!

 

You are appreciated.

 

Have a great weekend!

Tags (1)
Message 38 of 51
Baishihu
in reply to: salariua

[cid:image001.png@01D007F6.3D346EA0]


Thank you for your reply. I appreciated it.

When my assembly has a virtual component, I always get the above warning when I run the iLogic in the drawing. After I delete the virtual component, the iLogic works perfect. I hope you or somebody else could help me to fix this. This iLogic is very helpful.

Have a nice day

Hongjie
Message 39 of 51
salariua
in reply to: salariua

Small update to the code. If you have more than one Parts Lists on the drawing, like I had (frame drawing containing Material List) then the code needs to look for a specific table name rather than first one found.

 

The original code was looking at the first parts list

 

oPartsList = oPartsLists.Item(1)

and you need it to search for a specific title: “Parts List” so the code is:

 

For i=1 To oPartsLists.Count
               If oPartsLists.Item(i).Title = "PARTS LIST" Then
                       oPartsList = oPartsLists.Item(i)
                       Exit For
               Else
                'do nothing
               End If
Next
Adrian S.
blog.ads-sol.com 

AIP2012-2020 i7 6700k AMD R9 370
Did you find this reply helpful ?
If so please use the Accepted Solutions or Like button - Thank you!
Message 40 of 51
Anonymous
in reply to: salariua

Greetings!

 

I was trying to enter your "Item numbers on drawing view" code into ilogic and I will admit i am an absolute novice in iLogic and programming in general.

 

What parts of the code do I have to change to fit my filenames and such to make it work?

 

This is the error i get when i try to enter a new rule in my .iam model

 

"

Error in rule: Rule2, in document: OVEN FRAME WELDMENT.iam

Unable to cast COM object of type 'System.__ComObject' to interface type 'Inventor.DrawingDocument'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{29F0D467-C114-11D2-B77F-0060B0F159EF}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE))."

 

Or perhaps do you have a recommendation for a beginner tutorial in iLogic programming so I can get better understanding of the syntax?

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report