×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

drive a dimension using a Custom Property?

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?

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

RE: drive a dimension using a Custom Property?

(OP)
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...

RE: drive a dimension using a Custom Property?

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.

RE: drive a dimension using a Custom Property?

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

RE: drive a dimension using a Custom Property?

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.

http://www.driveworks.co.uk/

ejc

RE: drive a dimension using a Custom Property?

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.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources