Results 1 to 2 of 2

Thread: Working with Text Leaders....

  1. #1
    I could stop if I wanted to scowsert's Avatar
    Join Date
    2006-08
    Location
    Olympia, WA
    Posts
    418
    Login to Give a bone
    0

    Default Working with Text Leaders....

    I run this code through the macro interface.

    If I take a piece of text add a curved leader, then remove it (so its blank), then run my code it fails.

    If I take a piece of text add a straight leader, then remove it (so its blank), then run my code it works.

    It looks to me like leaderless text will only except whatever leader type it was using previously. How can I can force it to work? I've got other code to remove leaders but run into this same issue.

    Thanks Sage


    ===============
    Code below.

    public void AddStraightLeader()
    {


    Document doc = this.ActiveUIDocument.Document;
    UIDocument uidoc = new UIDocument(doc);
    TextNote selected = doc.GetElement(uidoc.Selection.PickObject(ObjectType.Element, "Select text to add leader.")) as TextNote;
    XYZ leaderOrigin = uidoc.Selection.PickPoint("Pick Leader End");

    using (Transaction t = new Transaction(doc,"Change dimension style to default"))
    {
    t.Start();

    Leader noteLeader = selected.AddLeader(
    TextNoteLeaderTypes.TNLT_STRAIGHT_R);

    // Use default Y!


    noteLeader.Elbow = new XYZ( leaderOrigin.X,
    noteLeader.Elbow.Y, leaderOrigin.Z );
    noteLeader.End = leaderOrigin;

    t.Commit();
    }
    }

  2. #2
    Member
    Join Date
    2010-05
    Location
    France
    Posts
    16
    Login to Give a bone
    0

    Default Re: Working with Text Leaders....

    The reason why macro failed is simple. When you add a curved leader on a text manually, the Arc leader parameter in the panel "propriety" is checked , and if you delete curved leader, the parameter is always checked.
    If you want fix that, you can change this parameter to "false" before add straight leader.
    for exemple, you can add this code :
    Parameter arc_leader = selected.get_Parameter(BuiltInParameter.ARC_LEADER_PARAM);
    arc_leader.Set(0);

    After t.Start();

    this piece of code uncheck the text note before add straight leader.

Similar Threads

  1. Have a 'commonly used text' selection box to IDW leaders and placed text
    By Wish List System in forum Inventor Wish List
    Replies: 0
    Last Post: 2012-09-09, 09:16 PM
  2. Allow Tag and Keynote Leaders to be curved like Text Leaders
    By Wish List System in forum Revit Architecture - Wish List
    Replies: 0
    Last Post: 2012-09-05, 06:23 PM
  3. Leaders with not text
    By ncassidy in forum Revit MEP - General
    Replies: 3
    Last Post: 2011-02-07, 02:48 PM
  4. Annotative leaders not working correctly in ACA 2009
    By bbeckemeyer in forum ACA General
    Replies: 2
    Last Post: 2008-04-22, 11:49 PM
  5. Text Leaders detaching from text/arrows
    By cphubb in forum Revit Architecture - General
    Replies: 2
    Last Post: 2003-11-26, 07:14 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •