Okay my head is not in a very good place today.. im sorry for so many posts on this subject...
I redid this macro in the VBA editor in Solidworks so you could use it easier... but Im afraid I cant seem to remember how to insert the macro feature.. the last time i did this was like a year ago. As soon as I figure it out Ill give you the rest.
But for now heres what you can do.
Create your dummy sketch and name it DMSKETCH
dimension the line in the DMSKETCH and rename that dim "TEMP"
make sure that the DMSKETCH is the very last feature in the part always.
Run this macro
create your drawing and insert the model items dimensions
In your drawing create a parametric note and select the "TEMP" dimension from DMSKETCH
that will update each time and stay current.
Here is the code that will work in VBA in Solidoworks
Sorry for any confusion
------------------------------------------------------------
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
Dim A As Long
Dim massprops As Variant
Dim mass As Double
Dim Density As Double
Dim volume As Double
Sub main()
Set swApp = Application.SldWorks
Set Part = swApp.ActiveDoc
massprops = Part.GetMassProperties
'Density = massprops(10)
volume = massprops(3)
'SurfaceArea = massprops(4)
mass = massprops(5)
A = (mass - volume) * 1.4
boolstatus = Part.Extension.SelectByID("TEMP@DMSKETCH", "DIMENSION", 0, 0, 0, False, 0, Nothing)
Part.Parameter("TEMP@DMSKETCH"

.SystemValue = A / 1000
End Sub
-----------------------------------------------------------
Regards,
Jon
jgbena@yahoo.com