I must be doing something wrong and could use a little help.
I want to measure the diameter of a selected edge and then use that dia. in an equation but its not working and I have no idea why.
Here is the test code I set up to goof around with... see anything wrong?
Dim swApp As Object
Dim swmodel As Object
Dim boolstatus As Boolean
Dim longstatus As Long, longwarnings As Long
Dim Measure As Measure
Set swApp = Application.SldWorks
Set swmodel = swApp.ActiveDoc
Set Measure = swmodel.Extension.CreateMeasure
Measure.ArcOption = 0
'PreSelect Edge and Run Macro
'Measure and Store selected Edge Diameter for later use
boolstatus = Measure.Calculate(Nothing)
Dim myMeasurement As Variant
myMeasurement = Measure.Diameter
Dim swEquationMgr As Object
Set swEquationMgr = swmodel.GetEquationMgr()
swEquationMgr.Add2 -1, """D1@Sketch2"" = myMeasurement - 0.5", True
'this shows that the measurement exists..
boolstatus = swmodel.ForceRebuild()