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 = FalseFor i = 1 To iSwSelmgr.GetSelectedObjectCountIf iSwSelmgr.GetSelectedObjectType3(i, -1) = swSelectType_e.swSelEDGES Thenswnote = iModel.IInsertNote(
"Pxx")swnote.SetBalloon(
swBalloonStyle_e.swBS_Diamond, swBalloonFit_e.swBF_Tightest)iSwannotation = swnote.GetAnnotation
iSwannotation.Layer =
"P"iSwannotation.DeSelect()
sel =
TrueElseIf iSwSelmgr.GetSelectedObjectType3(i, -1) = swSelectType_e.swSelFACES Thenswnote = iModel.IInsertNote(
"Pxx")swnote.SetBalloon(
swBalloonStyle_e.swBS_Diamond, swBalloonFit_e.swBF_Tightest)iSwannotation = swnote.GetAnnotation
iSwannotation.Layer =
"P"iSwannotation.DeSelect()
sel =
TrueEnd IfNextIf sel = False TheniSwApp.SendMsgToUser2(
"Selecteer eerst een Edge of Face", swMessageBoxIcon_e.swMbWarning, swMessageBoxBtn_e.swMbOk)End IfiModel.ClearSelection2(
True)iModel.ForceRebuild3(
False)
Thanks,
Rody
SolidworksApi macros