vbscript in property sets
Not applicable
07-24-2005
09:43 AM
It appears that you can use many parts of vbscript in property sets but how do you get the property set to fire the code and return the result?
Example:
' this function should return the value of 1 to whatever property formula that calls it.
Public Function x()
x = 1
End Function
Scott Arvin with Autodesk knows something about this... He wrote a brain dump that can be found here:
http://discussion.autodesk.com/servlet/JiveServlet/download/52-150795-2668751-26558/BrainDump_PropertyDataEnhancements.pdf
which is referenced here:
http://discussion.autodesk.com/thread.jspa?messageID=554372
One would conclude from page four of Scott's article that the following function if called from another property formula definition would return the correct value of 1.
Public Function RESULT()
RESULT = 1
End Function
But instead it returns the whole text of the function
So how do I really call that function in a property formula definition?
Can you really have a vbscript Sub or Function in a Property Formula Definition and have it return a result?
Here is the impact of this ability...
working with a abs pipe object that has endpoint, startpoint
varible objID would be passed into this vbscript function framework as the property set automatic formula [ObjectID]
Function getpoints01
Dim cadobj01 As Object
Set cadobj01 = ThisDrawing.ObjectIdToObject(objID)
Dim startPoint As Variant
Dim endPoint As Variant
startPoint = cadobj01.startPoint
endPoint = cadobj01.endPoint
getpoints01 = startPoint(2)
End Function
the return value of getpoints01 would be the z value of the start point of the object and you could pass this value to other property formula definitions to get slope and stuff, etc.
Basically this would build the bridge between the extended data property set information back to the "Design" tab information of the properties dialog box.
Or another question to this might be...
How can I call a vb function from vbscript that is executed/fired inside a property set - property formula defintion?
Example:
' this function should return the value of 1 to whatever property formula that calls it.
Public Function x()
x = 1
End Function
Scott Arvin with Autodesk knows something about this... He wrote a brain dump that can be found here:
http://discussion.autodesk.com/servlet/JiveServlet/download/52-150795-2668751-26558/BrainDump_PropertyDataEnhancements.pdf
which is referenced here:
http://discussion.autodesk.com/thread.jspa?messageID=554372
One would conclude from page four of Scott's article that the following function if called from another property formula definition would return the correct value of 1.
Public Function RESULT()
RESULT = 1
End Function
But instead it returns the whole text of the function
So how do I really call that function in a property formula definition?
Can you really have a vbscript Sub or Function in a Property Formula Definition and have it return a result?
Here is the impact of this ability...
working with a abs pipe object that has endpoint, startpoint
varible objID would be passed into this vbscript function framework as the property set automatic formula [ObjectID]
Function getpoints01
Dim cadobj01 As Object
Set cadobj01 = ThisDrawing.ObjectIdToObject(objID)
Dim startPoint As Variant
Dim endPoint As Variant
startPoint = cadobj01.startPoint
endPoint = cadobj01.endPoint
getpoints01 = startPoint(2)
End Function
the return value of getpoints01 would be the z value of the start point of the object and you could pass this value to other property formula definitions to get slope and stuff, etc.
Basically this would build the bridge between the extended data property set information back to the "Design" tab information of the properties dialog box.
Or another question to this might be...
How can I call a vb function from vbscript that is executed/fired inside a property set - property formula defintion?
Link copied