Announcements

The Autodesk Community Forums has a new look. Read more about what's changed on the Community Announcements board.

iLogic to create batch print of pdf's from top level model incl. iParts/iAssy's

richard.christopher
Explorer

iLogic to create batch print of pdf's from top level model incl. iParts/iAssy's

richard.christopher
Explorer
Explorer

First post on this forum, so please be gentle.

 

I have been immersing myself in the world of iLogic over the last few months and have created some templates and standard company rules for iLogic parts and assemblies. This forum and several others have been the backbone of any rules that I have cobbled together and I thank all the contributors for their time and expertise.

 

I should add that I have had some training on iLogic from CADline,  but have no previous experience with iLogic or VB and as yet nobody else in my company is actively using iLogic. I consider myself a competent engineer with a limited knowledge of iLogic and an even more limited understanding of VB….but every day I am learning more from you guys.

 

On the whole, I have managed to achieve everything I have needed to so far, but I need to call upon your help with this problem…

I have been attempting to adapt an iLogic rule that was written by Curtis Waguespack, which outputs a pdf of every drawing referenced by a top level assembly. The rule assumes that the drawings share the same name and location as the next component.

 

I have adapted the code to include revision in the pdf file name and this is working well (see text file attached). The problem that I hope somebody on here may be able to help with is that when the rule encounters an iPart or iAssembly it finds the relevant drawing (in our case, iParts members are listed on a single idw as a tabulated drawing) BUT the pdf filename is not output in the format that I require. I would like the pdf filename to contain the iPart factory part name rather than the iPart member name.

 

I had thought that I might be able to make use of something along the lines of:

 

If oRefDoc.ComponentDefinition.IsiPartMember Then

oDashNo = “”

Else

oDashNo = Mid(oPartNumber,8)

End if

 

i.e. identify if the part or assembly is “standard” or “iPart/iAssembly” and then have the filename set according to that ‘file type’.

 

However, this line of code returns the following error:

 

Error in rule: PDF batch cascade print RMC (part number), in document: 6201266.iam

 

Public member 'IsiPartMember' on type 'AssemblyComponentDefinition' not found.

 

I assume that this is because the rule is running a loop which encounters both parts and assemblies (and assemblies do not contain iPart members)?

 

Can anybody advise how I might be able to identify iParts and iAssemblies so that I can derive the pdf filename that I require?

 

Or is there another way of approaching this?

 

I had considered moving away from tabulated drawings for iParts/iAssemblies and setting the drawing view to active member, but I don’t think this would work when I have an assembly containing two different iPart members from the same factory? Also, our purchasing department would prefer to have a single tabulated drawing to send to their suppliers (rather than a unique pdf for each variant).

 

I have attached a pdf that shows our company part numbering/idw/pdf naming convention that I would like the rule to work on for the various different inventor file types it will encounter.

 

Any help with this would be very much appreciated.

 

Richard C

Inventor 2017 64 bit, Build: 256, Release: 2017.4 Update

Windows 7

 

0 Likes
Reply
942 Views
4 Replies
Replies (4)

MechMachineMan
Advisor
Advisor

 

If oDoc.ComponentDefinition.Type = 100663808 AND oDoc.ComponentDefinition.isIAssemblyMember Then
    'is iAssemblyMember
ElseIf oDoc.ComponentDefinition.Type = 83886592 And oDoc.ComponentDefinition.isiPartMember Then
    'is iPart
Else
    'is std part.
End if




--------------------------------------
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

richard.christopher
Explorer
Explorer
Thank you for your prompt reply MechMachineMan. I have inserted your code in to the rule, substituting oDoc with RefDoc and adding lines to produce a value for my variable oDashNo for each file type. When I run the modified rule I get the same error message as before. Am I amending your code incorrectly? Am I inserting it in the wrong place in the rule? I am sure your post would be enough for most people to take away and implement themselves without further help but as I mentioned in my original post, I am a relative newbie to iLogic and whilst I can manage shorter concise rules that act on single files, this rule is taking me well and truly out of my comfort zone! PS Apologies if the modified text file is not attached in this reply....still getting to grips with the forum. Will try again if necessary. Many Thanks, Richard
0 Likes

MechMachineMan
Advisor
Advisor

Could be that seeing as the call is invalid for the object type it doesn't like it being in the same if statement... this might work better:

 

'Set this first that that it does not need to get rewritten for the 3 separate cases 'and instead only gets overwritten.
oDashNo = Mid(oPartNumber,8)

If oRefDoc.ComponentDefinition.Type = 100663808 Then 
    If oRefDoc.ComponentDefinition.isIAssemblyMember Then
        oDashNo = ""
    End if
ElseIf oRefDoc.ComponentDefinition.Type = 83886592
    If oRefDoc.ComponentDefinition.isiPartMember Then
        oDashNo = ""
    End if
End if

--------------------------------------
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

richard.christopher
Explorer
Explorer
I have had to park this issue for a while as other work commitments have taken priority. I will post an update when I get a chance to revisit. For the time being I am manually renaming any pdf's that are related to an iPart or iAssembly drawing. Thanks for your help so far.
0 Likes