drive a dimension using a Custom Property?
drive a dimension using a Custom Property?
(OP)
Here's an example of what I want to do: I create a custom property from File/Properties>Custom tab. I give it a numerical value of 3. In my SolidWorks model, I want a dimension to be driven by that value, so that whenever I change the Custom Property value and then regenerate, the model changes... but I can't figure out how do to this! Any tips?






RE: drive a dimension using a Custom Property?
1) Create the sketch
2) Double-Click on the Dimension that you want to be the referenced/controlling dimension.
3) In the little pull-down menu next to the value, select 'Link value'.
4) This brings up a window where you can name the variable, and it will assign it the value from the sketch.
Now note at the top of the feature manage there is now an 'Equations' Folder and it contains the dimension value from the sketch and its description.
You can now link other dimensions to that same variable by double clicking on them and 'linking' them to that value.
When you change any of the dimensions that reference this variable and it will update all of the dimensions.
Beware: as intended, changing one will change them all
Hope this helps,
Lou
RE: drive a dimension using a Custom Property?
I will create a macro in Visual Basic that will automate some dimensions in a part or assembly. The macro will pull values from a database using SQL calls, and the dimensions in the database are organized as follows:
Dim_name Value
hss1_length 24
hss1_width 4
hss1_height 4
hss1_thk 0.25
hss2_length 32
hss2_ ........... and so on
In the SolidWorks model I need to somehow link dimensions to a variable name and then use a macro to drive that variable. I'm wondering if perhaps I could simply use the SolidWorks "equation" editor to do this, but I don't know how to make a VB macro to drive a variable name in an equation... does anyone know? I tried to record a macro of me changing an equation value and it would not record it.
I was hoping that I could use Custom Properties as variables in this manner because there's lots of VB commands that can be used to modify or check the existence of custom properties, but it seems I probably won't be able to use custom properties...
RE: drive a dimension using a Custom Property?
There is a way to use equations to link dimensions to custom properties, but it is rather complicated and leads down a path that I'd rather not discuss in a public forum. It's probably best just to figure out how to work with equations in the API.
RE: drive a dimension using a Custom Property?
Eric
RE: drive a dimension using a Custom Property?
http://www.driveworks.co.uk/
ejc
RE: drive a dimension using a Custom Property?
You can create a design table and use the $prp@ command (e.g. $prp@lenght this will create a custom property called length) in one cell, in another cell you can drive the dimension (e.g. lenght@sketch1).
Finally you can make the 2 cells equal in Excel, thereby linking them.
Of course you can use the API to automate this even further.
And yes, you can also try DriveWorksXpress (which is free) or the full version of DriveWorks.