Being in BTS Crsa, I have to make a configurable CAD of a conveyor (internship project).
I usually use Solid Edge but the company I'm in uses Solidworks, so I'm a bit lost.
The goal of this project is to be able to set the dimensions of a conveyor (length, width etc.) so I made a macro in excel by declaring solidworks etc. only there is not much that works. Not being used to doing this kind of work (I'm zero in vba!) I provide you with my macro with some indications so that you can clarify for me:
Sub Bouton_Clic()
Set swApp = CreateObject("Sldworks.Application")
Set Part = swApp.ActiveDoc
Part.Parameter("D1@Esquisse1@Longueur_convoyeur"). SystemValue = Range ("C2"). Value / 1000
Part.ClearSelection
Part.ForceRebuild
Part.Parameter("D1@Extru.-Mince1@Largeur_convoyeur"). SystemValue = Range ("C4"). Value / 1000
Part.ClearSelection
Part.ForceRebuild
End Sub
The error message is a runtime error '91' but I don't see what's wrong.
These are the "Part.Parameter... " which are highlighted.
"Longueur_convoyeur" and "Largeur_convoyeur" coincide with the name I gave in Excel.
So in SolidWorks there is the notion of configuration (part family) to manage the different versions of a project (part or assembly). Configurations are created once your geometry is complete, and variables that need to change can be driven by an Excel spreadsheet printed in your SolidWorks document. These can be the dimensions, the properties, the status of deletion or not of the functions etc ... Take the time to consult the online help.
I think that going through a macro in Excel is a bit complicated! At least that's my opinion.
Thank you for your answer jmsavoyat, one last little question:
So I just made an auto creation which adds a table in solidworks as you told me but I wanted to know if it wouldn't be a problem since I work directly on an assembly (in terms of constraints etc.)
Whether you work with SolidEdge or SolidWorks, the principle is the same, the assemblies point to parts. So if you only send the assembly in the zip, we can't open it properly and therefore we can't help you.
So use the @Benoit.LF method, open your assembly and then use the take-away composition function in the File menu. You can then make a zip containing all the necessary files.
On the other hand, I agree with those who don't see the point of making a macro for what you want to do.
A room family combined with a "configuration publisher" should do the trick.
When you have your assembly in its right configuration (not in the SW sense, in the length sense, options...) what are you supposed to do with it? Extract (not in the EPDM sense...) all the plan part files to rename them or add configurations to the existing files?
This is important for the direction you take in your design: