Request 4 C# sample code -Entities in named view
Moderators: SDS, support, admin
Request 4 C# sample code -Entities in named view
Does anyone have some sample code on how they extracted all of the entities beloning to a named view?
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:
Sergey.
Please post questions to the forum or write to support@cadsofttools.com
<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">
}
}
Please post questions to the forum or write to support@cadsofttools.com