I want to use information from the "Modify Configurations" table for my macro. For example the value 100 mm from the cell (Standard/D1) is needed.

 

 

Unfortunately I found only examples how to read configuration specific values from the "Summary Information" window which are not the ones I need.

 

Thank you in advance for any hints or examples.


Categories: API∕Macros

Comments
Last comment By: Deepak Gupta   Wed, 22 Nov 2017 10:50:17 GMT
Re: Read out Information from the Modify Configurations table

I'm not sure if there are any API to read from that table but you can get the value of the dimension from the feature or sketch using API codes GetSystemValue3

By: Deepak Gupta  Mon, 20 Nov 2017 13:05:51 GMT
Re: Read out Information from the Modify Configurations table

As Deepak said, there is no API to access that table.  You have to access the underlying dimensions. 

 

Please study the macro at

model parameters

for an example of how to get API access to dimensions, how to change config by config, and how to save a list of dimensions you want quick access to.  Go to the last page and get the Excel version, assuming you're running 32 bit Excel...  If you don't have anything that is running 32 bit VBA you're SOL, sorry.

By: Josh Brady  Mon, 20 Nov 2017 13:20:44 GMT
Re: Read out Information from the Modify Configurations table

Thank you very much for the quick response!

 

I wanted to use the information from the "modify configuration table" to get the distance between two objects. But probably it is easier to have a sketch with driven measures to get this information (like in the screenshot).

 

Unfortunately I could not find a code example to read the measures from a sketch and to store it to a variable. How can I adress the measure, read it and store it to a variable?

By: Fabian Mayer  Mon, 20 Nov 2017 14:27:01 GMT
Re: Read out Information from the Modify Configurations table

Fabian Mayer wrote:

 

Unfortunately I could not find a code example to read the measures from a sketch and to store it to a variable. How can I address the measure, read it and store it to a variable?

Instead of doing a measure, add a driven dimension to that sketch and then you can either link that to new equation variable OR use the macro to read the value.

By: Deepak Gupta  Mon, 20 Nov 2017 16:31:27 GMT
Re: Read out Information from the Modify Configurations table

I tried to use the GetSystemValue3 function to get the distance which is set by the distance mate. Therefore I used the example from the API Help "Get Dimension of Distance Mate Example (VBA)". It outputs the distance of the distance mate which is selected in SolidWorks.

 

In the macro the distance mate is adressed by:

Set swSelMgr = swModel.SelectionManager

Set swFeat = swSelMgr.GetSelectedObject6(1, -1)

 

How could I specify the distance mate without selecting it in SolidWorks previously? Instead I would like to specify the distance mate by using its name in the macro.

 

I would really appreciate hints how to code that as I just started with SolidWorks macro programming.

Thank you very much.
 

By: Fabian Mayer  Tue, 21 Nov 2017 16:37:37 GMT
Re: Read out Information from the Modify Configurations table

Thank you very much! Using the example you named, I found a solution.

By: Fabian Mayer  Thu, 23 Nov 2017 09:08:25 GMT
Re: Read out Information from the Modify Configurations table

You can use SelectByID2 to select the mate by giving it's name and type. Check this example macro for required codes: Change Dimensions of Gear Mate Example (VBA)

By: Deepak Gupta  Wed, 22 Nov 2017 10:50:17 GMT
You are not authorized to view this page No results found! Suggestions: Check spelling, try a different search, or browse topics below.