Hello
Is it possible to attach a sketched symbol to a leader note? I tried the following code, but an error occurs in the line adding the sketchedsymbol. The geometry intent, which seems to be created correct, isn't a valid input for the sketched symbol.
Private Sub AttachSketchedSymbolToLeaderNote() Dim oDrawDoc As DrawingDocument Set oDrawDoc = ThisApplication.ActiveDocument Dim oLeaderNote As LeaderNote Set oLeaderNote = oDrawDoc.ActiveSheet.DrawingNotes.LeaderNotes.Item(1) Dim oSketchedSymbolDef As SketchedSymbolDefinition Set oSketchedSymbolDef = oDrawDoc.SketchedSymbolDefinitions.Item(1) Dim oPoint1 As Point2d Set oPoint1 = oLeaderNote.Position Dim oPoint2 As Point2d Set oPoint2 = ThisApplication.TransientGeometry.CreatePoint2d(1, 1) Dim oGeometryIntent As GeometryIntent Set oGeometryIntent = oDrawDoc.ActiveSheet.CreateGeometryIntent(oLeaderNote, oLeaderNote.Position) Dim oPoints As ObjectCollection Set oPoints = ThisApplication.TransientObjects.CreateObjectCollection Call oPoints.Add(oPoint2) Call oPoints.Add(oPoint1) Call oPoints.Add(oGeometryIntent) Dim oSketchedSymbol As SketchedSymbol Set oSketchedSymbol = oDrawDoc.ActiveSheet.SketchedSymbols.AddWithLeader(oSketchedSymbolDef, oPoints) End Sub
Hi,
although having not digged into, I suspected this is similar to the other case, in which I wrote a blog for it. Could you take a look if it helps?
http://adndevblog.typepad.com/manufacturing/2013/01/attach-a-sketched-symbol-to-a-balloon.html
Hello
This blog post is source/inspiration of my code. Also your example code fails here in the line
Call oSS.Leader.AddLeader(oObjColl)
with
Run-time error -2147467259 (80004005)
Method 'AddLeader' of object 'Leader' failed
Tested it with Inventor 2011 and 2013 all ServicePacks installed.
Love these days
Hello
I figured out the problem with your code. Don't know why, but balloon diameter value here is not the diameter, but the radius of the balloon.
Maybe there's a similar problem with the coordinates in my code. Will do some testing.
Hi,
I am not clear what you met with. As you can see, my code uses diameter/ 2.0 to get radius. It works well with my simplest sample balloon. probably you are testing a specific sample?
this is just for your reference to figure out the problem of attach symbol to leader note because I doubt we can only attach to some specific location of the leader note (like balloon). Hope this helps. If you worked out, please update this post. I would be useful for others. Thanks!
Hello
Sorry, my fault. I forgot to set ScaleToTextHeight=false. So the diameter value couldn't be right.
I did some further testing. The GUI accepts a non visible square around the LeaderNote text as input to attach the leader of my sketched symbol. If i copy'n paste the coordinates of the manual added leader to my code it won't work. I've attached a screenshot.