Request 4 C# sample code -Entities in named view

Discuss and ask questions about CAD .NET library.

Moderators: SDS, support, admin

Post Reply
michael
Posts: 13
Joined: 28 Mar 2007, 23:37
Location: USA

Request 4 C# sample code -Entities in named view

Post by michael » 26 Apr 2007, 00:39

Does anyone have some sample code on how they extracted all of the entities beloning to a named view?

support
Posts: 3272
Joined: 30 Mar 2005, 11:36
Contact:

Post by support » 26 Apr 2007, 10:55

Hello Michael!

<b>AutoCAD</b> menu command <b>View > Viewports > Named Viewports...</b> allows defining different views on the main layout named <b>Model</b>. <b>AutoCAD</b> uses entities which belongs to <b>Model</b> to view all these views. It means that every viewport has one and the same row of entities. That is why it is impossible to determine what entities belongs to some specific viewport. They are all the same.

The following code is based on <b>Viewer</b> demo:

Code: Select all

<font color="blue">private</font id="blue"> void btnGetEntities_Click(object sender, System.EventArgs e)
{
	<font color="blue">if</font id="blue"> (FCADImage == <font color="blue">null</font id="blue">)
		<font color="blue">return</font id="blue">;
	<font color="blue">for</font id="blue"> (<font color="blue">int</font id="blue"> i = 0; i < FCADImage.Layouts[0].Converter.Entities.Count; i++)
	{
		<font color="green">//get all entities on the <b>Model</b> layout</font id="green">
		CADEntity entEntity = (CADEntity)FCADImage.Layouts[0].Converter.Entities[i];				
		<font color="green">//do your actions</font id="green">
	}
}
Sergey.

Please post questions to the forum or write to support@cadsofttools.com

Post Reply