×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Select Dimension One by one dynamically

Select Dimension One by one dynamically

Select Dimension One by one dynamically

(OP)
Hi
 can anyone help me how to select the dimension one by one dynamically through vba code. The code should work on click of a button I need to select the dimension one by one. I have did the code for single dimension selection and the selected dimension will add to list box. But how to select multiple dimension on single button click.
Regards
Saranya

RE: Select Dimension One by one dynamically

(OP)
The below code Im using for adding selected dimension to list. But before getting the selected dimension I want the select dimension manually one by one on click of a button

 Set swApp = CreateObject("SldWorks.Application")
    Set swModel = swApp.ActiveDoc
    Set swDraw = swModel
    Set swSelMgr = swDraw.SelectionManager
    Set swDispDim = swSelMgr.GetSelectedObject6(1, 0)
    Set swDim = swDispDim.GetDimension
    If swSelMgr.GetSelectedObjectType3(1, -1) = swSelDIMENSIONS Then
        listadditem.AddItem (swDim.Value & " - " & swDim.Name)
    Else
        MsgBox "Select Only Dimension"
    End If
 

RE: Select Dimension One by one dynamically

I can't understand what you are trying to do.  Can you please write out the steps more clearly for how you want your program to work? Like:

1. User runs macro
2. Form appears
3. User selects a dimension (or multiple dimensions?)
4. User pushes a button and dimension information is added to the list
etc.

 

-handleman, CSWP (The new, easy test)

RE: Select Dimension One by one dynamically

(OP)
The following are the steps
1.User Run macro
2.Form opens
3."Select Dimension" button will be clicked
4. So my program should allow to select dimension
5. Once the dimension is selected then it should add to list
 
I dont know how to give provision for multiple dimension selection after click of a button

RE: Select Dimension One by one dynamically

So... with your current macro, are you stuck with the form open?  Like

1. User runs macro
2. Form appears
3. User cannot interact with the SolidWorks model while the form is on the screen?

-handleman, CSWP (The new, easy test)

RE: Select Dimension One by one dynamically

(OP)
I have created the form in vb6 and I will install as a dll. so the vb6 form will allow the interaction with solidworks.

RE: Select Dimension One by one dynamically

OK, maybe I get it...

You want:
1. Run macro
2. Form opens
3. User hits "Select dimension" button
4. Macro watches for user to select a dimension
5. When the user selects a dimension it is added to the list

Is that right?

It is much easier and more reliable to program:

1. Run macro
2. Form opens
3. User selects a dimension (or multiple dimensions).
4. User hits "Add selected dimension(s)" button
5. Dimension(s) added to list.

 

-handleman, CSWP (The new, easy test)

RE: Select Dimension One by one dynamically

(OP)
Thank you for your suggestion. But I need the button to be clicked before selecting the dimensions(Selection of dimensions and adding to loop should happen on loop)

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources