Help with Macro Syntax
Help with Macro Syntax
(OP)
Howdy All!
I probably didn't write a "good" question the last time
. I hope this is better.
I'm having trouble understanding the "SolidWorks and Add-Ins API Help" concerning the syntax for the GetBalloonInfo method.
I'm just doing an experiment to see if I can get and display in the MessageBox the coordinates of a SW Balloon.
Attached is a file with a snapshot of the SW Help and my attempt to interpret the help.
Can anybody show me how to do this?
Thanks
I probably didn't write a "good" question the last time
I'm having trouble understanding the "SolidWorks and Add-Ins API Help" concerning the syntax for the GetBalloonInfo method.
I'm just doing an experiment to see if I can get and display in the MessageBox the coordinates of a SW Balloon.
Attached is a file with a snapshot of the SW Help and my attempt to interpret the help.
Can anybody show me how to do this?
Thanks
Tobin Sparks
www.nov.com






RE: Help with Macro Syntax
dim myArr as variant
myArr = swNote.getballooninfo
Then you can get values out of myArr, which is an array of doubles.
Also, is most of the code from your actual macro removed? If not, you need a bunch more code to tell SW what note swNote refers to. Simply pre-selecting one prior to running the macro isn't enough. You have to use the selection manager to get a pointer to the selected note.
-handleman, CSWP (The new, easy test)
RE: Help with Macro Syntax
CODE
' Precondition: Select a balloon on a SW Drawing
Dim swApp As SldWorks.SldWorks
Dim swDoc As SldWorks.ModelDoc2
Dim swNote As SldWorks.Note
Dim SelMgr As SldWorks.SelectionMgr
Dim retval As Variant
Dim sMsg As String
Sub main()
Set swApp = Application.SldWorks
Set swDoc = swApp.ActiveDoc
Set SelMgr = swDoc.SelectionManager
If (SelMgr.GetSelectedObjectCount <> 1) Or (SelMgr.GetSelectedObjectType3(1, -1) <> swSelNOTES) Then
MsgBox "Please select one balloon and try again."
Exit Sub
End If
Set swNote = SelMgr.GetSelectedObject6(1, -1)
retval = swNote.GetBalloonInfo
sMsg = "Balloon Center:" & vbCrLf & "X: " & retval(0) & _
vbCrLf & "Y: " & retval(1) & vbCrLf & _
"Z: " & retval(2) & vbCrLf & vbCrLf & "Arc Point:" & _
vbCrLf & "X: " & retval(3) & vbCrLf & "Y: " & retval(4) _
& vbCrLf & "Z: " & retval(5)
MsgBox sMsg
End Sub
-handleman, CSWP (The new, easy test)
RE: Help with Macro Syntax
Thanks for your response. You seem to be the one that is always very helpful to me. I was wondering about the selection manager thing. I'll have to see what I can do since trying to "record" something like that doesn't seem to cause a reaction.
Thanks Again
Tobin Sparks
www.nov.com
RE: Help with Macro Syntax
You responded a second time before I could thank you for the first one
Thanks Again
Tobin Sparks
www.nov.com
RE: Help with Macro Syntax
Well that really does the trick.
I still don't see how you were able to turn that SW API help page into this code. I mean now that you wrote it out I can kinda sorta see where you got it from, but, I could have looked at the SW API Help for a week and not produced what you did.
Now I'll have to let this sink in a bit to see how I can use it.
Thanks Again
Tobin Sparks
www.nov.com
RE: Help with Macro Syntax
Matt Lorono
CAD Engineer/ECN Analyst
Silicon Valley, CA
Lorono's SolidWorks Resources
Co-moderator of Solidworks Yahoo! Group
and Mechnical.Engineering Yahoo! Group