Jump to content

Recommended Posts

Posted

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.

 

588494049_Screenshot(2191).thumb.png.e16eefab50c88818d0c6f7d623b9559a.png

 

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)
     )

 

Posted (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 by dan20047
  • Like 1
Posted

Did you google pretty sure it would be out there. Like dan20047 need to look at points (10 and is bulge (42

  • Like 1
Posted

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 

 

 

image.png.c68cfd60a1af0f9a10f3c4783be026c4.png

  • Like 1
Posted
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 ?

Posted (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 by Isaac26a
Posted

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 

 

 

 

 

 

 

 

 

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...