Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

drive a dimension using a Custom Property?

Status
Not open for further replies.

coteesh

Mechanical
Apr 12, 2002
17
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?
 
Replies continue below

Recommended for you

The following method isn;t exactly what you are looking for, but may work for you. It doesn't get the value from the property boxes, but from its instances in the part sketches.

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
 
Thanks GLED, but I'm not sure this can help me... the ultimate functionality that I am trying to create is as follows:

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...
 
Equations are nearly as easy to manipulate with API.

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.
 
I expect that you can get a hold of a dimension by name using the API, and then modify its value. If you can, you could skip the equations altogether and just name your dimensions to match the database fields and go from there.

Eric
 
It sounds like you shoudl check out driveworks. There is a free download of thier express version. It does alot of what you are trying to do.


ejc
 
Here is another idea...

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.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor