How do get Tracker Bar using ILogic Rules

How do get Tracker Bar using ILogic Rules

Anonymous
Not applicable
1,010 Views
11 Replies
Message 1 of 12

How do get Tracker Bar using ILogic Rules

Anonymous
Not applicable

Hi,

I'm working on a Task to change the Angle value by ILogic Rules.

The attached Inventor assembly having similar type of ILogic, But I couldn't not understand which Functional code controlling this Action.

 

Please check the attached Inventor Assembly and PPT and help me to get the Functional code to perform this action.

 

Thanks & regards,

Manoj Sampath

0 Likes
1,011 Views
11 Replies
Replies (11)
Message 2 of 12

MjDeck
Autodesk
Autodesk

The code you're looking for is in the Input rule in the assembly file Ilogic-Pipe-iPart&imate.iam

Look at the following code in the function Fr_inp:

Else If Action = "09-Change_Angle"
		Dim oOcc1 As ComponentOccurrence
		oOcc1 = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kAssemblyOccurrenceFilter ,"Select Component to modify Angle Constraint:")
		AngleConstraint_Trackbar(oOcc1)

That calls the subroutine AngleConstraint_Trackbar, which uses the DLL named iLogicTrackBar.dll to show the trackbar. iLogicTrackBar is a custom DLL which is included with the rest of the data in the ZIP file.

 


Mike Deck
Software Developer
Autodesk, Inc.

Message 3 of 12

Anonymous
Not applicable

Hi @MjDeck ,

Thanks for the Reply. I have tried get Tracker Bar in my assembly, But I couldn't get that.

Can you please give suggestion for below condition.

Action I need:

I want to change the Angle value of Angle Constraint by Picking required component in Assembly. 

While I Pick the component I want to get the TrackBar.

Thanks & Regards,

Manoj Sampath 

0 Likes
Message 4 of 12

MjDeck
Autodesk
Autodesk

I'm pretty sure you can do what you want by copying and modifying code from Ilogic-Pipe-iPart&imate.iam. That rule does something very similar.
If you want more details, please post your assembly model.


Mike Deck
Software Developer
Autodesk, Inc.

Message 5 of 12

Anonymous
Not applicable

@MjDeck 

Hi Mike,

Thanks for the Reply.

I have checked the Functional Code used in Ilogic-Pipe-iPart&imate.iam for Angle Value change.

As per my understanding This assembly controlling the Angle using Parameter value, In my case I want to control the Value of Angle Constraint.

I'm trying to upload My assembly for reference, But it is failing due to File size.

Let me remove some components upload that.

Thanks & Regards,

Manoj Sampath

0 Likes
Message 6 of 12

MjDeck
Autodesk
Autodesk

Can you provide more detail about this statement:
This assembly controlling the Angle using Parameter value, In my case I want to control the Value of Angle Constraint.


The AngleConstraint object has an Angle property. That property is of the Parameter type. By changing the value of that parameter, you change the angle of the constraint.


Mike Deck
Software Developer
Autodesk, Inc.

0 Likes
Message 7 of 12

Anonymous
Not applicable

@MjDeck 

Hi Mike,

Herewith I have attached the Sample Assembly, .DLL File and ILogic Code which I have tried.

In Sample Assembly First component got grounded , another two valves got assembled with IMate and Angle Constraint.

I want to change the Angle value using TrackBar but the Code What I have used is not working.

Can you please give your suggestion on this.

Thanks & Regards,

Manoj Sampath 

0 Likes
Message 8 of 12

Anonymous
Not applicable
0 Likes
Message 9 of 12

Anonymous
Not applicable

Hi Mike,
The Assembly file getting failed to upload. So I have attached the PPT and .DLL file here.
Thanks & Regards,
Manoj Sampath

0 Likes
Message 10 of 12

MjDeck
Autodesk
Autodesk

@Anonymous , please try the attached rule. The component might have more than one constraint. And in fact they do in the case you describe. So this code will iterate over them and find the first angle constraint, and then provide that parameter name to the trackbar.


Mike Deck
Software Developer
Autodesk, Inc.

0 Likes
Message 11 of 12

Anonymous
Not applicable

@MjDeck 

Hi Mike,

The code you have given working fine. To select multiple components I have done some changes and tried but It showing error.

Is this code won't work for multiple components?

 

Sub Main
Dim oAsm As AssemblyDocument = ThisApplication.ActiveDocument
Dim oAsmCompDef As AssemblyComponentDefinition = oAsm.ComponentDefinition
Dim comp As ComponentOccurrences
Dim comps As New List(Of ComponentOccurrences)
comp = ThisApplication.CommandManager.Pick(
SelectionFilterEnum.kAssemblyOccurrenceFilter,
"Select a components")
' If nothing gets selected then we're done
If comp Is Nothing Then Exit Sub
' If there are selected components we can do something
comps.Add(comp)
'On Error Resume Next
Dim oAngleConstr As AngleConstraint = Nothing
'Dim PI As Double: PI = Math.Atan(1) * 4
For Each constraintX As AssemblyConstraint In comp.Constraints
If constraintX.Type = ObjectTypeEnum.kAngleConstraintObject Then
oAngleConstr = constraintX
End If
Next
If oAngleConstr Is Nothing Then Exit Sub
Parameter.UpdateAfterChange = True
Using dlg As New iLogicTrackBar.TrackBarDialog
dlg.Parameter = Parameter
dlg.ParameterName = oAngleConstr.Angle.Name
dlg.MinValue = 0
dlg.MaxValue = 360
dlg.RoundInc = 5
Dim i As Integer = dlg.ShowDialog()
iLogicVb.UpdateWhenDone = True
End Using
End Sub

 

Thanks & regards,

Manoj Samath

0 Likes
Message 12 of 12

MjDeck
Autodesk
Autodesk

Hi Manoj,

  Do you want to control the angle constraints on all the selected components from a single trackbar control? That would mean setting the same angle on all components.
 Or do you want a loop that shows a separate trackbar for each selected component in sequence?

 


Mike Deck
Software Developer
Autodesk, Inc.