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.
Solved! Go to Solution.
Solved by lkrenzler. Go to Solution.
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!
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.
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.
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,
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?
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,
After more test, I find an assembly can have virtual components as long as they are filtered out from Parts List.
Thanks
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.
Glad it works
We are all here to help each other, design faster, better products.
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
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:
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
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
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?