• Industries
  • Products
  • Buy
  • Services & Support
  • Communities
  • Discussion Groups

    Autodesk Inventor Customization

    Reply
    Distinguished Contributor
    Posts: 119
    Registered: ‎03-16-2006
    Accepted Solution

    iLogic and Copy Design

    471 Views, 6 Replies
    06-27-2011 03:40 PM

    Would like to use assembly driven by iLogic to create "variations" of the assembly, Vault, perform copy design, and have the iLogic rules in the copied design still work.

    As near as I can tell, an ilogic statement such as:

     

    Parameter("main_dp:1", "main_dp_ht") = case_ht-.25 

     

    actually addresses the file main_dp.ipt

     

    Thus, if during the copy design process I name the new file main_dp_new.ipt  (so I can generate unique file names in the Vault), when I run the rule in the copied design I get an error telling me the component cannot be found. I tried doing the copy design without the "update part number" checked, but that does not work so I can only conclude as  per above that the actual file name is being referenced, not the part number.

    Is there a way to "alias" the reference to the part number instead of the file name, or something similar, so the rule will work in the copied design?

     

    Thanks

    Mike

    Please use plain text.
    Distinguished Contributor
    Posts: 152
    Registered: ‎07-28-2007

    Re: iLogic and Copy Design

    06-27-2011 04:50 PM in reply to: mies07

    Hi Mike, I had the same problem, my solution is below. It just gets the part from the base view. If you have more views of other parts etc you can change the view item number to the one you want or cycle through the views and match via view name or some other property. Just add the code to your ilogic.

     

    Option Explicit

    Dim oDoc As DrawingDocument
    Dim oSheet As Sheet
    Dim oView As DrawingView
    Dim oRefDoc As Document

    oDoc = ThisDoc.Document
    oSheet = oDoc.ActiveSheet
    oView = oSheet.DrawingViews.Item(1) ' Item 1 is the base view
    oRefDoc = oView.ReferencedDocumentDescriptor.ReferencedDocument ' Gets the views referenced assembly

    ' Checks value of parameter to see value
    If oRefDoc.ComponentDefinition.Parameters.Item("NAME_OF_PARAMETER_HERE").Value = "0" Then
    ' Do Something
     End If

     

    Regards, Matt.

    Please use plain text.
    Employee
    Posts: 932
    Registered: ‎02-24-2009

    Re: iLogic and Copy Design

    06-29-2011 11:29 AM in reply to: matt_jlt

    Matt,

     

     You can simplify your code in Inventor 2011 and later:

    oRefDoc = ThisDrawing.ModelDocument   ' will give you the first referenced document it finds.

    oRefDoc = ActiveSheet.View("VIEW1").ModelDocument  ' gives you the document for a particular view.

     



    Mike Deck
    Software Developer
    DLS - Mechanical Design
    Autodesk, Inc.

    Please use plain text.
    Employee
    Posts: 932
    Registered: ‎02-24-2009

    Re: iLogic and Copy Design

    06-29-2011 11:49 AM in reply to: mies07

    Mike,

     

     Matt's solution is for a drawing.  But it looks like your rule is running in an assembly.

    In order for rules that use component names work after you copy an assembly, you have to change the component names in the assembly Model browser.  This will stabilize the names.  The default is for the component name to be the same as the file name.  But you can edit the name manually:

    RenameComponents.png

     

    You can change the name once, and then immediately change it back to the original.  After you change it, the name won't change when the filename changes.  So in your copy, it will remain as main_dp:1 instead of changing to main_dp_new:1.   Since the component name remains unchanged, the iLogic rule can still find it.

     There's a disadvantage to this method: you might want to be able to see the current file name in the assembly Model browser.  But this is the most straightforward method to fix the problem.

     



    Mike Deck
    Software Developer
    DLS - Mechanical Design
    Autodesk, Inc.

    Please use plain text.
    Distinguished Contributor
    Posts: 132
    Registered: ‎04-14-2005

    Re: iLogic and Copy Design

    06-29-2011 01:32 PM in reply to: MjDeck

    We have a couple of standard designs that we do this for. Some things to note if you're doing this with Copy Design.

     

    1. Create an assembly or drawing that references all the components that need to be copied for the design. We have found that that just referencing the final assembly doesn't always work because of parts that may be suppressed are not included during the check process. So it helps to have a file that can reference all possible parts at once.

     

    2. Rename all components in assemblies to a fixed name if they are going to be referred to from a rule. This avoids having to do anything fancy when the actual files are copied and renamed after a copy design. In our case the file, component names, and part numbers are all different. There's rules that go and set the new part numbers on affected parts but the rules refers to each part using a fixed component name.

     

    3. Make sure users don't delete 'unused' components if they ever want to run rules again. Along with this make sure users are on the (iLogic) level of detail.

     

    Just a few things to keep in mind.

    Rodney Thomas
    Design Engineer / Programmer
    A & A Manufacturing

    Support a Q & A For CAD Users: Stack Exchange Proposal
    Please use plain text.
    Distinguished Contributor
    Posts: 119
    Registered: ‎03-16-2006

    Re: iLogic and Copy Design

    06-29-2011 05:24 PM in reply to: MjDeck

    This is what actually worked. As long as you "touch" the name, it will stabilize - I don't know why this works, but it does survive the copy design process.

    Thanks!

     

    Mike

    Please use plain text.
    Distinguished Contributor
    Posts: 152
    Registered: ‎07-28-2007

    Re: iLogic and Copy Design

    06-29-2011 11:14 PM in reply to: MjDeck

    Sorry about that, For some reason i was thinking about IDW's :-P

    Thanks Mike, I'll have to use that code, I usually use vb.net and forget about the iLogic built in code.

     

    Cheers, Matt.

    Please use plain text.