bhargav1987 Posted April 28, 2010 Share Posted April 28, 2010 I Just want to know is there any possibility to draw a polyline on a different polyline from half distance from starting point and half distance from ending point of polyline???? I know tat my question is peculiar one .. but i want to know the way..if it can be done.. Expecting help Quote Link to comment Share on other sites More sharing options...
ReMark Posted April 28, 2010 Share Posted April 28, 2010 Half the distance from each end of a line is the midpoint isn't it? Quote Link to comment Share on other sites More sharing options...
Tiger Posted April 28, 2010 Share Posted April 28, 2010 ... from half distance from starting point and half distance from ending point of polyline???? you mean the Midpoint of the line? Do you use OSnaps? if not, turn them on with the F3-key, then go into OSnap settings (Tools > Drafting Settings > Obejct Snap tab) and tick Midpoint. dang, beat by the Tinman :wink: Quote Link to comment Share on other sites More sharing options...
bhargav1987 Posted April 28, 2010 Author Share Posted April 28, 2010 Half the distance from each end of a line is the midpoint isn't it? Ya..ReMark..U r right...But i want to convey is half the distance from oneend is midpoint tat's true.. But i want to draw line from tat midpoint to say to length 0.5,along the polyline..using VBA Can u help me with this?? Quote Link to comment Share on other sites More sharing options...
bhargav1987 Posted April 28, 2010 Author Share Posted April 28, 2010 you mean the Midpoint of the line? Do you use OSnaps? if not, turn them on with the F3-key, then go into OSnap settings (Tools > Drafting Settings > Obejct Snap tab) and tick Midpoint. dang, beat by the Tinman :wink: Ya..Tiger..U r right..But i want to do it using vba Quote Link to comment Share on other sites More sharing options...
ReMark Posted April 28, 2010 Share Posted April 28, 2010 Maybe you should have mentioned that VBA thing (and the distance) in your first post. Quote Link to comment Share on other sites More sharing options...
muthu123 Posted April 28, 2010 Share Posted April 28, 2010 Wat i understtod is you need to draw a polyline start/end from 1/3rd of that polyline length from both side. i.e) the new polyline length will be half of the original one. Am i correct? otherwise, Please explain clearly.If possible provide an image. Quote Link to comment Share on other sites More sharing options...
Tiger Posted April 28, 2010 Share Posted April 28, 2010 Ya..ReMark..U r right...But i want to convey is half the distance from oneend is midpoint tat's true..But i want to draw line from tat midpoint to say to length 0.5,along the polyline..using VBA Can u help me with this?? urgh...not to complain too much, but all this text-speek makes your post pretty unreadable for me. I can't help with VBA, and to be fair you did not say that you wanted a VBA-solution in the original post, but to find the midpoint of two points you can use the OSnap M2P (no tickbox for it, have to type M2P at the commandline while the command is active) as well, that might be more what you are looking for. Quote Link to comment Share on other sites More sharing options...
ReMark Posted April 28, 2010 Share Posted April 28, 2010 Can you tell us what the point of this little exercise is? Is there an overriding need to reinvent the wheel to locate the midpoint of one line to start a second line? What do you mean by drawing along the line? Next to it or on top of it? And what would be the point of drawing one line atop another? Isn't this something we try to avoid as CAD users? Quote Link to comment Share on other sites More sharing options...
bhargav1987 Posted April 28, 2010 Author Share Posted April 28, 2010 Wat i understtod is you need to draw a polyline start/end from 1/3rd of that polyline length from both side. i.e) the new polyline length will be half of the original one. Am i correct? otherwise, Please explain clearly.If possible provide an image. Ya..u r correct.. I have attached an image in tat one red line is already drawn.... i want to draw another polyline of cyan colour.. So...automatically by vba...on click of red line..i want to draw cyan line.. Hope now i said it clearly Quote Link to comment Share on other sites More sharing options...
ReMark Posted April 28, 2010 Share Posted April 28, 2010 Not up to answering my other questions I see. Oh well. On to more pressing matters. Good day. Note: It is not good drafting practice to draw one line atop another like you have shown. Quote Link to comment Share on other sites More sharing options...
bhargav1987 Posted April 28, 2010 Author Share Posted April 28, 2010 Not up to answering my other questions I see. Oh well. On to more pressing matters. Good day. Note: It is not good drafting practice to draw one line atop another like you have shown. i can't understand wat u r saying remark.. wat actually i want is if as shown in image if byclicking one line if it possible to draw another line on it..it will help me a lot... Tell me the possibility please Quote Link to comment Share on other sites More sharing options...
MSasu Posted April 28, 2010 Share Posted April 28, 2010 If is about a line may use the code below to get his middle point; for a polyline will be quite elaborate: Point1st = MyLine.StartPoint Point2nd = MyLine.EndPoint theAngle = MyLine.Angle ReDim Point3rd(2) Point3rd(0) = 0.5 * (Point1st(0) + Point2nd(0)) 'X Point3rd(1) = 0.5 * (Point1st(1) + Point2nd(1)) 'Y Point3rd(2) = 0.5 * (Point1st(2) + Point2nd(2)) 'Z Regards, Quote Link to comment Share on other sites More sharing options...
bhargav1987 Posted May 7, 2010 Author Share Posted May 7, 2010 If is about a line may use the code below to get his middle point; for a polyline will be quite elaborate: Point1st = MyLine.StartPoint Point2nd = MyLine.EndPoint theAngle = MyLine.Angle ReDim Point3rd(2) Point3rd(0) = 0.5 * (Point1st(0) + Point2nd(0)) 'X Point3rd(1) = 0.5 * (Point1st(1) + Point2nd(1)) 'Y Point3rd(2) = 0.5 * (Point1st(2) + Point2nd(2)) 'Z Regards, Thanks for reply... But i want to do it on a polyline.... the vb u have given gives only midpoint right?? But wat i actually want is to draw a line to a particular length on a polyline for some distance... Pls help me with this Quote Link to comment Share on other sites More sharing options...
MSasu Posted May 7, 2010 Share Posted May 7, 2010 Presuming a XoY polyline with two vertexes: PlineVertexes = MyPLine.Coordinates DeltaX = PlineVertexes(3) - PlineVertexes(0) 'displacement on X DeltaY = PlineVertexes(4) - PlineVertexes(5) 'displacement on Y If DeltaX = 0 Then theAngle = 0.5 * pi '90 degrees Else theAngle = Atn(DeltaY / DeltaX) 'polyline's angle End If ReDim Point3rd(2) 'middle point Point3rd(0) = 0.5 * (PlineVertexes(3) + PlineVertexes(0)) 'X Point3rd(1) = 0.5 * (PlineVertexes(4) + PlineVertexes(5)) 'Y Point3rd(2) = 0# 'Z 'calculate new angle by adding or subtracting 90 degrees NewAngle = theAngle + 0.5 * pi 'LEFT side 'NewAngle = theAngle - 0.5 * pi 'RIGHT side 'calculate the new point at arbitrary distance (1 unit) NewDistance = 1 ReDim Point4th(2) 'new point Point4th(0) = Point3rd(0) + NewDistance * Cos(NewAngle) Point4th(1) = Point3rd(1) + NewDistance * Sin(NewAngle) Point4th(2) = 0# ThisDrawing.ModelSpace.AddLine Point3rd, Point4th Regards, Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.