Search code examples
vb.netvbaautocad-plugin

Changing the color of a leader in AutoCad


I'm currently working on converting a VBA AutoCAD-application over to VB.NET, and the current command I'm working on is creating a simple leader with code like this:

Set leaderObj = ThisDrawing.ModelSpace.AddLeader(points, blockRefObj, leaderType)
leaderObj.ArrowheadType = acArrowDotSmall
leaderObj.ArrowheadSize = 2.5 * varDimscale
leaderObj.DimensionLineColor = acWhite

I've been able to create the Leader-line in .NET using

Dim l = New Leader()
For Each point In jig.LeaderPoints
    l.AppendVertex(point)
Next
l.Dimldrblk = arrId

The arrId I got from using the function found here, but I've been unable to figure out how to set the color of the leader to white (it shows up as red by default), and also how to set the size of the arrowhead. If anyone could help me out with this I would be most grateful.


Solution

  • Ok, after a lot of trial and error, I figured out that the solution was rather simple. I didn't have to override any dimension styles (which I honestly don't even know what is, I had a short beginners course in AutoCAD before getting handed this project), I simply had to set an obscure property on the Leader-object. For future references, and for anyone else trying to do the same, here's the properties I ended up using:

    leader.Dimclrd
    The color of the leader-line. Stands for something like "dimension line color".
    leader.Dimasz
    The scale of the leader-head.