Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Attach sketched symbol to a leadernote

5 REPLIES 5
Reply
Message 1 of 6
Ralf_Krieg
492 Views, 5 Replies

Attach sketched symbol to a leadernote

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

 


R. Krieg
RKW Solutions GmbH
www.rkw-solutions.com
5 REPLIES 5
Message 2 of 6
xiaodong_liang
in reply to: Ralf_Krieg

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?

 

Connecting Sketchedsymbol to Balloon using VB 

 

http://adndevblog.typepad.com/manufacturing/2013/01/attach-a-sketched-symbol-to-a-balloon.html

 

Message 3 of 6
Ralf_Krieg
in reply to: xiaodong_liang

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 Smiley Sad

 

 


R. Krieg
RKW Solutions GmbH
www.rkw-solutions.com
Message 4 of 6
Ralf_Krieg
in reply to: Ralf_Krieg

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.


R. Krieg
RKW Solutions GmbH
www.rkw-solutions.com
Message 5 of 6
xiaodong_liang
in reply to: Ralf_Krieg

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!

Message 6 of 6
Ralf_Krieg
in reply to: xiaodong_liang

Hello

 

Sorry, my fault. I forgot to set ScaleToTextHeight=false. So the diameter value couldn't be right. Smiley Sad

 

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.

 

 


R. Krieg
RKW Solutions GmbH
www.rkw-solutions.com

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report