VBA
Discuss AutoCAD ActiveX and VBA (Visual Basic for Applications) questions here.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

VB's getPointAtDist?

7 REPLIES 7
Reply
Message 1 of 8
mgrigoriev
350 Views, 7 Replies

VB's getPointAtDist?

Is there a VB analog to LISP's getPointAtDist function?
My goal is actualy to get a midpoint of a polyline.
7 REPLIES 7
Message 2 of 8
Anonymous
in reply to: mgrigoriev

Yes, sortof, using Frank Oquendo's VLAX and Curve classes. See a request by me for these from a month or two ago. I don't have them on this machine or I'd post them again. Jeff "mgrigoriev" wrote in message news:9760039.1084559528190.JavaMail.jive@jiveforum2.autodesk.com... > Is there a VB analog to LISP's getPointAtDist function? > My goal is actualy to get a midpoint of a polyline.
Message 3 of 8
Anonymous
in reply to: mgrigoriev

Jeff Mishler wrote: > Yes, sortof, using Frank Oquendo's VLAX and Curve classes. See a > request by me for these from a month or two ago. I don't have them on > this machine or I'd post them again. Here's VLAX.CLS and CURVE.CLS. If you need help with them, just holler. -- Gravity: it's not just a good idea, it's the law.
Message 4 of 8
Anonymous
in reply to: mgrigoriev

Or simply find the polyline's midst segment, then find the mid point of that segment. Pure VBA. Regards, Maksim Sestic "Frank Oquendo" wrote in message news:40a622d6$1_2@newsprd01... > Jeff Mishler wrote: > > Yes, sortof, using Frank Oquendo's VLAX and Curve classes. See a > > request by me for these from a month or two ago. I don't have them on > > this machine or I'd post them again. > > Here's VLAX.CLS and CURVE.CLS. If you need help with them, just holler. > > -- > Gravity: it's not just a good idea, it's the law. > > >
Message 5 of 8
Anonymous
in reply to: mgrigoriev

Maksim Sestic wrote: > Or simply find the polyline's midst segment, then find the mid point > of that segment. Pure VBA. And if a polyline has an even number of segments? Besides, what makes you think these classes are not pure VBA? -- Gravity: it's not just a good idea, it's the law.
Message 6 of 8
Anonymous
in reply to: mgrigoriev

What if the pline had a bunch of short segs on one side and long one(s) on other side(of center)? "Maksim Sestic" wrote in message news:40a75954_1@newsprd01... > Or simply find the polyline's midst segment, then find the mid point of that > segment. Pure VBA. > > Regards, > Maksim Sestic
Message 7 of 8
Anonymous
in reply to: mgrigoriev

Also, that would require that each segment be equal length, e.g. a 3 segment pl with lengths of 10,10,1 units. The midpoint would not be on the *middle* of the second segment, but weighted toward the first segment. -- ---- Ed ---- "Frank Oquendo" wrote in message news:40a81f18$1_1@newsprd01... Maksim Sestic wrote: > Or simply find the polyline's midst segment, then find the mid point > of that segment. Pure VBA. And if a polyline has an even number of segments? Besides, what makes you think these classes are not pure VBA? -- Gravity: it's not just a good idea, it's the law.
Message 8 of 8
Anonymous
in reply to: mgrigoriev

Allright, allright, my mistake - here's the coded answer (more or less): It solves LWPlines with line segments only - no arcs included. Also no error trapping of any kind. Pass the function the LWPline length (search the code down the NG) divided by 2 and the LWPline itself. '=========================================================================== ==== ' Stationery point along LWPolyline ' Input: polyline length/2 and polyline itself ' Result: forced 2D point (three element array of doubles) '=========================================================================== ==== Function StacionazaTacka(valStacionaza As Double, obj As AcadLWPolyline) As Variant Dim Coords As Variant Dim UBnd As Long Dim PntA(0 To 2) As Double Dim PntB(0 To 2) As Double Dim PntX As Variant Dim RunDist As Double Dim DistAB As Double Dim i as Long RunDist = 0 DistAB = 0 Coords = obj.Coordinates UBnd = UBound(Coords) i = 0 Do While True PntA(0) = Coords(i): PntA(1) = Coords(i + 1): PntA(2) = 0 PntB(0) = Coords(i + 2): PntB(1) = Coords(i + 3): PntB(2) = 0 DistAB = XYDistance(PntA, PntB) PrevDist = RunDist RunDist = RunDist + DistAB If RunDist >= valStacionaza Then ugao = ThisDrawing.Utility.AngleFromXAxis(PntA, PntB) Razlika = DistAB - (RunDist - valStacionaza) PntX = ThisDrawing.Utility.PolarPoint(PntA, ugao, Razlika) StacionazaTacka = Array(PntX(0), PntX(1), 0#) Exit Do End If If i + 2 > UBnd Then StacionazaTacka = Array(0#, 0#, 0#) Exit Do Else i = i + 2 End If Loop End Function "Frank Oquendo" wrote in message news:40a81f18$1_1@newsprd01... > Maksim Sestic wrote: > > Or simply find the polyline's midst segment, then find the mid point > > of that segment. Pure VBA. > > And if a polyline has an even number of segments? > > Besides, what makes you think these classes are not pure VBA? > > -- > Gravity: it's not just a good idea, it's the law. > >

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

Post to forums  

Autodesk Design & Make Report

”Boost