@Anonymous wrote:
Bshbsh.
Yes, it's exactly as you said.
Jef_E
If I could not explain the question, I think it would be nicer if you answered the topic commenting on your questions. The way you reported is not from someone who has intension to help, because I believe that the purpose of this forum is to do just that.
What I would really like to do is an API for Inventor, which has the function of making multiple inserts, as the example below.
https://apps.autodesk.com/INVNTOR/en/Detail/Index?id=7927536498261408960&appLang=en&os=Win32_64
Sorry if you feel offended, but that I am here everyday to answer questions and find solutions to my own problems. The problem is that there are 90% people that are asking for a handed solution and 10% that are looking to learn and show some effort. I'm getting really tired of this. Those 90% are most of the time not even thankful for the help.
As I see someone Kudo'd my post above so i'm not the only one.
But that aside, now my contribution to this post.
- You don't want to do an API, you want to use the API to create a tool, so I suggest you read it.
- If you read the API you would have found this example..
AssemblyConstraints.AddInsertConstraint Method
AssemblyConstraints.AddInsertConstraint Method
Parent Object: AssemblyConstraints
Description
Method that creates a new insert assembly constraint.
Syntax
AssemblyConstraints.AddInsertConstraint( EntityOne As Object, EntityTwo As Object, AxesOpposed As Boolean, Distance As Variant, [BiasPointOne] As Variant, [BiasPointTwo] As Variant ) As InsertConstraint
Parameters
EntityOne |
Object that defines the first object. This object is a circular edge. |
EntityTwo |
Object that defines the second object. This object is a circular edge. |
AxesOpposed |
Input Boolean that specifies whether the direction of the axes of the input entities are in the same direction or opposed. A value of True indicates they are opposed. |
Distance |
Input Variant that defines the offset between the two input entities. This can be either a numeric value or a string. A parameter for this value is created and the supplied string or value is assigned to the parameter. If a value is input, the units are centimeters. If a string is input the units can be specified as part of the string or will default to the current length units of the document. |
BiasPointOne |
Optional input object that is used help in determining the initial position of the occurrence. The occurrences are repositioned in an attempt to make the two bias points coincident. This provides some general control over the position of the occurrence when it isn't being controlled by another constraint. An example of when the bias points are useful is the case when the first constraint on a part is a mate constraint. In the case where the mate is between two planes, the parts can be positioned anywhere along the infinite plane that defines their mating contact. Using the bias points you can define the position of the two occurrences, relative to each other. If a bias point is not given, one is calculated that is at the center of the parameter range of the input entity. |
BiasPointTwo |
Optional input object that is used help in determining the initial position of the occurrence. The occurrences are repositioned in an attempt to make the two bias points coincident. This provides some general control over the position of the occurrence when it isn't being controlled by another constraint. An example of when the bias points are useful is the case when the first constraint on a part is a mate constraint. In the case where the mate is between two planes, the parts can be positioned anywhere along the infinite plane that defines their mating contact. Using the bias points you can define the position of the two occurrences, relative to each other. If a bias point is not given, one is calculated that is at the center of the parameter range of the input entity. |
Samples
Add assembly insert constraint API Sample
Add assembly insert constraint API Sample
Description
This sample demonstrates the creation of an assembly insert constraint.
Code Samples
VBA Sample Code
Before running the sample, you need to open an assembly that contains at least two parts. Select circular edges on the two parts that will be used for the constraint and run the sample code. (Set the priority of the Select command and use the Shift-Select to select multiple edges.)
Public Sub InsertConstraint()
' Set a reference to the assembly component definintion.
Dim oAsmCompDef As AssemblyComponentDefinition
Set oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition
' Set a reference to the select set.
Dim oSelectSet As SelectSet
Set oSelectSet = ThisApplication.ActiveDocument.SelectSet
' Validate the correct data is in the select set.
If oSelectSet.Count 2 Then
MsgBox "You must select the two circular edges for the insert."
Exit Sub
End If
If Not TypeOf oSelectSet.Item(1) Is Edge Or Not TypeOf oSelectSet.Item(2) Is Edge Then
MsgBox "You must select the two circular edges for the insert."
Exit Sub
End If
' Get the two edges from the select set.
Dim oEdge1 As Edge
Dim oEdge2 As Edge
Set oEdge1 = oSelectSet.Item(1)
Set oEdge2 = oSelectSet.Item(2)
' Create the insert constraint between the parts.
Dim oInsert As InsertConstraint
Set oInsert = oAsmCompDef.Constraints.AddInsertConstraint(oEdge1, oEdge2, True, 0)
End Sub
|
Please kudo if this post was helpfull
Please accept as solution if your problem was solved
Inventor 2014 SP2