VB.net sort and List all parameters to checked listbox

VB.net sort and List all parameters to checked listbox

j.romo
Advocate Advocate
423 Views
4 Replies
Message 1 of 5

VB.net sort and List all parameters to checked listbox

j.romo
Advocate
Advocate

Hello again,

Is there a way to get all the angular  parameters into a Checked listbox to select them?

I have no Idea how to sort them and to populate the listbox.

Any help would be apreciated

something like this

jromo_0-1665620461433.png

 

0 Likes
Accepted solutions (1)
424 Views
4 Replies
Replies (4)
Message 2 of 5

S.Hørup
Contributor
Contributor

How do you intent the form should work - what are the workflow for the user?

 

I can't figure out why you need the check boxes in the form you have shown.

 

How I would approach it:

- Loop through all parameters

-- If parameter = angle parameter then add parameter.name to list

 

Sorting can usually be done in the properties for the list

0 Likes
Message 3 of 5

j.romo
Advocate
Advocate

Thanks for the aproach, I will try to make the Loop  (but I am not as skilled yet) and I have to investigate how to fill the Check boxes.

I would like to select in the box the parameters to change, i am making a simple unfolding Flower for rollforming

jromo_0-1665671493708.png

In the chkBox I would like to have the angle dimensions so I can select some of them and apply angle changes in diferent sequences. 

right now I cant even populate a simple textbox when a domension is selected 😞

 

0 Likes
Message 4 of 5

S.Hørup
Contributor
Contributor
Accepted solution

Is it not an option to select just one angle from the list (no multi-select) and and update tha value - Then select the next angle and update that one?

 

or are you going to change the selected angles with the same amount, but in turns?

 

Sorry, I do not exactly understand what you are aming for.

 

But here are some code to get you started:

It loops through all parameters in the part, and adds all angle parameters to the checklistbox

 Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load

        Dim invApp = g_inventorApplication


        Dim oDoc As PartDocument = invApp.ActiveDocument

        Dim oCompDef As ComponentDefinition = oDoc.ComponentDefinition

        Dim oParams As Parameters = oCompDef.Parameters
        'Dim oUserParams As UserParameters = oCompDef.Parameters.UserParameters

        Dim uom As UnitsOfMeasure = oDoc.UnitsOfMeasure

        For Each oParam As Parameter In oParams
            If uom.CompatibleUnits(oParam.Expression, oParam.Units, "1", "deg") Then
                'The parameter is an angle parameter
                CheckedListBox1.Items.Add(oParam.Name)
            End If
        Next

    End Sub
Message 5 of 5

j.romo
Advocate
Advocate

The idea is to select 1 or more angles and change them at the same time.

The code worked like a charm, even I could modify it to update as you add more angles or change the angle name parameter.

the goal is to meke somethin like the pic below 

create a new WP and Sketch and project the resulting geometry with its changes

to get a unfolding sequence of the main profile.

jromo_0-1665716491303.png

 

0 Likes