Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations KootK on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Image of assembly component in userform macro vba

koubaleite

Mechanical
Nov 27, 2024
6
Hello,

I have a userform with a PictureBox and a TreeView. The TreeView displays the components of a SolidWorks assembly. My goal is to have the selected component in the TreeView either highlighted in SolidWorks or displayed as an image in the PictureBox.

Is this possible? If so, which functions or methods should I use? Essentially, I want to replicate the behavior of selecting a component in the Assembly Manager tree in SolidWorks—highlighting the component and showing its location. I’d like to achieve the same functionality in my userform.

Any guidance or suggestions would be greatly appreciated.

Thank you!
1732723576565.png
1732723873314.png



Edit : I am making an add-in on Visual Studio (vb net)
 
Last edited:
Replies continue below

Recommended for you

What is in your mind? Are you trying to make your own 3D modeler using Solidworks Kernel?

Best regards,

Alex
 
What is in your mind? Are you trying to make your own 3D modeler using Solidworks Kernel?

Best regards,

Alex
So I am making a BOM add-in where I modify directly component properties thanks to the treeview and display the properties in a listbox. So when modifying the properties, I will need to know which component it is.
 
What is PictureBox?
The PictureBox control is used for displaying images on the form. The Image property of the control allows you to set an image both at design time or at runtime.

more information : I am making an add-in, so currently working on Visual Studio (vb net)
 
You can use the edrawings control (it may be slow) OR can capture image of the selected components, save in the temp location and show in the image box.
 
You can use the edrawings control (it may be slow) OR can capture image of the selected components, save in the temp location and show in the image box.
I have a question for the edrawings control, I have seen a tutorial but that was for part files only. Is it possible to display cutlist items as well ? Edrawings control corresponds exactly to what I am looking for. But if I fail to get the cut list items (bodies) then I will just go for the second option (capture image save in the temp location and show it)
 
I have a question for the edrawings control, I have seen a tutorial but that was for part files only. Is it possible to display cutlist items as well ? Edrawings control corresponds exactly to what I am looking for. But if I fail to get the cut list items (bodies) then I will just go for the second option (capture image save in the temp location and show it)
I have never tried using eDrawings controls with the cut list bodies, so there is no harm in trying otherwise you can always switch to plan B.
 
I think you are reinventing the wheel. If you want to change properties for a component, why don't you revise them accordingly in SW environment?

Best regards,

Alex
 
I have never tried using eDrawings controls with the cut list bodies, so there is no harm in trying otherwise you can always switch to plan B.
Thanks. It seems like it is not possible with the cut list bodies only parts and subassemblies (from my knowledge) so I am switching to plan B
 
I think you are reinventing the wheel. If you want to change properties for a component, why don't you revise them accordingly in SW environment?

Best regards,

Alex
I have many components in my assembly, and would like to avoid opening each one of them and modifying the properties one by one. It is very time consuming
 

Part and Inventory Search

Sponsor