ds-blue-logo
Preview  |  SOLIDWORKS USER FORUM
Use your SOLIDWORKS ID or 3DEXPERIENCE ID to log in.
RKRody Kossen24/11/2010

Hello,

I have a question about the api for Add Annotation. I'm building a add-in for our company with customized functions. One of the functions is to add an Annotation in a specific layer with a diamond border. When the user selects multiple parts in a assembly drawing, an annotation is made for every part. The only problem is that the annotations have multiple leaders to each of the parts.

Does anybody have a solution for this? This is the code i'm using:


iModel = iSwApp.ActiveDoc

iSwSelmgr = iModel.SelectionManager

Dim sel As Boolean = False

For i = 1 To iSwSelmgr.GetSelectedObjectCount

If iSwSelmgr.GetSelectedObjectType3(i, -1) = swSelectType_e.swSelEDGES Then

swnote = iModel.IInsertNote(

"Pxx")

swnote.SetBalloon(

swBalloonStyle_e.swBS_Diamond, swBalloonFit_e.swBF_Tightest)

iSwannotation = swnote.GetAnnotation

iSwannotation.Layer =

"P"

iSwannotation.DeSelect()

sel =

True

ElseIf iSwSelmgr.GetSelectedObjectType3(i, -1) = swSelectType_e.swSelFACES Then

swnote = iModel.IInsertNote(

"Pxx")

swnote.SetBalloon(

swBalloonStyle_e.swBS_Diamond, swBalloonFit_e.swBF_Tightest)

iSwannotation = swnote.GetAnnotation

iSwannotation.Layer =

"P"

iSwannotation.DeSelect()

sel =

True

End If

Next

If sel = False Then

iSwApp.SendMsgToUser2(

"Selecteer eerst een Edge of Face", swMessageBoxIcon_e.swMbWarning, swMessageBoxBtn_e.swMbOk)

End If

iModel.ClearSelection2(

True)

iModel.ForceRebuild3(

False)


Thanks,

Rody