RepCad Posted May 10, 2021 Posted May 10, 2021 Hello everyone, I wrote some codes to add dimension on a polyline, it works well on all the polylines but there is a problem on arc part of the polyline so that dimension line not aligned on the arc (I expect the right dimension in the attached image), can someone help with this my project? Thanks in advanced. This is my code : (setq s (car(entsel)) (setq obj (vlax-ename->vla-object s)) (setq pli (acet-geom-vertex-list s)) (setq i -1) (repeat (1- (length pli)) (setq i (1+ i)) (setq p1 (nth i pli)) (setq p2 (nth (1+ i) pli)) (setq ang (angle p1 p2)) (setq pm (acet-geom-midpoint p1 p2)) (setq p3 (polar pm (+ ang (* pi 0.5)) 1.0)) (setq p11 (vlax-3d-point p1)) (setq p22 (vlax-3d-point p2)) (setq p33 (vlax-3d-point p3)) (vla-adddimaligned space p11 p22 p33) ) Quote
dan20047 Posted May 10, 2021 Posted May 10, 2021 (edited) I think you need vla-AddDimArc instead of vla-adddimaligned, when the pline segment has a bulge. With entity data you can check group code 42 (below where not 0.0), but I don't know how to do that with vla (-1 . <Entity name: 4f149780>) (0 . "LWPOLYLINE") (5 . "394C7") (330 . <Entity name: 5388b2a0>) (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 . "A-Anno-Dims") (100 . "AcDbPolyline") (90 . 3) (70 . 1) (43 . 0.0) (38 . 0.0) (39 . 0.0) (10 4356.84804203341 350.624586629363) (40 . 0.0) (41 . 0.0) (42 . 0.0) (91 . 0) (10 4406.20408925404 379.348187880717) (40 . 0.0) (41 . 0.0) (42 . 0.442890086327557) (91 . 0) (10 4343.90219358209 394.721382916653) (40 . 0.0) (41 . 0.0) (42 . 0.0) (91 . 0) (210 0.0 0.0 1.0) Edited May 10, 2021 by dan20047 1 Quote
BIGAL Posted May 11, 2021 Posted May 11, 2021 Did you google pretty sure it would be out there. Like dan20047 need to look at points (10 and is bulge (42 1 Quote
devitg Posted May 11, 2021 Posted May 11, 2021 I got it , to set the arc dim is easy , any way, inside or outside , for lines it is problem, I know it is a pollyne. As to test in your case , please upload a real - true- as yor use, a sample dwg , not so simple as the screenshot yo show us And if yo admit the dim to be any way located 1 Quote
devitg Posted May 11, 2021 Posted May 11, 2021 (edited) What do I mean, is some like this sample . it is a real true sample dim arced polylines.dwg Edited May 11, 2021 by devitg add images 1 Quote
RepCad Posted May 12, 2021 Author Posted May 12, 2021 On 5/11/2021 at 1:23 PM, BIGAL said: Did you google pretty sure it would be out there. Like dan20047 need to look at points (10 and is bulge (42 Yes I searched google for few days, I found that my program must check dxf 42 of each vertex that is arc or not by : (vla-getbulge obj param) Then if the vertex is an Arc we can create arc dimension by : (vla-adddimarc centerpoint startpoint endpoint textpoint) And now we have start and end point and text point, but now I don't know how to find centerpoint of ARC, we able to find the center point in single ARC by this vla function : (vla-get-center arcObj) But in this case Arc is a part of polyline and not a single Arc, so this function won't work. Can anyone tell me how I can find center point of an arc on a polyline ? Quote
dan20047 Posted May 12, 2021 Posted May 12, 2021 (edited) this may help: http://lee-mac.com/bulgeconversion.html (which I found by searching the Swamp) https://www.google.com/search?q=site%3A\\theswamp.org+bulge Edited May 12, 2021 by dan20047 Quote
Isaac26a Posted May 12, 2021 Posted May 12, 2021 (edited) If I'm not wrong Devitg had already solved this problem here. Take a look, I think it's a great job. Or was the original work of Stefan M. I don't know but still a great job. Edited May 12, 2021 by Isaac26a Quote
devitg Posted May 12, 2021 Posted May 12, 2021 the trick is make tmp layer copy the poly sent copyed to the tmp layer explode select all lines and arcs dim it all at the original layer erase tmp layers objects of course it will not be annotative or whatsever relate an object with it's dim , Some time we have to let ACAD work by it self or , make the lisp the same way you do it by HAND . KISS Keep it simple SIR 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.