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
. OK – this is supposed to be a question
.
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
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
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
RE: VB for The Perfect Item Number Balloon
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
Thanks
Tobin Sparks
www.nov.com
RE: VB for The Perfect Item Number Balloon
CODE
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)
RE: VB for The Perfect Item Number Balloon
This might be confused with Datum targetting.
Matt Lorono
CAD Engineer/ECN Analyst
Silicon Valley, CA
Lorono's SolidWorks Resources
Co-moderator of Solidworks Yahoo! Group
and Mechnical.Engineering Yahoo! Group