.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Define Multileader Style in VB.NET - TextAttachmentType

5 REPLIES 5
Reply
Message 1 of 6
Anonymous
1925 Views, 5 Replies

Define Multileader Style in VB.NET - TextAttachmentType

Hi everyone,

I have a problem, I want to define my multileader styles with a VB.NET subroutine. Prior to VB.NET, I've been using VBA subs and two options we're given to set the text attachment type :

myNewMLeadStyle.TextLeftAttachmentType = 1
myNewMLeadStyle.TextRightAttachmentType = 1

With VB.NET, I can only find this one :

myNewMLeadStyle.TextAttachmentType = TextAttachmentType.AttachmentMiddleOfTop

This line only changes the left text attachment type. How can I change the right one in VB.NET?

Thanks for the help.

Edited by: felixseguin on Oct 6, 2009 5:36 PM
5 REPLIES 5
Message 2 of 6
dmcknight
in reply to: Anonymous

This is in C#, but all the code is in preperation to run the bottom two lines, which are what actually set the left/right attachment.
mldr = my Mleader Object.

Also, since I'm using AutoCad 2010, the XX's in the partial code next my need to be different depending on your AutoCad version.
[DllImport("acdbXX.dll", ......

I'm pretty sure this come from Tony T., just don't remember.




using System.Runtime.InteropServices;



public enum LeaderDirectionType
{
UnknownLeader = 0,
LeftLeader = 1,
RightLeader = 2
}

public static class AcDbMLeaderStyle
{
public static ErrorStatus SetTextAttachmentType(MLeaderStyle style, TextAttachmentType textAttachmentType, LeaderDirectionType leaderDirection)
{
return setTextAttachmentType(style.UnmanagedObject, textAttachmentType, leaderDirection);
}

public static TextAttachmentType GetTextAttachmentType(MLeaderStyle style, LeaderDirectionType leaderDirection)
{
return getTextAttachmentType(style.UnmanagedObject, leaderDirection);
}

[DllImport("acdb18.dll", CallingConvention = CallingConvention.ThisCall,
EntryPoint = "?setTextAttachmentType@AcDbMLeaderStyle@@QAE?AW4ErrorStatus@Acad@@W4TextAttachmentType@1@W4LeaderDirectionType@1@@Z")]
private static extern ErrorStatus setTextAttachmentType(IntPtr AcDbMLeaderStylePtr, TextAttachmentType textAttachmentType, LeaderDirectionType leaderDirection);

[DllImport("acdb18.dll", CallingConvention = CallingConvention.ThisCall,
EntryPoint = "?textAttachmentType@AcDbMLeaderStyle@@QBE?AW4TextAttachmentType@1@W4LeaderDirectionType@1@@Z")]
private static extern TextAttachmentType getTextAttachmentType(IntPtr AcDbMLeaderStylePtr, LeaderDirectionType leaderDirection);

}




AcDbMLeaderStyle.SetTextAttachmentType(mldr, TextAttachmentType.AttachmentMiddleOfTop, LeaderDirectionType.LeftLeader);
AcDbMLeaderStyle.SetTextAttachmentType(mldr, TextAttachmentType.AttachmentMiddleOfBottom, LeaderDirectionType.RightLeader); Edited by: dmcknight@grwinc.com on Feb 18, 2010 4:23 PM
Message 3 of 6
Martin60
in reply to: Anonymous

Great solution thanks to all who contributed.

Update for entry points in acdb19.dll

 

    <DllImport("acdb19.dll", CallingConvention:=CallingConvention.ThisCall, EntryPoint:="?setTextAttachmentType@AcDbMLeaderStyle@@QEAA?AW4ErrorStatus@Acad@@W4TextAttachmentType@1@W4LeaderDirectionType@1@@Z")> _
    Private Shared Function setTextAttachmentType(ByVal AcDbMLeaderStylePtr As IntPtr, ByVal textAttachmentType As TextAttachmentType, ByVal leaderDirection As LeaderDirectionType) As ErrorStatus
    End Function

    <DllImport("acdb19.dll", CallingConvention:=CallingConvention.ThisCall, EntryPoint:="?textAttachmentType@AcDbMLeaderStyle@@QEBA?AW4TextAttachmentType@1@W4LeaderDirectionType@1@@Z")> _
    Private Shared Function getTextAttachmentType(ByVal AcDbMLeaderStylePtr As IntPtr, ByVal leaderDirection As LeaderDirectionType) As TextAttachmentType
    End Function

 

Message 4 of 6
sonny3g
in reply to: dmcknight

dmcknight, THANKS!!  This bit of code was the answer.

 

dose.SetTextAttachmentType(TextAttachmentType.AttachmentMiddleOfTop, LeaderDirectionType.LeftLeader);

dose.SetTextAttachmentType(TextAttachmentType.AttachmentMiddleOfTop, LeaderDirectionType.RightLeader);

Scott G. Sawdy
scott.sawdy@bluecoyotecad.com
Message 5 of 6
ActivistInvestor
in reply to: sonny3g


@sonny3g wrote:

dmcknight, THANKS!!  This bit of code was the answer.

 

dose.SetTextAttachmentType(TextAttachmentType.AttachmentMiddleOfTop, LeaderDirectionType.LeftLeader);

dose.SetTextAttachmentType(TextAttachmentType.AttachmentMiddleOfTop, LeaderDirectionType.RightLeader);


You didn't see my reply in the other thread?

Message 6 of 6
sonny3g
in reply to: ActivistInvestor

Yes I did, and I marked it as the solution to that thread.

Scott G. Sawdy
scott.sawdy@bluecoyotecad.com

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

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost