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: 

Changing Leader Text Justification throws unexpected results

3 REPLIES 3
Reply
Message 1 of 4
Anonymous
418 Views, 3 Replies

Changing Leader Text Justification throws unexpected results

Hi all,

 

I'm having problems editing Leader Notes with VBA. I've written code which replaces all our LeaderNotes and Balloons with the same object which has slightly different properties (namely, the leader colour and lineweight). Now my problem is that when I adjust the verticle justification of a LeaderNote, then the colour property is disturbed. By default, our LeaderNotes have colour = ByLayer. However once I change the Verticle Justification, then the colour is changed to Black by Override. 

 

I'm using this code to change the justification

        

newLeader.VerticalJustification = oldLeader.VerticalJustification

 And I tried using this code to manually fix the colour

 

        Set clrColor = ThisApplication.TransientObjects.CreateColor(0, 0, 0)
        clrColor.ColorSourceType = kLayerColorSource 
        newLeader.Color = clrColor

 but nothing is working... It's driving me mad, does anyone have any suggestions???

 

Thanks

3 REPLIES 3
Message 2 of 4
YuhanZhang
in reply to: Anonymous

How about use below line instead of creating a totoally new color:

 

Set clrColor = oldLeader.Color

 



If this solves the problem please click ACCEPT SOLUTION so other people can find it easily.



Rocky Zhang
Inventor API PD
Manufacturing Solutions
Autodesk, Inc.

Message 3 of 4
Anonymous
in reply to: YuhanZhang

Hi Rocky,

 

Thanks for the suggestion.

 

I had tried to change the colorsourcetype using that same method, but that didn't work. I've just tried your suggestion now, and it still doesn't work.

 

Here's a code example you could try on any drawing with any leader note.

 

Sub LeaderJustificationTest()

Dim oDoc As DrawingDocument
Dim oLeader As LeaderNote

Set clrColor = ThisApplication.TransientObjects.CreateColor(0, 0, 0)
clrColor.ColorSourceType = kLayerColorSource

Set oDoc = ThisApplication.ActiveDocument
For Each oLeader In oDoc.ActiveSheet.DrawingNotes.LeaderNotes
    oLeader.VerticalJustification = kAlignTextLower
    oLeader.Color = clrColor
Next oLeader

End Sub

 

Try running that, and once it's done check the color to see if it's "ByLayer"... Mine isn't...

 

Cheers

Message 4 of 4
YuhanZhang
in reply to: Anonymous

Yes, the code reproduces the issue, I logged this issue, please provide the number 1413808 to us to check the status. If you need a hotfix for this issue please provide your business case to Autodesk ADN.



If this solves the problem please click ACCEPT SOLUTION so other people can find it easily.



Rocky Zhang
Inventor API PD
Manufacturing Solutions
Autodesk, Inc.

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

Post to forums  

Autodesk Design & Make Report