Peter;
Thanks very much, I added the coma and it is working perfectly!!!!. Despite,
you do not have knowledge in SW. You were able to help to accomplish this
macro.I really appreciate your helping me with this matter.
For you information, I will describe what I have so you can have an idea
what I am doing.
Basically, it is a circle part that is revolved in SW. The circle part has
two dimensions to control it which are:
1.- The "Angle†to revolve the circle, and
2.- The "Distance†from the center of the circle to the center of the angle .
I setup the "angle" and "distance" to be typed in the excel spreadsheet. The
reason I did this is because I want the people in my team that do not have
knowledge in SW to update the revolve part with the new dimensions without
using SW tools. The only problem is that they have to open excel and SW files
to run it. I have not figured it out how to include in my excel macro to open
the SW part automatically. If you have any idea how to do it I will really
appreciate it.
Well, the data I have in the excel cells are:
1.- In the cell "A1" I have the "Angle" description in the cell "B1" I have
the "Angle" value.
2.- In the cell "A2" I have the "Distance" description in the cell "B2" I
have the "Distance" value.
The excel macro that reads this data and update the revolve part's dimension
in SW is:
' &&& START MACRO &&&&
Sub Circle_Dimensions()
Dim swApp As Object
Dim Part As Object
Dim boolstatus As Boolean
Dim longstatus As Long, longwarnings As Long
Dim FeatureData As Object
Dim Feature As Object
Dim Component As Object
Set swApp = GetObject(, "SldWorks.Application")
Set Part = swApp.ActiveDoc
boolstatus = Part.Extension.SelectByID("D1@
[email protected]",
"DIMENSION", -0.09850135091876, -0.1943853516059, 0.08935038736053, False, 0,
Nothing)
Part.Parameter("D1@Revolve1").SystemValue = Excel.Range("B1") / 57.29577951
boolstatus = Part.Extension.SelectByID("D2@
[email protected]",
"DIMENSION", -0.03077633012788, -0.11670139381, 0.09386013938138, False, 0,
Nothing)
Part.Parameter("D2@Sketch1").SystemValue = Excel.Range("B2") * 0.0254
End Sub
'&&& END MACRO &&&&
I hope this information will help you for future matters.
Kind regards.
Maperalia