×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Get Part Quantity From Item Balloon Macro

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

Tobin Sparks
www.nov.com

RE: Get Part Quantity From Item Balloon Macro

Here's the Quickie-Dickie, Cheating-Charlie way to do it:

CODE

Option Explicit
' 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. smile  That way you very easily get the quantity that you would have gotten by adding a quantity balloon.

-handleman, CSWP (The new, easy test)

RE: Get Part Quantity From Item Balloon Macro

It's better than the "Quickie-Dickie" method....

Chris
SolidWorks/PDMWorks 08 3.1
AutoCAD 06/08
ctopher's home (updated Apr 30, 2008)

RE: Get Part Quantity From Item Balloon Macro

(OP)
Handleman,
Thanks you for your valuable help.

Ctopher,
Not sure I'd really want to here about the <"Quickie-Dickie" method> smile .

Thank you both for your responses

Tobin Sparks
www.nov.com

RE: Get Part Quantity From Item Balloon Macro

Tobin,
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

(OP)

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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources