Author Topic: How to select Rectangles which are created by the RECTANG command  (Read 2151 times)

0 Members and 1 Guest are viewing this topic.

waterharbin

  • Guest
Hello,I would like to define a SelectionFilter to select the rectangles, lines, texts. And Here is what I have:
Code: [Select]
SelectionFilter flt = new SelectionFilter(new TypedValue[] { new TypedValue(0, "TEXT,MTEXT,LINE,POLYLINE") });

It works for lines and texts, but can not select rectangles.Those rectangles are all created by the RECTABG command. We click the Rectangle Icon on the toolbar to fire this command.

How can I do it right? I don't want to explode every rectangle.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: How to select Rectangles which are created by the RECTANG command
« Reply #1 on: April 13, 2015, 02:26:10 AM »
There is no RECTANGLE Type object.


One way to solve the problem is to select Polylines and then Test


Is the PLINE closed,
Does it have 4 sides ( check vertex count),
are the opposite sides the same length, or are the diagonals the same length,
Is one internal angle a right angle.


The process for each step is relatively simple.
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

waterharbin

  • Guest
Re: How to select Rectangles which are created by the RECTANG command
« Reply #2 on: April 13, 2015, 08:27:49 AM »
Hello,Kerry,Thanks for your answer.
But there is still the problem, Rectangles are PolyLine objects, but my SelectionFilter just can not include PolyLine. I will need to select PolyLine before I make any judgment. So, is there any improvement for my SelectionFilter?

owenwengerd

  • Bull Frog
  • Posts: 451
Re: How to select Rectangles which are created by the RECTANG command
« Reply #3 on: April 13, 2015, 10:33:44 AM »
Your rectangles are likely LWPOLYLINE objects. Try adding LWPOLYLINE to your filter list.

waterharbin

  • Guest
Re: How to select Rectangles which are created by the RECTANG command
« Reply #4 on: April 13, 2015, 11:25:57 AM »
Hi, Owen. Thanks very much. That is what I want. :laugh:

rkmcswain

  • Swamp Rat
  • Posts: 978
Re: How to select Rectangles which are created by the RECTANG command
« Reply #5 on: April 13, 2015, 03:37:43 PM »
I have no business in the .NET forum.... but just wanted to say that it is possible for "rectangles" to be either an LWPOLYLINE or a POLYLINE.
According the documentation, the RECTANG command will always create an LWPOLYLINE, but anyone can create a rectangular shaped polygon with the PLINE command while PLINETYPE = 0.
Also, an LWPOLYLINE created with the RECTANG command can easily be converted to a POLYLINE with the CONVERTPOLY command.

So in summary, you can't assume that all "rectangles" will be LWPOLYLINES.


waterharbin

  • Guest
Re: How to select Rectangles which are created by the RECTANG command
« Reply #6 on: April 13, 2015, 09:42:38 PM »
Hi
You are absolutly right. But in most cases, Rectangle is LWPOLYLINE. That is enough for me.