hosneyalaa Posted March 21, 2020 Posted March 21, 2020 (edited) Hello all..... Sorry for my language Is there a IDEA TO determinatING Location LENGTHS FOR POLYLINE I try depending on the starting and ending coordinates And then from the center POLYLINE If possible, someone has an idea To share the work Photo attachment + working file Thank you very much, everyone QQ.dwg Edited March 28, 2020 by CADTutor Reduced text size Quote
dlanorh Posted March 21, 2020 Posted March 21, 2020 I cannot open your drawing, can you save as AutoCAD version 2010 or earlier 1 1 Quote
BIGAL Posted March 21, 2020 Posted March 21, 2020 dlanorh a simple closed pline but it has arcs and wants line lengths based on angle in a quadrant Maybe start with lee-mac's pline details lisp, will have to have a think. Note pline will have to be checked for clockwise etc. 1 Quote
dlanorh Posted March 22, 2020 Posted March 22, 2020 It's the North/South/West/East bit that's confusing. The number of entries doesn't add up unless you get to see the drawing 1 Quote
BIGAL Posted March 22, 2020 Posted March 22, 2020 (edited) Hopefully this is 2010. Pretty simple pline shape. QQ 2010.dwg Edited March 22, 2020 by BIGAL 1 1 Quote
hosneyalaa Posted March 22, 2020 Author Posted March 22, 2020 (edited) I want determine location for all lengths If it is located in the north with respect to the center of the area Or some of them are in the East, West or South Is it possible if we create a square around the area and drop the lengths on it to determine its position relative to the area It is an idea, not a solution I would like everyone to share his beautiful ideas if you find enough time Edited March 28, 2020 by CADTutor Reduced text size Quote
dlanorh Posted March 22, 2020 Posted March 22, 2020 You can determine North, South, East and West from the azimuth (not the angle) of the line segment, you just have to define what constitutes North South East and West. I would suggest anything lying between 45 degrees and 135 degrees would be East 135 degrees and 225 degrees would be South 225 degrees and 315 degrees would be West anything else would be North You'll need to get your >=, >, <= and < correct though 1 Quote
BIGAL Posted March 22, 2020 Posted March 22, 2020 (edited) I think this explains here in AUS its 0-360 https://readcivil.com/bearing-in-surveying-definition-types-and-designation-of-bearing/ look at quadrant. Edited March 22, 2020 by BIGAL 1 Quote
dlanorh Posted March 23, 2020 Posted March 23, 2020 @hosneyalaa are you after a solution or just ideas? 1 Quote
BIGAL Posted March 23, 2020 Posted March 23, 2020 (edited) hosneyalaa asks for example code in 1st post ? Some ideas 4 text strings depending on quad use strcat lengths then write a simple mtext 4 lines. I need some time. Something wrong where angles are exact like 0.0 not sure what I have done wrong. (defun c:nsew ( / t1 t2 t3 t4 ss plent co-ord x pt1 pt2) (setq t1 "Northing ") (setq t2 "Easting ") (setq t3 "Southing ") (setq t4 "Westing ") (setq ss (ssget "+.:E:S" '((0 . "LWPOLYLINE")))) (setq plent (ssname ss 0)) (setq co-ord (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 10)) (entget plent)))) (setq co-ord (cons (nth (- (length co-ord) 1) co-ord)co-ord)) (setq x 0) (setq pt1 (nth x co-ord)) (repeat (- (length co-ord) 1) (setq pt2 (nth (setq x (+ x 1)) co-ord)) (setq ang (angle pt1 pt2)) (setq dist (strcat (rtos (distance pt1 pt2) 2 3) " ")) (cond ((equal ang 0.0 1e-05 )(setq t1 (strcat t1 dist " " (rtos ang 2 3)))) ((and (>= ang 0.00000001 )(<= ang (/ pi 2.0)))(setq t1 (strcat t1 dist " " (rtos ang 2 3)))) ((and (> ang (+ (/ pi 2.0) 0.00000001))(<= ang pi))(setq t2 (strcat t2 dist " " (rtos ang 2 3)))) ((and (> ang (+ pi 0.00000001))(<= ang (* 1.5 pi)))(setq t3 (strcat t3 dist " " (rtos ang 2 3)))) ((and (> ang (+ (* 1.5 pi) 0.00000001))(<= ang (* 2.0 pi)))(setq t4 (strcat t4 dist " " (rtos ang 2 3)))) ((alert (strcat "missed " (rtos ang 2 6)))) ) (setq pt1 pt2) ) (setq pt1 (getpoint "\nPick Top left for text")) (setq pt2 (getpoint pt1 "\nPick Bottom right")) (command "mtext" pt1 pt2 t1 t2 t3 t4 "") (princ) ) (c:nsew) Edited March 23, 2020 by BIGAL 1 Quote
hosneyalaa Posted March 23, 2020 Author Posted March 23, 2020 (edited) thank you dlanorh BIGAL To respond and interact with me And already by the idea of the corners before dlanorh And the wonderful code before BIGAL This is what I was asking Thank you very much Always be well and good health Edited March 28, 2020 by CADTutor Reduced text size Quote
dlanorh Posted March 23, 2020 Posted March 23, 2020 @hosneyalaa Attached is attempt so far. This only works for clockwise polylines at present but I should be able to incorporate ccw polylines tomorrow. Hope this is what you're after. Bearing_and_DistancePolyH.lsp 1 Quote
BIGAL Posted March 23, 2020 Posted March 23, 2020 dlanorh I was having problem with angle 0.0 draw a rectang, (> azi 0.0) what about 0.0 in cond, good idea using vlax-curve. ;simple clock wise test by Gile (defun gc:clockwise-p ( p1 p2 p3 ) (< (sin (- (angle p1 p3) (angle p1 p2))) -1e-14)) 1 Quote
dlanorh Posted March 24, 2020 Posted March 24, 2020 2 hours ago, BIGAL said: dlanorh I was having problem with angle 0.0 draw a rectang, (> azi 0.0) what about 0.0 in cond, good idea using vlax-curve. ;simple clock wise test by Gile (defun gc:clockwise-p ( p1 p2 p3 ) (< (sin (- (angle p1 p3) (angle p1 p2))) -1e-14)) I use Gile's code alot, but prefer to use the offset method for closed polylines, as you can construct a ccw polygon where the first half reports as clockwise (crescent shape). I just haven't had a chance to update the other parts of the routine where the azimuths will fill the opposite string. 1 Quote
hosneyalaa Posted March 24, 2020 Author Posted March 24, 2020 (edited) On 23/03/2020 at 22:56, dlanorh said: @hosneyalaa Attached is attempt so far. This only works for clockwise polylines at present but I should be able to incorporate ccw polylines tomorrow. Hope this is what you're after. Bearing_and_DistancePolyH.lsp 3.95 kB · 3 downloads dlanorh Thank you very much Interesting code Thank you for help Edited March 28, 2020 by CADTutor Reduced text size Quote
dlanorh Posted March 24, 2020 Posted March 24, 2020 Attached is lisp to handle both cw and ccw lwpolylines Bearing_and_DistancePolyH.lsp 1 Quote
sanju2323 Posted March 24, 2020 Posted March 24, 2020 @dlanorh I have tested this lisp on another drawing but it mixes some length in different directions. Plot Length.dwg Quote
dlanorh Posted March 24, 2020 Posted March 24, 2020 2 hours ago, sanju2323 said: @dlanorh I have tested this lisp on another drawing but it mixes some length in different directions. Plot Length.dwg 172.89 kB · 1 download I am aware that there are many shapes where it will be deemed wrong, but it is subjective. See attached drawing. If you rotate the left most shape so that "West" is vertical it will give the correct answer. There is no correct answer when a segment is visible from multiple quadrants. This is a just a simple algorithm that sorts segments according to the azimuth of that segment (or the chord if the segment is arc'd). I'm sure there is a better algorithm, but Rome wasn't built in a day. I'll cogitate on a minimum enclosing boundingbox. Plot Length comments.dwg Quote
BIGAL Posted March 25, 2020 Posted March 25, 2020 Don't understand this "There is no correct answer when a segment is visible from multiple quadrants." if you walk around any pline shape say clockwise the angle forward will change between the two vertices making that segment so it can only exist in one quadrant. It can fall on 0.0 90 etc. (defun c:test ( / plent co-ord x ang) (setq plent (entsel "\nPick pline")) (setq co-ord (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 10)) (entget (car plent))))) (setq co-ord (cons (nth (- (length co-ord) 1) co-ord) co-ord)) (setq x 0) (repeat (- (length co-ord) 1) (setq ang (angle (nth x co-ord)(nth (setq x (+ x 1)) co-ord))) (princ (strcat "\n" (rtos ang 2 4))) ) ) (c:test) Quote
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.