Author Topic: Check number side of polygon  (Read 1989 times)

0 Members and 1 Guest are viewing this topic.

miquan

  • Guest
Check number side of polygon
« on: March 06, 2014, 11:07:12 AM »
Dear,

I have many grid line, I just want to triangle or rectangular shape (number of sides of each cell is smaller than or equal to 4 sides).
Are there any lisp to check that?

Thanks,
Miiquan

CAB

  • Global Moderator
  • Seagull
  • Posts: 10376
Re: Check number side of polygon
« Reply #1 on: March 06, 2014, 11:26:08 AM »
Not enough information for me.
I have never seen your drawing nor do I know what ACAD objects the grid lines are made of.
Perhaps you can explain it so your receptionist could understand the question & then I would too.  8)
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.

ronjonp

  • Needs a day job
  • Posts: 7076
Re: Check number side of polygon
« Reply #2 on: March 06, 2014, 12:35:28 PM »
If these polygons are drawn with the command 'polygon' this would give you the number of sides.
Code: [Select]
(vlax-curve-getEndParam (car (entsel)))

Windows 10 x64 - AutoCAD /C3D 2020

Custom Build PC

Lee Mac

  • Seagull
  • Posts: 12319
  • London, England
Re: Check number side of polygon
« Reply #3 on: March 06, 2014, 01:34:14 PM »
Or
Code: [Select]
(if (setq s (ssget "_+.:E:S" '((0 . "LWPOLYLINE") (-4 . "&=") (70 . 1))))
    (cdr (assoc 90 (entget (ssname s 0))))
)

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Check number side of polygon
« Reply #4 on: March 06, 2014, 05:06:08 PM »

Lee, I think that will fail if the polyline has Plinegen on. The dxf 70 is bit-coded .. so it's value could be 1 or 129 depending on Plinegen setting.

Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

--> Donate to theSwamp<--

Lee Mac

  • Seagull
  • Posts: 12319
  • London, England
Re: Check number side of polygon
« Reply #5 on: March 06, 2014, 05:39:26 PM »
Lee, I think that will fail if the polyline has Plinegen on. The dxf 70 is bit-coded .. so it's value could be 1 or 129 depending on Plinegen setting.

Hence the bitwise equals mask (-4 . &=)  :wink:

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Check number side of polygon
« Reply #6 on: March 06, 2014, 06:39:22 PM »
Lee, I think that will fail if the polyline has Plinegen on. The dxf 70 is bit-coded .. so it's value could be 1 or 129 depending on Plinegen setting.

Hence the bitwise equals mask (-4 . &=)  :wink:

missed that ; I should look more closely, shouldn't I.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

--> Donate to theSwamp<--

miquan

  • Guest
Re: Check number side of polygon
« Reply #7 on: March 07, 2014, 12:32:42 AM »
Dear CAB,

Sorry for not clear information.

I attached here with my grid lines, I broke them at their intersections.

I need a lisp to select all grids, after that check number of polygon cell.

If number of sides is larger than 4, these sides will be selected, and change layer (Ex: Grid_1).

Thanks,
Miquan

Lee Mac

  • Seagull
  • Posts: 12319
  • London, England
Re: Check number side of polygon
« Reply #8 on: March 08, 2014, 09:49:58 AM »
Hi Miquan,

You could use the programs shared in this thread to generate polylines for each grid cell, and then process the resulting polylines to check for those with more than 4 sides.

I hope this helps.