How to assign SW part dimension to variables in VBA?
How to assign SW part dimension to variables in VBA?
(OP)
Can anyone tell me the syntax for getting dimension values from a SW part and assigning these values to variables in VBA?
When I run a certain macro on a certain part I want the macro to find specific dimensions in the part and assign the dimension values to variables within the macro. I've been able to get my macro to change dimension values in the part but I don't know the proper syntax for grabbing an existing value of a dimenion. I've seached the FAQ and saw information there that leads me to believe that this is possible but, no details were given as to how.
I am very much a newbie to VBA and Visual Basic. Thank you for your help. Hopefully someday I'll be able to give back to this forum!!
When I run a certain macro on a certain part I want the macro to find specific dimensions in the part and assign the dimension values to variables within the macro. I've been able to get my macro to change dimension values in the part but I don't know the proper syntax for grabbing an existing value of a dimenion. I've seached the FAQ and saw information there that leads me to believe that this is possible but, no details were given as to how.
I am very much a newbie to VBA and Visual Basic. Thank you for your help. Hopefully someday I'll be able to give back to this forum!!






RE: How to assign SW part dimension to variables in VBA?
Dim rVal As Double
rVal = Part.Parameter("dim@sketch").SystemValue
rVal = 2 * rVal
Part.Parameter("dim@sketch").SystemValue = rVal
Hope that helps...
DimensionalSolutions@Core.com
While I welcome e-mail messages, please post all thread activity in these forums for the benefit of all members.
RE: How to assign SW part dimension to variables in VBA?
You need to select the dimension (usually by name) and then you query the dimension value and set the variable to the value....
First what I would do is create an object like this in the declarations:
Dim DimVal As Object
Then in the sub main I would write a line like this:
Set DimVal = Part.Parameter("D1@Sketch1")
Next I would find out what the value was of that paramter was as set it to a variable. , like this :
a = DimVal.SystemValue
so essentially we create an object
define the object as the part paramter name
then read the system value of the parameter and set that value to "A"
hope that helps a little
Regards,
Jon
jgbena@yahoo.com