Get Part Quantity From Item Balloon Macro
Get Part Quantity From Item Balloon Macro
(OP)
Howdy All,
I've been attempting to write a macro that will get the number of components related to an Item Balloon. This is just a test macro to see if I can do it simply. I've attached the macro I've been working with, but I need help figuring out the details. Or maybe I'm totally going in the wrong direction with this. There is some information in the Sw API help, but I can't seem to put it together right.
Does anybody already know how to do this or able to help?
Thanks
I've been attempting to write a macro that will get the number of components related to an Item Balloon. This is just a test macro to see if I can do it simply. I've attached the macro I've been working with, but I need help figuring out the details. Or maybe I'm totally going in the wrong direction with this. There is some information in the Sw API help, but I can't seem to put it together right.
Does anybody already know how to do this or able to help?
Thanks
Tobin Sparks
www.nov.com






RE: Get Part Quantity From Item Balloon Macro
CODE
' Precondition: Pre-selected balloon on a SW Drawing
Dim swApp As SldWorks.SldWorks
Dim swDoc As SldWorks.ModelDoc2
Dim SelMgr As SldWorks.SelectionMgr
Dim swBall As SldWorks.Note
Dim theOldUpperStyle As Long
Dim theOldUpperText As Long
Dim theOldLowerStyle As String
Dim theOldLowerText 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 swBall = SelMgr.GetSelectedObject6(1, -1)
theOldUpperStyle = swBall.GetBomBalloonTextStyle(True)
theOldLowerStyle = swBall.GetBomBalloonTextStyle(False)
theOldUpperText = swBall.GetBomBalloonText(True)
theOldLowerText = swBall.GetBomBalloonText(False)
swBall.SetBomBalloonText theOldUpperStyle, theOldUpperText, swDetailingNoteTextQuantity, ""
MsgBox swBall.GetBomBalloonText(False)
swBall.SetBomBalloonText theOldUpperStyle, theOldUpperText, theOldLowerStyle, theOldLowerText
End Sub
I say "Cheating-Charlie", but I don't really see anything wrong with this method... at least not yet.
-handleman, CSWP (The new, easy test)
RE: Get Part Quantity From Item Balloon Macro
Chris
SolidWorks/PDMWorks 08 3.1
AutoCAD 06/08
ctopher's home (updated Apr 30, 2008)
RE: Get Part Quantity From Item Balloon Macro
Thanks you for your valuable help.
Ctopher,
Not sure I'd really want to here about the <"Quickie-Dickie" method>
Thank you both for your responses
Tobin Sparks
www.nov.com
RE: Get Part Quantity From Item Balloon Macro
Is this the same file you emailed me last week for testing?
Colin Fitzpatrick (aka Macduff)
Mechanical Designer
Solidworks 2008 SP 3.1
Dell 490 XP Pro SP 2
Xeon CPU 3.00 GHz 3.00 GB of RAM
nVida Quadro FX 3450 512 MB
I'm just a little verklempt. Talk amongst yourselves. I'll give you a topic. Pink Floyd, was neither Pink nor Floyd. Discuss!--"Coffee Talk" Mike Myers SNL
RE: Get Part Quantity From Item Balloon Macro
Howdy Colin,
No - this is something different. I'm going to add a few things to the Balloon Note that I sent you. I'm just trying to figure out the details.
Thanks
Tobin Sparks
www.nov.com