List all parts with drawings

List all parts with drawings

Anonymous
Not applicable
2,572 Views
10 Replies
Message 1 of 11

List all parts with drawings

Anonymous
Not applicable

Hi Guys

 

I want to know if its possible to create an iLogic Code to go through the part list of an assembly and check if there is a drawing made and at the end of the code there should be a list as a text file with some kind of "yes" or "no"

 

would that be possible??

 

Thanks for your support!!

 

PS: I am not an iLogic professional but I want to learn!!!

 

Cheers

 

Thomas

2,573 Views
10 Replies
Replies (10)
Message 2 of 11

TONELLAL
Collaborator
Collaborator

Hi Thomas,

When you say "a part list", what do you speak about :

  • the part list placed on the drawing from a view ?
  • the list of all the parts contained by an assembly ?

 

I don't think you can find the drawing from the name of the document. You need to test all drawings, and for each of them check if it use a defined document.

If you only want to know if each part in an assembly has an associated drawing, the easiest way is : 

  • all drawings are named as the part
  • all the drawings are stored in a defined folder

So you can test if, for each *.ipt, you have a corresponding *.dwg.in the defined folder.

 

Let me know if I understand your problem correctly ^^

 

Alain

Message 3 of 11

MechMachineMan
Advisor
Advisor

Yes.

 

But unless you want to iterate though EVERY FILE on your file system, you need to think up of some sort of search algorithm

 

If your part number is also used in the drawing name, you could easily open an assembly of parts and run a rule for all of the parts in it.

 

Also, by suggesting you want it to go through the partslist specifically, you are implying a solution for your problem which actually might have a better solution. Think carefully about how you describe your problem/needs for the solution and try to not imply solutions as it makes things more difficult for everyone.

 

In this case, the more efficient route is to just iterate through the AllReferencedDocuments container instead of having to access the BOM object and recursively iterate through the BOM rows...

 

Dim oAsmDoc As Document
oAsmDoc = ThisDoc.Document

For Each oSubDoc in oAsmDoc.AllReferencedDocuments
    'oDrawingPath = System.IO.Path.GetDirectoryName(oSubDoc.FullFileName)
    'oDrawingName = System.IO.Path.GetBaseName(oSubDoc.FullFileName)

    oDrawingName = LEFT(oSubDoc.FullFileName, LEN(oSubDoc.FullFileName) - 4) & ".idw"

     If System.IO.File.Exists(oDrawingName) = True Then
          iProperties.Value(System.IO.Path.GetFileName(oSubDoc.FullFileName), "Custom", "HasDrawing") = True
     Else
          iProperties.Value(System.IO.Path.GetFileName(oSubDoc.FullFileName), "Custom", "HasDrawing") = False       
     End if
Next

 


--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.

Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization


iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread

Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects

Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help

Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
Message 4 of 11

Martin-Winkler-Consulting
Advisor
Advisor

Hi,

if you are using Vault you can get this information there by checking all connected documents of the assembly. 

Martin Winkler
CAD Developer
Did you find this post helpful? Feel free to like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.


EESignature

Message 5 of 11

Anonymous
Not applicable

Hi Justin

 

sorry for my not 100% perfect description of my needs - i am not an native english speaker....  🙂

 

When I say "part-list" i mean the browser structure in the Inventor assembly.

 

and i´ve tested your code - thanks a lot for that!!!

but what is the result? It seems that the code is correct - but there is no message after?

 

would it be possible to wright the result into a text file?? or just in a message box?

that would be great!

 

thx a lot!!

 

Thomas

0 Likes
Message 6 of 11

MechMachineMan
Advisor
Advisor

That's because it writes it to the inventor file.

 

Open the files and look at the iProperties, or use the Column chooser in the BOM to add in the custom iProp "HasDrawing".

 

It will be True if there is a drawing, False if there is not.


--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.

Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization


iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread

Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects

Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help

Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
Message 7 of 11

Anonymous
Not applicable

Hi Justin

 

thats a good idea with the user defined property - and it works so far.

but - if there is a drawing including a part i have in my assembly, there is still a "no" in the iProperty.

also after starting the iLogic code again

and also if i delete the iproperty and start the code again - still "no"!

 

i work with Productstream Professional - and the drawing does not have the same name as the part. i dont know how inventor handle this.

 

thanks again for your fabulous support!!

 

cheers

Thomas

 

 

 

0 Likes
Message 8 of 11

TONELLAL
Collaborator
Collaborator

Hello,

Justin's code function only when the drawing name is the same as the part name, it does not analyze links between files !

It just indicate if there is a drawing file with the same name as a part file, but it does not check that drawing and part are linked. This is totally independant from Vault (or Productstream) links.

If you want to know if all your parts have a drawing, whatever the filename, you have to go in each drawing, get the part file name used by this drawing, then check if this part is used in the current assembly.

0 Likes
Message 9 of 11

MechMachineMan
Advisor
Advisor

Precisely!

 

It's already good to find out requirements for a project halfway through it....

 

 

Anyways, do you have the drawing number stored in the parts as an iProperty or something? Or a reference sheet? Or is there a simple algorithm that determines that drawing name based on info in the part file? This would definitely be easiest.

 

Otherwise I can write something that will take about 3 years to run that searches your file system and establishes file references....


--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.

Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization


iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread

Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects

Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help

Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
0 Likes
Message 10 of 11

TONELLAL
Collaborator
Collaborator

A Vault add-iin ? Could be an idea, this could work with Vault Visual Management.

0 Likes
Message 11 of 11

RSNIDER1953
Contributor
Contributor

Justin K,

I too am looking for a way to list all parts in an assembly that have a .idw. We name our .idw's using the same name as the .ipt/.iam. I tried your code below and got it to work in Inventor 2023. I don't know anything about iLogic. Can this be changed so there is a custom iproperty called "DrawingName" and it shows in the assembly parts list as the full drawing file name with extension instead of Yes/No? If so, I can do a custom list in the .idw for the assembly that lists all the drawings required to build the assembly. Thanks so much for taking the time to even read this post!

0 Likes