×
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

VB for The Perfect Item Number Balloon

VB for The Perfect Item Number Balloon

VB for The Perfect Item Number Balloon

(OP)
An Item Number balloon grouped to a Quantity balloon (style: none) both updating automatically. It can be created manually by doing the following:

Precondition: A SW Drawing View of a part or assembly with an existing Item Number balloon

Start the Balloon command
In the Balloon Property Manager select:
Style: None
Balloon text: Quantity
Select the Part (edge or face) with the existing Item Number balloon for the arrow
Select the Balloon location on the drawing sheet
Either pick green check box in property manager or hit the Esc key
Re-select the Quantity balloon
Pick More Properties in the Property Manager
Pick No Leader

Next make an "X" using Note text and put it next to the Quantity
(make sure all this is done within the same drawing View that your original Item Number balloon is associated to – groups can only be created within a single view focus)

Group these to the existing Item Number balloon and you have an Automatic updating Item Number/Quantity balloon. I can't say I've ever actually done this before but I know someone who would REALLY like this type of balloon. Please don't tell anyone it can be done this way smile . OK – this is supposed to be a question smile .

I've been looking in the Object Browser and API Help but can't seem to find what I need (or think I need) to put this together – any Ideas?

Attached is a tester Macro that I'm using just to try to get started.

Thanks

Tobin Sparks
www.nov.com

RE: VB for The Perfect Item Number Balloon

Why don't you just use a split circular balloon with item# on top and qty on the bottom?  Do you already have a company standard that specifies two separate balloons?

RE: VB for The Perfect Item Number Balloon

(OP)
takedownca,

Thanks for your response. Not sure if I'd call it a "company standard" but the most acceptable way is a circular balloon with the quantity noted at one of the quadrants outside the balloon. Probably a carryover from the pencil drawing days smile .

Thanks

Tobin Sparks
www.nov.com

RE: VB for The Perfect Item Number Balloon

How's this look?

CODE

Dim swApp As SldWorks.SldWorks
Dim swDoc As SldWorks.ModelDoc2
Dim swNote As SldWorks.Note
Dim newBalloon As SldWorks.Note
Dim xNote As SldWorks.Note
Dim swSelmgr As SldWorks.SelectionMgr
Dim BalPos As Variant
Dim attEnts As Variant
Dim myEnt As SldWorks.Entity
Dim myTfmt As SldWorks.TextFormat

Sub main()

Set swApp = Application.SldWorks
Set swDoc = swApp.ActiveDoc

On Error GoTo ENABLEAGAIN
swDoc.ActiveView.EnableGraphicsUpdate = False
Set swSelmgr = swDoc.SelectionManager
If swSelmgr.GetSelectedObjectType3(1, -1) <> swSelNOTES Then
    Exit Sub
End If
Set myTfmt = swDoc.GetUserPreferenceTextFormat(swDetailingNoteTextFormat)

Set swNote = swSelmgr.GetSelectedObject6(1, -1)
If False = swNote.IsBomBalloon Then
    Exit Sub
End If

BalPos = swNote.GetTextPoint2
attEnts = swNote.GetAnnotation.GetAttachedEntities
Set myEnt = attEnts(0)

myEnt.Select4 False, Nothing

'Create the quantity balloon
swDoc.ActiveView.EnableGraphicsUpdate = False

Set newBalloon = swDoc.InsertBOMBalloon2(swBS_None, swBF_Tightest, 3, "", 3, "")
newBalloon.SetTextPoint BalPos(0) + 0.008, BalPos(1) + 0.008, 0
newBalloon.SetBomBalloonText 3, vbNullString, 3, vbNullString
newBalloon.SetBalloon swBS_None, swBF_Tightest
newBalloon.GetAnnotation.SetLeader3 swNO_LEADER, Empty, Empty, Empty, Empty, Empty
newBalloon.GetAnnotation.SetTextFormat 0, False, myTfmt

'Create the "x"
myEnt.Select4 False, Nothing
Set xNote = swDoc.InsertNote("x")
xNote.GetAnnotation.SetLeader3 swNO_LEADER, Empty, Empty, Empty, Empty, Empty
xNote.SetTextJustification swTextJustificationRight
xNote.SetTextPoint BalPos(0) + 0.008, BalPos(1) + 0.008, 0
xNote.GetAnnotation.SetTextFormat 0, False, myTfmt

'Group them
swDoc.ClearSelection2 True
swNote.GetAnnotation.Select True
newBalloon.GetAnnotation.Select True
xNote.GetAnnotation.Select True
swDoc.CreateGroup
swDoc.ClearSelection2 True
ENABLEAGAIN:
swDoc.ActiveView.EnableGraphicsUpdate = True

End Sub

-handleman, CSWP (The new, easy test)

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