Author Topic: verify closed polyline  (Read 8777 times)

0 Members and 1 Guest are viewing this topic.

Fabricio28

  • Swamp Rat
  • Posts: 666
verify closed polyline
« on: October 21, 2013, 12:14:01 PM »
Hi guys,

I used the join command to close a polygon. But for me the polygon was closed, in fact didn't, and gave me the wrong area.
I discover it through the properties palette.

Is there any lisp that can find the polygon is not closed?

I have about 50 polygons in my drawing.

Thank in advance

Tharwat

  • Swamp Rat
  • Posts: 707
  • Hypersensitive
Re: verify closed polyline
« Reply #1 on: October 21, 2013, 12:26:19 PM »
This is to check if an object (LWpolyline) is closed or not .

Code: [Select]
(vla-get-closed < vla-object >)
And it should return either of two , :vlax-false / :vlax-true

ronjonp

  • Needs a day job
  • Posts: 7526
Re: verify closed polyline
« Reply #2 on: October 21, 2013, 12:29:40 PM »
You can also check if the start and end point are equal to a fuzz tolerance.

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

rkmcswain

  • Swamp Rat
  • Posts: 978
Re: verify closed polyline
« Reply #3 on: October 21, 2013, 01:13:56 PM »
You can also check if the start and end point are equal to a fuzz tolerance.

The start and end points can be exactly the same and that does not make it a closed polyline.

See also:
http://www.4d-technologies.com/techcenter/pl/pl_open.lsp
http://forums.autodesk.com/t5/Visual-LISP-AutoLISP-and-General/Check-polyline-if-closed/m-p/861882#M87540
http://bit.ly/18D0Vve


CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: verify closed polyline
« Reply #4 on: October 21, 2013, 02:20:36 PM »
Try this:
Code: [Select]
;;  get closed polyline
(setq ss (ssget  '((0 . "LWPOLYLINE,POLYLINE")(-4 . "&")(70 . 1))))
;;  gets not closed plines  by CAB,
(ssget "x"  '( (0 . "LWPOLYLINE") (-4 . "<not") (-4 . "&") (70 . 1) (-4 . "NOT>")) )
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Fabricio28

  • Swamp Rat
  • Posts: 666
Re: verify closed polyline
« Reply #5 on: October 21, 2013, 03:29:42 PM »
Thank for the quick replay, guys,

Someone could explain to me, why is that polygon gave me the wrong area?

Regards

ronjonp

  • Needs a day job
  • Posts: 7526
Re: verify closed polyline
« Reply #6 on: October 21, 2013, 03:55:13 PM »
Thank for the quick replay, guys,

Someone could explain to me, why is that polygon gave me the wrong area?

Regards


How are you calculating the area? I get the same area for both (closed or not).

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

Fabricio28

  • Swamp Rat
  • Posts: 666
Re: verify closed polyline
« Reply #7 on: October 21, 2013, 04:06:01 PM »
Hi ronjonp,
Yes, I'm calculating the area. But before that I have to join the polylines.
I don't understand why that polygon gave me the wrong area.

Thank you


ronjonp

  • Needs a day job
  • Posts: 7526
Re: verify closed polyline
« Reply #8 on: October 21, 2013, 04:11:08 PM »
Hi ronjonp,
Yes, I'm calculating the area. But before that I have to join the polylines.
I don't understand why that polygon gave me the wrong area.

Thank you


Are you using code to get the areas? If so, post what function you're using.

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

Fabricio28

  • Swamp Rat
  • Posts: 666
Re: verify closed polyline
« Reply #9 on: October 21, 2013, 04:15:23 PM »
Yes. I'm using Areas to Field from Lee Mac.
But even area command from the autocad is give me the wrong area.

Code: [Select]
Command: area

Specify first corner point or [Object/Add area/Subtract area] <Object>: o

Select objects:

Area = 40939.78, Length = 862.45

should be something wrong with the polygon.

ronjonp

  • Needs a day job
  • Posts: 7526
Re: verify closed polyline
« Reply #10 on: October 21, 2013, 04:20:16 PM »
Must be something specific to your setup. I cannot reproduce the differing areas.  :?

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

Fabricio28

  • Swamp Rat
  • Posts: 666
Re: verify closed polyline
« Reply #11 on: October 21, 2013, 04:27:05 PM »
Did you see my attached file?
Is it giving the wrong area? (40939.78)

I don't know what happened, maybe you're right should be something about the setup.


ronjonp

  • Needs a day job
  • Posts: 7526
Re: verify closed polyline
« Reply #12 on: October 21, 2013, 04:28:49 PM »
Did you see my attached file?
Is it giving the wrong area? (40939.78)


Yes and no.

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

snownut2

  • Swamp Rat
  • Posts: 971
  • Bricscad 22 Ultimate
Re: verify closed polyline
« Reply #13 on: October 21, 2013, 05:08:00 PM »
Is the proper area listed in the properties box if you just high-lite the polyline ?

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: verify closed polyline
« Reply #14 on: October 21, 2013, 05:28:05 PM »
Both plines show the same area for me ACAD2006

I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.