Edit equation values via a macro window

Hello

I would like to have help with a project.
And it is possible to have a window that pops up when I open my assembly.
Inside she asks me for information (e.g. length, width, ep, height etc...), which directly modifies my equations of the same name. I don't know anything about macro or VBA writing. Tell me if this is possible in the real world.

Thank you.

Hello and welcome;

Technically it's possible in VBA but personally I don't recommend the use of automated macros on a document opening.

(A stand-alone button is preferred.)
On the other hand, your request is very similar to what you could get with configuration management through the Configuration publisher.
https://help.solidworks.com/2021/English/SolidWorks/sldworks/c_configuration_publisher_top.htm

2 Likes

I find that the macro brings a lot of heaviness for a problem that can be managed simply via the custom settings of the part.

Of course there is no pop-up ... but I should be curious enough to know its use. Once a room is defined, you don't try to redefine all the parameters every time you open it. If?

Indeed, in particular, opening the document on a different VSTA version may make it more complicated.

Hello
And thank you for this information.
This project is part of an optimization of my resource in my company. More concretely, has created identical bins but differ in form and at the same time be faster.

Hello @Salomon_Lutete

I have a hard time grasping the context here. a lot of data is missing... and the logic behind the ones you provide escapes me.

If I understand correctly (or rather what I think I'm guessing roughly), a bin is an assembly (containing + wheels + handles + ...), whose dimensions, positions, and others are driven by equations, and you want to create different sizes each time this same assembly is opened, and save it as a separate document for each size? (??)

If there is a recurrence of bin sizes, it is better to create a typical room of your bin, then launch a macro that displays a settings popup and adds a new configuration with the values entered by the user?

A single file with multiple configurations.

PS:

The optimization between an automatic launch and a manual launch is exactly 1 click; It's clearly not worth the risk of problematizing the opening of a document. :wink:
Do you create 1 new different bin every 5 seconds?

3 Likes

Hello;

Given the statement:

… shouldn't we go for DriveWork?

Try DriveworkXpress in the Solidworks add-ins to get an idea already:

3 Likes

But suddenly, you postpone your carpal tunnel operations with one click! That's already not bad :wink:

3 Likes

So let's go all out; If you want independent parts of different sizes, a macro that dissects the formatted name of the document to automatically adjust the editable values, and you would just need to open the file to create it! It would be enough to make a copy of it and rename it with the target values.

Not clear?

Suppose a document named " BAC_L500W300D300 ". When it is opened, the macro retrieves this name to extract the length 500, the width 300, and the depth 300, then assigns these values to the equations/dimensions, reconstructs, saves the document and maybe even closes it.
All this with just a rename and a single double-click to open it.

3 Likes

You can do better:
prompt on Windows (with DOS or the new thing that came out with W10) to enter the dimensions, copy the file by renaming it and start opening the said file in SW.

2 Likes

Sorry to answer you so late.
To answer your questions. The file already exists but you see, to modify a dimension I have to go to the Equations. The problem is that I don't want anyone (in my company) to go and modify the equations (from the file to Pack and Go) for fear of damaging the file.
It's a time saver because it's not me who performs the action and not just a click story.

Great idea, I didn't know this system at all. I like him very much. I will inquire on this side.

Not bad I'm going to look at this with my head resting it looks very interesting

So, if it's " just " a matter of not getting into the equations, I come back to the custom settings that allow you not to bring out the big artillery of macros!

The user fills in the custom parameters (->custom parameter file) and your equations will draw from them the data necessary to make them.
In addition, it's very practical, because you can recall these values on your drawing in notes/tables/etc in an " automatic " way if necessary.

you can also manage them for all your configurations or for specific configurations, with differentiated values... while always calling the same property in your formulas

How do I add the file properties of the SOLIDWORKS part model?

You can even create a form to help fill in if you feel like it

SolidWorks Training - The Properties Form
Ps: sorry, it's done by Avaneo ... but it helps a lot! From memory, I hadn't found in the MyCAD (?)

.
.
.
.
Yes, I think this tool is really great :laughing:

4 Likes

I saw this video on YouTube, which allows you to edit an assembly file via an Excel. But I wanted to know if it is possible to modify an equation with this process.

1 Like

I want to answer you " to test is to know "! :slight_smile:

@Salomon_Lutete ;
With this type of process (replacement of values via a macro and Excel), you might as well let Excel manage the equations itself... it does it much easier than Solidworks... and only push the results into 3D.

4 Likes

Hello;
Here is a small anthology of the processes of component configurations
( Parts family, configurations, DriveWorks ...)

3 Likes