Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Linking part to assembly motion

2 REPLIES 2
Reply
Message 1 of 3
Anonymous
296 Views, 2 Replies

Linking part to assembly motion

Anonymous
Not applicable
Hey, I want to use a driven assembly constraint to drive some dimensions inside a part sketch. I've tried exporting the paramters in the assembly and linking them into the parameter table for the part in a effort to get it to change as the assembly constraint is driven but it won't do it as it causes a cyclic dependancy. I know you can link it the other way but then i have to go into the part modify the sketch and then click update for the assembly to move. I'm trying to model forming a knot between two wires, and am using Inventor 2009 suite. I'm not sure but is it possible to use VB to achieve something like this? Is there any tutorial out there on using VB for if-then statements in Assemblies etc?

Thanks Karl
0 Likes

Linking part to assembly motion

Hey, I want to use a driven assembly constraint to drive some dimensions inside a part sketch. I've tried exporting the paramters in the assembly and linking them into the parameter table for the part in a effort to get it to change as the assembly constraint is driven but it won't do it as it causes a cyclic dependancy. I know you can link it the other way but then i have to go into the part modify the sketch and then click update for the assembly to move. I'm trying to model forming a knot between two wires, and am using Inventor 2009 suite. I'm not sure but is it possible to use VB to achieve something like this? Is there any tutorial out there on using VB for if-then statements in Assemblies etc?

Thanks Karl
2 REPLIES 2
Message 2 of 3
Anonymous
in reply to: Anonymous

Anonymous
Not applicable

I think I understand what you're trying to do but
might be wrong.  Here's a few lines of code that demonstrate some
functionality of the API.  I have an assembly open that contains some parts
and has a parameter named "PartOffset" that controls the offset of one of the
mate constraints.  One of the parts attached is named "Edit1:1" in the
browser.  Inside that part is a parameter named "Length".  Running
this program it changes the values of both of these parameters and updates the
entire assembly.  Of course this can easily be edited and expanded to edit
multiple parameters and these could be in various parts and
assemblies.

 

Public Sub DrivePartTest()
    '
Get a reference to the assembly document and its
Definition.
    Dim oAsmDoc As
AssemblyDocument
    Set oAsmDoc =
ThisApplication.ActiveDocument
    Dim oAsmDef As
AssemblyComponentDefinition
    Set oAsmDef =
oAsmDoc.ComponentDefinition
   
    ' Get
the parameter in the assembly to edit.
    Dim
oAsmConstraintParam As Parameter
    Set oAsmConstraintParam =
oAsmDef.Parameters.Item("PartOffset")
   

    ' Get the occurrence of the part to
edit.
    Dim oPartOcc As
ComponentOccurrence
    Set oPartOcc =
oAsmDef.Occurrences.ItemByName("Edit1:1")
   

    ' Get the part document from the
occurrence.
    Dim oEditPartDoc As
PartDocument
    Set oEditPartDoc =
oPartOcc.Definition.Document
   
    ' Get
the parameter in the part to edit.
    Dim oPartParam As
Parameter
    Set oPartParam =
oEditPartDoc.ComponentDefinition.Parameters.Item("Length")
   

    Dim i As Integer
    For i = 1 To
10
        oAsmConstraintParam.Value =
oAsmConstraintParam.Value + 0.5
       
oPartParam.Value = oPartParam.Value +
1
       
oAsmDoc.Update
       
ThisApplication.ActiveView.Update
    Next
End Sub
--

Brian Ekins
Autodesk Inventor API

href="http://blogs.autodesk.com/modthemachine">http://blogs.autodesk.com/modthemachine
0 Likes


I think I understand what you're trying to do but
might be wrong.  Here's a few lines of code that demonstrate some
functionality of the API.  I have an assembly open that contains some parts
and has a parameter named "PartOffset" that controls the offset of one of the
mate constraints.  One of the parts attached is named "Edit1:1" in the
browser.  Inside that part is a parameter named "Length".  Running
this program it changes the values of both of these parameters and updates the
entire assembly.  Of course this can easily be edited and expanded to edit
multiple parameters and these could be in various parts and
assemblies.

 

Public Sub DrivePartTest()
    '
Get a reference to the assembly document and its
Definition.
    Dim oAsmDoc As
AssemblyDocument
    Set oAsmDoc =
ThisApplication.ActiveDocument
    Dim oAsmDef As
AssemblyComponentDefinition
    Set oAsmDef =
oAsmDoc.ComponentDefinition
   
    ' Get
the parameter in the assembly to edit.
    Dim
oAsmConstraintParam As Parameter
    Set oAsmConstraintParam =
oAsmDef.Parameters.Item("PartOffset")
   

    ' Get the occurrence of the part to
edit.
    Dim oPartOcc As
ComponentOccurrence
    Set oPartOcc =
oAsmDef.Occurrences.ItemByName("Edit1:1")
   

    ' Get the part document from the
occurrence.
    Dim oEditPartDoc As
PartDocument
    Set oEditPartDoc =
oPartOcc.Definition.Document
   
    ' Get
the parameter in the part to edit.
    Dim oPartParam As
Parameter
    Set oPartParam =
oEditPartDoc.ComponentDefinition.Parameters.Item("Length")
   

    Dim i As Integer
    For i = 1 To
10
        oAsmConstraintParam.Value =
oAsmConstraintParam.Value + 0.5
       
oPartParam.Value = oPartParam.Value +
1
       
oAsmDoc.Update
       
ThisApplication.ActiveView.Update
    Next
End Sub
--

Brian Ekins
Autodesk Inventor API

href="http://blogs.autodesk.com/modthemachine">http://blogs.autodesk.com/modthemachine
Message 3 of 3
Anonymous
in reply to: Anonymous

Anonymous
Not applicable
Hey Brian,

Yea that is definatly along the lines of what i need it to do. Is it possible to get some contact details of ya? I can email you a few videos etc that will explain a little more what I am trying to model. I need to be able to put in an array of points or if functions or something similar to get the exact movement i need. Thanks heaps for posting that bit of code it helped to explain to me a bit how it works.

Thanks,
Karl Beardsley
(k.beardsley@southfence.co.nz)
0 Likes

Hey Brian,

Yea that is definatly along the lines of what i need it to do. Is it possible to get some contact details of ya? I can email you a few videos etc that will explain a little more what I am trying to model. I need to be able to put in an array of points or if functions or something similar to get the exact movement i need. Thanks heaps for posting that bit of code it helped to explain to me a bit how it works.

Thanks,
Karl Beardsley
(k.beardsley@southfence.co.nz)

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

Post to forums  

Autodesk Design & Make Report