polyline segment length

polyline segment length

hari.ramalingam
Participant Participant
980 Views
8 Replies
Message 1 of 9

polyline segment length

hari.ramalingam
Participant
Participant

hi all,

 

i am new to vba, we have a unique requirement. we have leader (polylines) to label components. we we want the length of one of the segment of polyline to be 6" (as shown in attachment). is it possible?

 

 

thanks

Hari 

0 Likes
Accepted solutions (2)
981 Views
8 Replies
Replies (8)
Message 2 of 9

seabrahenrique
Advocate
Advocate
Accepted solution

Try this:

 

Sub ChangeMLeader()

' Declare variables
Dim objMLeader As AcadMLeader

' Get MLeader from the user
ThisDrawing.Utility.GetEntity objMLeader, pt

' Change the landing distance of the MLeader
objMLeader.DoglegLength = 6

' Update the MLeader
objMLeader.Update

End Sub

 

I guess the .DoglegLenght is the parameter that you find.

 

Hope can help u.

Message 3 of 9

Ed__Jobe
Mentor
Mentor
Accepted solution

No need for programming. Define an mleader style with the landing distance set to 6". Then select the leaders and change their style .

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

Message 4 of 9

Smaltsbarger
Enthusiast
Enthusiast

Create a leader with your parameters using the Multileader Style manager. Command MLEADERSTYLE. 

0 Likes
Message 5 of 9

hari.ramalingam
Participant
Participant

hi @seabrahenrique  thanks,

 

but our client is using polylines instead of mleader, is there any way we can change the polyline to mleader as it is?

0 Likes
Message 6 of 9

seabrahenrique
Advocate
Advocate

Right.

So if i understood correct: You have a polyline itself and want to change the length of a specific segment inside this polyline, correct?

In this case i guess the only way is to reconstruct your poyline changing the X position of one vertice to "grow" the required part of your polyline, you know?

I hope can help!

0 Likes
Message 7 of 9

hari.ramalingam
Participant
Participant

thanks again for your reply @seabrahenrique 

 

is it possible to construct the polyline via vba code?

 

thanks

Hari R.

0 Likes
Message 8 of 9

seabrahenrique
Advocate
Advocate

Yes, and is pretty simple.

 

See the code bellow:

 

Sub MakePolyline()

    ' Declare variables
    Dim objPolyline As AcadPolyline, Coords(8) As Double

    'First Point
    Coords(0) = 0 'X
    Coords(1) = 0 'Y
    Coords(2) = 0 'Z

    'Second Point
    Coords(3) = 6 'X
    Coords(4) = 0 'Y
    Coords(5) = 0 'Z

    'Last Point
    Coords(6) = 20 'X
    Coords(7) = 20 'Y
    Coords(8) = 0 'Z

    ' Create a new Polyline object
    Set objPolyline = ThisDrawing.ModelSpace.AddPolyline(Coords)

End Sub

 

They do one Polyline similar a your first picture:

 

seabrahenrique_0-1673019242238.png

 

You also can "capture" the polylines and they vertices in all your project and try to reconstruct then after making some changes... Is just a suggestion, if i got what your need correctly.

 

I hope can help.

0 Likes
Message 9 of 9

Ed__Jobe
Mentor
Mentor

@hari.ramalingam wrote:

hi @seabrahenrique  thanks,

 

but our client is using polylines instead of mleader, is there any way we can change the polyline to mleader as it is?


oooh, slap their hand!  😁 No reason to use polylines as leaders.

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

0 Likes