Changing Leader Text Justification throws unexpected results

Changing Leader Text Justification throws unexpected results

Anonymous
Not applicable
556 Views
3 Replies
Message 1 of 4

Changing Leader Text Justification throws unexpected results

Anonymous
Not applicable

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

0 Likes
557 Views
3 Replies
Replies (3)
Message 2 of 4

YuhanZhang
Autodesk
Autodesk

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.

0 Likes
Message 3 of 4

Anonymous
Not applicable

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

0 Likes
Message 4 of 4

YuhanZhang
Autodesk
Autodesk

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.

0 Likes