0

I loaded a cadfile in which a lot of lines are drawn. I want to make a rectangle region, using 4 vertices(X, Y Coordinate value) so that I can click the region not just one point.

I found Block class in devDept.Eyshot but I don't know how to use it. Please give any ideas or c# code example for me.

James Coyle
  • 9,922
  • 1
  • 40
  • 48

1 Answers1

0

You don't need block to do that. You used the correct word and that is Region. A Region is a visual entity that has many vertices. It's technically a polygon. If you want you can use the simple method :

var width = 10d;
var height = 10d;
var region = devDept.Eyeshot.Entities.Region.CreateRectangle(width, height, true);
viewport.Entities.Add(region);

When you use the method to get the entities under mouse, the whole surface of the region is taken into account. It works perfectly

Franck
  • 4,438
  • 1
  • 28
  • 55
  • Thank you for kind answering:) But I want to click not just surface of rectangle but whole region of it. So If I click any point in the rectangle, I want to make an event. Can I do that using [Region] only ? I thought I had to use [Block] class. – Donuk Kim Mar 22 '19 at 02:26
  • You cannot in any way trigger a click event from a 3d object. Click are not performing event in the entities at all. You need bind the `viewport.Click` event and in there you need to call `viewport.GetAllEntitiesUnderMouseCursor()` this will return you all entities that are in the view vector that the mouse is over it. A `Region` object as i said in my answer the whole surface of that region will get caught by the `viewport.GetAllEntitiesUnderMouseCursor()` if you mouse is really over. – Franck Mar 22 '19 at 12:02
  • Is there any way to bind the [Viewport] under conditions?? I want to click the region of the viewport. – Donuk Kim Mar 23 '19 at 08:14
  • @DonukKim Well if you do not know enough on how to use the click event of a control i can't do much for you. You should go learn some very basic tutorials. – Franck Mar 23 '19 at 19:33